Skip to content

refactor: narrow core runtime registry surface#136

Open
willkill07 wants to merge 1 commit into
NVIDIA:mainfrom
willkill07:wkk_core-public-surface
Open

refactor: narrow core runtime registry surface#136
willkill07 wants to merge 1 commit into
NVIDIA:mainfrom
willkill07:wkk_core-public-surface

Conversation

@willkill07
Copy link
Copy Markdown
Member

@willkill07 willkill07 commented May 21, 2026

Overview

Narrows the public core crate surface for registry internals while preserving the public runtime helpers used by crate consumers and bindings.

  • I confirm this contribution is my own work, or I have the right to submit it under this project's license.
  • I searched existing issues and open pull requests, and this does not duplicate existing work.

Details

  • Make core registry storage types and scope-local registry internals crate-private.
  • Keep public tool and LLM request-intercept and conditional-execution helpers available through api::tool and api::llm.
  • Switch registry-stored callback aliases to Arc so guardrail snapshots can clone callbacks without exposing registry implementation details.
  • Update Rust, Python, Node, FFI, WASM, adaptive, and CLI call sites/tests to use public behavior rather than raw core registry fields.

Validation:

  • cargo fmt --all
  • cargo test -p nemo-flow
  • cargo test -p nemo-flow-adaptive
  • cargo check -p nemo-flow-adaptive
  • cargo check --workspace
  • cargo clippy --workspace --all-targets -- -D warnings
  • just test-rust
  • commit pre-hook checks passed, including cargo fmt, cargo clippy, cargo check, docs linkcheck, SPDX/file hygiene

Where should the reviewer start?

Start with crates/core/src/api/registry.rs and crates/core/src/registry.rs for the narrowed registry model, then crates/core/src/api/runtime/state.rs for the remaining crate-private runtime chains and snapshot evaluation.

Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)

  • Relates to: none

Summary by CodeRabbit

  • Bug Fixes

    • Improved callback memory management by switching from boxed closures to atomic reference-counted (Arc) closures for all middleware callbacks, enabling safer concurrent callback usage.
  • Refactoring

    • Consolidated internal registry entry representations into a unified generic structure for cleaner middleware management.
    • Restricted several internal APIs from public to crate-private visibility to reduce API surface.
    • Updated callback registration APIs to use standardized type aliases for consistency.

Review Change Stack

Signed-off-by: Will Killian <wkillian@nvidia.com>
@willkill07 willkill07 requested a review from a team as a code owner May 21, 2026 13:11
@github-actions github-actions Bot added size:XL PR is extra large Improvement improvement to existing functionality lang:rust PR changes/introduces Rust code labels May 21, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 21, 2026

Walkthrough

This PR refactors the middleware registry system from Box-based to Arc-based callback ownership and replaces the caller-supplied priority-function approach with self-describing registry entries. The core changes propagate through type aliases, registration macros, chain builders, scope-local registries, language bindings, and test suites.

Changes

Core Registry Refactoring

Layer / File(s) Summary
RegistryEntry trait and SortedRegistry refactoring
crates/core/src/registry.rs
Introduces RegistryEntry trait with name() and priority() methods; refactors SortedRegistry<T: RegistryEntry> to be trait-bound, removes stored priority_fn, changes constructor to parameterless, updates register() to derive keys from entry.name(), restricts deregister() and sorted_values() to pub(crate), adds Default impl.
Registry entry types and macro-generated registration
crates/core/src/api/registry.rs
Introduces RegistryRecord<T> and RequestIntercept<F> payload types; replaces public Intercept/ExecutionIntercept/GuardrailEntry structs with pub(crate) type aliases; updates macro-generated registration code to call Guardrail::new()/Intercept::new()/ExecutionIntercept::new() constructors.
Runtime callback type aliases and visibility
crates/core/src/api/runtime/callbacks.rs, crates/core/src/api/runtime.rs
Changes ToolSanitizeFn, ToolInterceptFn, LlmSanitizeRequestFn, LlmSanitizeResponseFn, and LlmRequestInterceptFn from Box<dyn Fn...> to Arc<dyn Fn...>; restricts LlmStreamExecutionRegistryRef and LlmStreamExecutionRegistryRefs to pub(crate) visibility; removes re-exports from runtime module.
NemoFlowContextState chain builders and registry fields
crates/core/src/api/runtime/state.rs
Updates guardrail registry fields from SortedRegistry<GuardrailEntry<...>> to SortedRegistry<Guardrail<...>>, changes visibility to pub(crate), updates initialization to SortedRegistry::new() without priority closure, refactors chain-builder methods to use entry.payload(...) and accept borrowed &[Guardrail<...>] snapshot entries instead of owned values, removes ConditionalGuardrailSnapshot type.
ScopeStack and scope-local registries
crates/core/src/api/runtime/scope_stack.rs, crates/core/src/context/registries.rs
Updates ScopeLocalRegistries and registry fields to use Guardrail<F> types, restricts visibility to pub(crate), removes priority-closure configuration from SortedRegistry::new(), updates merge helpers to work with new entry types and visibility.
Crate-level visibility
crates/core/src/lib.rs
Removes registry module from public crate exports (pub mod registry;mod registry;); updates crate documentation.
API call sites
crates/core/src/api/tool.rs, crates/core/src/api/llm.rs
Updates tool_call_execute and tool_conditional_execution to pass &entries instead of entries to snapshot-chain builders; adjusts formatting in LLM execution functions.

Language Binding Wrapper Updates

Layer / File(s) Summary
FFI, Node.js, Python, and WASM wrappers
crates/ffi/src/callable.rs, crates/node/src/callable.rs, crates/python/src/py_callable.rs, crates/wasm/src/callable.rs
Switches callback construction from Box::new(...) to Arc::new(...) across all language bindings; updates return types to use shared callback type aliases (ToolSanitizeFn, LlmSanitizeRequestFn, LlmSanitizeResponseFn, ToolInterceptFn) instead of inline Box<dyn Fn...> trait objects; extends imports to include callback type aliases.

Test Suite Updates

Layer / File(s) Summary
Core unit tests
crates/core/tests/unit/context_tests.rs, crates/core/tests/unit/plugin_tests.rs, crates/core/tests/unit/registry_tests.rs, crates/core/tests/unit/shared_tests.rs
Introduces PriorityItem test struct implementing RegistryEntry; rewrites registry tests to construct SortedRegistry::new() and register via SortedRegistry::register(item(...)) API; updates plugin and context tests to wrap closures in Arc::new and use new Guardrail/Intercept/ExecutionIntercept struct shapes.
Core integration tests
crates/core/tests/integration/api_surface_tests.rs, crates/core/tests/integration/middleware_tests.rs, crates/core/tests/integration/pipeline_tests.rs, crates/core/tests/integration/scope_local_tests.rs, crates/core/tests/integration/context_isolation_tests.rs
Updates all middleware registrations to wrap closures in Arc::new instead of Box::new; adjusts concurrent-execution verification to use repeated deregister() assertions (== false for already-deregistered entries) instead of direct global context state inspection.
Adaptive and CLI tests
crates/adaptive/tests/unit/runtime_features_tests.rs, crates/adaptive/tests/integration/runtime_integration_tests.rs, crates/cli/tests/coverage/server_tests.rs
Adds registry-level helper assertions for checking registration/absence status; updates feature tests to use new helpers instead of direct global context inspection; wraps closures in Arc::new.

Plugin Layer Updates

Layer / File(s) Summary
Adaptive plugins
crates/adaptive/src/acg_component.rs, crates/adaptive/src/adaptive_hints_intercept.rs
Updates intercept closure construction from Box::new(...) to Arc::new(...).
Observability feature gate
crates/core/src/observability/plugin_component.rs
Gates std::time::Duration import behind #[cfg(any(feature = "otel", feature = "openinference"))].

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

  • NVIDIA/NeMo-Flow#135: Refactors the core conditional-execution guardrail/registry plumbing (Guardrail payloads, snapshot-chain building) that this PR's CLI/OpenClaw toolConditionalExecution guardrail integration relies on; changes are directly connected at guardrail execution code level.
  • NVIDIA/NeMo-Flow#133: Both PRs touch conditional-guardrail evaluation in runtime/state.rs—feat: Emit guardrail scopes for conditional guardrails #133 adds snapshot-based guardrail scope emission using Box→Arc callbacks, while this PR refactors that conditional guardrail snapshot model (removes ConditionalGuardrailSnapshot, uses Guardrail/new registry payloads) so changes are code-level related.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Title follows Conventional Commits format (refactor type, concise imperative summary) and is accurate—the PR narrows the public registry surface by making internals crate-private while preserving runtime helpers.
Description check ✅ Passed Description covers all required template sections: overview explains narrowing the public surface while preserving helpers, details list concrete changes and validation performed, and review start points are specified.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

@willkill07 willkill07 added the breaking PR introduces a breaking change label May 21, 2026
@willkill07 willkill07 added this to the 0.3 milestone May 21, 2026
@willkill07 willkill07 self-assigned this May 21, 2026
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@crates/adaptive/tests/unit/runtime_features_tests.rs`:
- Around line 590-591: After calling rollback_registrations(&mut registrations)
assert that all callback collections have been cleared: verify each registration
bucket/field on the registrations value (e.g., on_message/on_response/on_close
or the actual callback collections present in the Registrations struct) is empty
or that a provided helper like has_active_callbacks() returns false; update the
test in runtime_features_tests.rs to explicitly check every callback type the
Registrations struct exposes so rollback_registrations truly removed all
registered callbacks.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 5bb6e79d-aeb2-43c2-8464-73eee330abe5

📥 Commits

Reviewing files that changed from the base of the PR and between 78e83c0 and cba26f6.

📒 Files selected for processing (29)
  • crates/adaptive/src/acg_component.rs
  • crates/adaptive/src/adaptive_hints_intercept.rs
  • crates/adaptive/tests/integration/runtime_integration_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/cli/tests/coverage/server_tests.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/registry.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/runtime/state.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/context/registries.rs
  • crates/core/src/lib.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/registry.rs
  • crates/core/tests/integration/api_surface_tests.rs
  • crates/core/tests/integration/context_isolation_tests.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/core/tests/integration/pipeline_tests.rs
  • crates/core/tests/integration/scope_local_tests.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/tests/unit/registry_tests.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/ffi/src/callable.rs
  • crates/node/src/callable.rs
  • crates/python/src/py_callable.rs
  • crates/wasm/src/callable.rs
💤 Files with no reviewable changes (1)
  • crates/core/tests/integration/context_isolation_tests.rs
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Check / Run
🧰 Additional context used
📓 Path-based instructions (29)
**/*.rs

📄 CodeRabbit inference engine (.agents/skills/test-ffi-surface/SKILL.md)

**/*.rs: Run cargo fmt --all for FFI work as it is Rust work
Run just test-rust for FFI validation
Run cargo clippy --workspace --all-targets -- -D warnings to enforce warnings-as-errors linting

**/*.rs: Run cargo fmt --all for Rust code formatting
Run cargo clippy --workspace --all-targets -- -D warnings to enforce Rust linting with no warnings
Run just test-rust as the shared-runtime build/test wrapper for Rust changes

Use Rust snake_case naming convention for Rust code

**/*.rs: Any Rust change must run just test-rust
Any Rust change must run cargo fmt --all
Any Rust change must run cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all for Rust code formatting when Node changes touch Rust files
Run cargo clippy --workspace --all-targets -- -D warnings to enforce strict linting when Rust files changed as part of Node work

**/*.rs: Always run just test-rust when any Rust code changes
Always run cargo fmt --all when any Rust code changes
Always run cargo clippy --workspace --all-targets -- -D warnings when any Rust code changes

If any Rust files changed as part of the Python work, also run cargo fmt --all, just test-rust, and cargo clippy --workspace --all-targets -- -D warnings

Files:

  • crates/adaptive/src/acg_component.rs
  • crates/adaptive/src/adaptive_hints_intercept.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/api/llm.rs
  • crates/adaptive/tests/integration/runtime_integration_tests.rs
  • crates/core/src/api/tool.rs
  • crates/cli/tests/coverage/server_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/core/tests/integration/scope_local_tests.rs
  • crates/core/tests/integration/pipeline_tests.rs
  • crates/core/src/lib.rs
  • crates/python/src/py_callable.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/tests/unit/registry_tests.rs
  • crates/core/src/api/registry.rs
  • crates/node/src/callable.rs
  • crates/core/tests/integration/api_surface_tests.rs
  • crates/core/src/context/registries.rs
  • crates/ffi/src/callable.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/wasm/src/callable.rs
  • crates/core/src/registry.rs
  • crates/core/src/api/runtime/state.rs
**/*.{rs,go,js,ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Include SPDX license headers in all Rust, Go, JavaScript, and TypeScript source files using C-style comment syntax

Files:

  • crates/adaptive/src/acg_component.rs
  • crates/adaptive/src/adaptive_hints_intercept.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/api/llm.rs
  • crates/adaptive/tests/integration/runtime_integration_tests.rs
  • crates/core/src/api/tool.rs
  • crates/cli/tests/coverage/server_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/core/tests/integration/scope_local_tests.rs
  • crates/core/tests/integration/pipeline_tests.rs
  • crates/core/src/lib.rs
  • crates/python/src/py_callable.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/tests/unit/registry_tests.rs
  • crates/core/src/api/registry.rs
  • crates/node/src/callable.rs
  • crates/core/tests/integration/api_surface_tests.rs
  • crates/core/src/context/registries.rs
  • crates/ffi/src/callable.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/wasm/src/callable.rs
  • crates/core/src/registry.rs
  • crates/core/src/api/runtime/state.rs
**/*.{rs,py,go,js,ts,tsx}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use SONAR_IGNORE_START / SONAR_IGNORE_END markers only for documented false positives that cannot be resolved in code; keep ignored blocks small, add explanatory comments, and require reviewer sign-off

Files:

  • crates/adaptive/src/acg_component.rs
  • crates/adaptive/src/adaptive_hints_intercept.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/api/llm.rs
  • crates/adaptive/tests/integration/runtime_integration_tests.rs
  • crates/core/src/api/tool.rs
  • crates/cli/tests/coverage/server_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/core/tests/integration/scope_local_tests.rs
  • crates/core/tests/integration/pipeline_tests.rs
  • crates/core/src/lib.rs
  • crates/python/src/py_callable.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/tests/unit/registry_tests.rs
  • crates/core/src/api/registry.rs
  • crates/node/src/callable.rs
  • crates/core/tests/integration/api_surface_tests.rs
  • crates/core/src/context/registries.rs
  • crates/ffi/src/callable.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/wasm/src/callable.rs
  • crates/core/src/registry.rs
  • crates/core/src/api/runtime/state.rs
{crates/adaptive/**,python/nemo_flow/{adaptive,plugin}.py,go/nemo_flow/{adaptive,**}/*.go,**/*.{ts,js,wasm}}

📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)

Keep adaptive config schema, plugin lifecycle, and bindings in sync across crates/adaptive, core, bindings, Python (python/nemo_flow/adaptive.py and python/nemo_flow/plugin.py), Go (go/nemo_flow/adaptive and go/nemo_flow), and Node/WebAssembly helpers

Files:

  • crates/adaptive/src/acg_component.rs
  • crates/adaptive/src/adaptive_hints_intercept.rs
  • crates/adaptive/tests/integration/runtime_integration_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
{crates/adaptive/**/*.rs,python/nemo_flow/adaptive.py,python/nemo_flow/plugin.py,go/nemo_flow/**/*.go,**/{helper,constructor,builder}.{ts,tsx,js}}

📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)

Ensure typed helper constructors map cleanly to the same config document without divergence

Files:

  • crates/adaptive/src/acg_component.rs
  • crates/adaptive/src/adaptive_hints_intercept.rs
  • crates/adaptive/tests/integration/runtime_integration_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
{crates/adaptive/**/*.rs,python/nemo_flow/plugin.py,go/nemo_flow/**/*.go,**/{plugin,lifecycle}.{ts,tsx,js}}

📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)

Maintain consistent plugin lifecycle across all language bindings (Rust, Python, Go, Node/WebAssembly)

Files:

  • crates/adaptive/src/acg_component.rs
  • crates/adaptive/src/adaptive_hints_intercept.rs
  • crates/adaptive/tests/integration/runtime_integration_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
{crates/adaptive/**/*.rs,python/nemo_flow/plugin.py,go/nemo_flow/**/*.go,**/{context,plugin}.{ts,tsx,js,rs}}

📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)

Keep plugin context surfaces aligned across all language implementations

Files:

  • crates/adaptive/src/acg_component.rs
  • crates/adaptive/src/adaptive_hints_intercept.rs
  • crates/adaptive/tests/integration/runtime_integration_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
{docs/**,examples/**,crates/adaptive/**,python/nemo_flow/**,go/nemo_flow/**,**/{example,component}.{ts,tsx,js,rs,py,go}}

📄 CodeRabbit inference engine (.agents/skills/maintain-optimizer/SKILL.md)

Any new adaptive component kind must have documentation, examples, and binding coverage across all supported languages

Files:

  • crates/adaptive/src/acg_component.rs
  • crates/adaptive/src/adaptive_hints_intercept.rs
  • crates/adaptive/tests/integration/runtime_integration_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
**/*.{js,ts,tsx,jsx,py,rs,go,java,c,cpp,h,cc,cxx,cs,rb,php,swift,kt}

📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)

Changed files must be formatted with the language-native formatter

Files:

  • crates/adaptive/src/acg_component.rs
  • crates/adaptive/src/adaptive_hints_intercept.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/api/llm.rs
  • crates/adaptive/tests/integration/runtime_integration_tests.rs
  • crates/core/src/api/tool.rs
  • crates/cli/tests/coverage/server_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/core/tests/integration/scope_local_tests.rs
  • crates/core/tests/integration/pipeline_tests.rs
  • crates/core/src/lib.rs
  • crates/python/src/py_callable.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/tests/unit/registry_tests.rs
  • crates/core/src/api/registry.rs
  • crates/node/src/callable.rs
  • crates/core/tests/integration/api_surface_tests.rs
  • crates/core/src/context/registries.rs
  • crates/ffi/src/callable.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/wasm/src/callable.rs
  • crates/core/src/registry.rs
  • crates/core/src/api/runtime/state.rs
crates/{core,adaptive}/**

📄 CodeRabbit inference engine (.agents/skills/prepare-pr/SKILL.md)

Changes to crates/core or crates/adaptive must run the full language matrix

Files:

  • crates/adaptive/src/acg_component.rs
  • crates/adaptive/src/adaptive_hints_intercept.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/api/llm.rs
  • crates/adaptive/tests/integration/runtime_integration_tests.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/core/tests/integration/scope_local_tests.rs
  • crates/core/tests/integration/pipeline_tests.rs
  • crates/core/src/lib.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/tests/unit/registry_tests.rs
  • crates/core/src/api/registry.rs
  • crates/core/tests/integration/api_surface_tests.rs
  • crates/core/src/context/registries.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/core/src/registry.rs
  • crates/core/src/api/runtime/state.rs
{crates/core,crates/adaptive}/**/*.rs

📄 CodeRabbit inference engine (.agents/skills/test-wasm-binding/SKILL.md)

If the change touched shared runtime semantics in crates/core or crates/adaptive, also use validate-change

Files:

  • crates/adaptive/src/acg_component.rs
  • crates/adaptive/src/adaptive_hints_intercept.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/api/llm.rs
  • crates/adaptive/tests/integration/runtime_integration_tests.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/core/tests/integration/scope_local_tests.rs
  • crates/core/tests/integration/pipeline_tests.rs
  • crates/core/src/lib.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/tests/unit/registry_tests.rs
  • crates/core/src/api/registry.rs
  • crates/core/tests/integration/api_surface_tests.rs
  • crates/core/src/context/registries.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/core/src/registry.rs
  • crates/core/src/api/runtime/state.rs
crates/adaptive/**/*.rs

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

When crates/adaptive changes, run the full validation matrix across Rust, Python, Go, Node.js, and WebAssembly

Files:

  • crates/adaptive/src/acg_component.rs
  • crates/adaptive/src/adaptive_hints_intercept.rs
  • crates/adaptive/tests/integration/runtime_integration_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
**/*.{py,js,ts,tsx,go,rs,md}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

Format changed files with the language-native formatter before the final lint/test pass

Files:

  • crates/adaptive/src/acg_component.rs
  • crates/adaptive/src/adaptive_hints_intercept.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/api/llm.rs
  • crates/adaptive/tests/integration/runtime_integration_tests.rs
  • crates/core/src/api/tool.rs
  • crates/cli/tests/coverage/server_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/core/tests/integration/scope_local_tests.rs
  • crates/core/tests/integration/pipeline_tests.rs
  • crates/core/src/lib.rs
  • crates/python/src/py_callable.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/tests/unit/registry_tests.rs
  • crates/core/src/api/registry.rs
  • crates/node/src/callable.rs
  • crates/core/tests/integration/api_surface_tests.rs
  • crates/core/src/context/registries.rs
  • crates/ffi/src/callable.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/wasm/src/callable.rs
  • crates/core/src/registry.rs
  • crates/core/src/api/runtime/state.rs
**/*.{rs,py,js,ts,tsx,go}

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

During iteration, prefer uv run pre-commit run --files <changed files...> for targeted validation

Files:

  • crates/adaptive/src/acg_component.rs
  • crates/adaptive/src/adaptive_hints_intercept.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/api/llm.rs
  • crates/adaptive/tests/integration/runtime_integration_tests.rs
  • crates/core/src/api/tool.rs
  • crates/cli/tests/coverage/server_tests.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/core/tests/integration/scope_local_tests.rs
  • crates/core/tests/integration/pipeline_tests.rs
  • crates/core/src/lib.rs
  • crates/python/src/py_callable.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/tests/unit/registry_tests.rs
  • crates/core/src/api/registry.rs
  • crates/node/src/callable.rs
  • crates/core/tests/integration/api_surface_tests.rs
  • crates/core/src/context/registries.rs
  • crates/ffi/src/callable.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/wasm/src/callable.rs
  • crates/core/src/registry.rs
  • crates/core/src/api/runtime/state.rs
crates/{core,adaptive}/**/*.rs

⚙️ CodeRabbit configuration file

crates/{core,adaptive}/**/*.rs: Review the Rust runtime for async correctness, scope isolation, middleware ordering, and event lifecycle regressions.
Pay close attention to task-local/thread-local scope propagation, callback lifetimes, stream finalization, and root_uuid isolation.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.

Files:

  • crates/adaptive/src/acg_component.rs
  • crates/adaptive/src/adaptive_hints_intercept.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/api/llm.rs
  • crates/adaptive/tests/integration/runtime_integration_tests.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/core/tests/integration/scope_local_tests.rs
  • crates/core/tests/integration/pipeline_tests.rs
  • crates/core/src/lib.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/tests/unit/registry_tests.rs
  • crates/core/src/api/registry.rs
  • crates/core/tests/integration/api_surface_tests.rs
  • crates/core/src/context/registries.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/core/src/registry.rs
  • crates/core/src/api/runtime/state.rs
crates/core/**/*.rs

📄 CodeRabbit inference engine (.agents/skills/validate-change/SKILL.md)

When crates/core changes, run the full validation matrix across Rust, Python, Go, Node.js, and WebAssembly

crates/core/**/*.rs: Use Json = serde_json::Value in Rust-facing runtime APIs where the existing code expects JSON payloads.
Use Result<T> with FlowError in core runtime paths. Keep errors explicit and binding-appropriate at the wrapper layer.

Files:

  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/api/runtime.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/core/tests/integration/scope_local_tests.rs
  • crates/core/tests/integration/pipeline_tests.rs
  • crates/core/src/lib.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/tests/unit/registry_tests.rs
  • crates/core/src/api/registry.rs
  • crates/core/tests/integration/api_surface_tests.rs
  • crates/core/src/context/registries.rs
  • crates/core/tests/integration/middleware_tests.rs
  • crates/core/src/registry.rs
  • crates/core/src/api/runtime/state.rs
crates/core/src/api/**/*.rs

📄 CodeRabbit inference engine (.agents/skills/add-binding-feature/SKILL.md)

crates/core/src/api/**/*.rs: Implement public API changes first in crates/core/src/api/ and related core modules such as crates/core/src/api/runtime/, crates/core/src/codec/, or crates/core/src/json.rs
Use snake_case naming convention for Rust core API implementations

Files:

  • crates/core/src/api/runtime.rs
  • crates/core/src/api/llm.rs
  • crates/core/src/api/tool.rs
  • crates/core/src/api/runtime/scope_stack.rs
  • crates/core/src/api/runtime/callbacks.rs
  • crates/core/src/api/registry.rs
  • crates/core/src/api/runtime/state.rs
{crates/core/src/api/tool.rs,crates/core/src/api/llm.rs}

📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)

Wire middleware chain execution into the appropriate pipeline stage in crates/core/src/api/tool.rs or crates/core/src/api/llm.rs by calling the chain method at the correct execution point

Files:

  • crates/core/src/api/llm.rs
  • crates/core/src/api/tool.rs
**/{integrations,integration,*-integration}/**

📄 CodeRabbit inference engine (.agents/skills/contribute-integration/SKILL.md)

**/{integrations,integration,*-integration}/**: Keep NeMo Flow optional in framework integrations
Preserve the framework's original behavior when NeMo Flow is absent
Wrap tool and LLM paths at the correct framework boundary
Integration pattern must follow docs/integrate-frameworks/adding-scopes.md

Files:

  • crates/adaptive/tests/integration/runtime_integration_tests.rs
  • crates/core/tests/integration/scope_local_tests.rs
  • crates/core/tests/integration/pipeline_tests.rs
  • crates/core/tests/integration/api_surface_tests.rs
  • crates/core/tests/integration/middleware_tests.rs
{crates/**/tests/**,python/tests/**,go/nemo_flow/**/*_test.go}

⚙️ CodeRabbit configuration file

{crates/**/tests/**,python/tests/**,go/nemo_flow/**/*_test.go}: Tests should cover the behavior promised by the changed API surface, including error paths and cross-request isolation where relevant.
Prefer assertions on lifecycle events, scope stacks, middleware ordering, and binding parity over shallow smoke tests.

Files:

  • crates/adaptive/tests/integration/runtime_integration_tests.rs
  • crates/cli/tests/coverage/server_tests.rs
  • crates/core/tests/unit/shared_tests.rs
  • crates/adaptive/tests/unit/runtime_features_tests.rs
  • crates/core/tests/unit/plugin_tests.rs
  • crates/core/tests/integration/scope_local_tests.rs
  • crates/core/tests/integration/pipeline_tests.rs
  • crates/core/tests/unit/context_tests.rs
  • crates/core/tests/unit/registry_tests.rs
  • crates/core/tests/integration/api_surface_tests.rs
  • crates/core/tests/integration/middleware_tests.rs
crates/core/src/api/runtime/callbacks.rs

📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)

Define or reuse callback type aliases in crates/core/src/api/runtime/callbacks.rs when adding a new middleware type

Files:

  • crates/core/src/api/runtime/callbacks.rs
crates/python/**/*.rs

📄 CodeRabbit inference engine (.agents/skills/test-python-binding/SKILL.md)

If the native Rust bridge changed, add the Rust crate tests for nemo-flow-python

Files:

  • crates/python/src/py_callable.rs
crates/{python,ffi,node,wasm}/**/*

⚙️ CodeRabbit configuration file

crates/{python,ffi,node,wasm}/**/*: Treat binding changes as public API changes. Check for parity with the other language bindings, FFI ownership/lifetime safety,
callback error propagation, stable type conversion, and consistent async/stream semantics.
Flag changes that update one binding without corresponding tests or documentation for the same surface elsewhere.

Files:

  • crates/python/src/py_callable.rs
  • crates/node/src/callable.rs
  • crates/ffi/src/callable.rs
  • crates/wasm/src/callable.rs
crates/core/src/api/registry.rs

📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)

Use existing global_*_registry_api! and scope_*_registry_api! macro patterns in crates/core/src/api/registry.rs for both global and scope-local registration variants

Files:

  • crates/core/src/api/registry.rs
crates/node/**

📄 CodeRabbit inference engine (.agents/skills/test-node-binding/SKILL.md)

Run just test-node for the normal dev/test loop when working on Node binding changes

Files:

  • crates/node/src/callable.rs
crates/ffi/**

📄 CodeRabbit inference engine (.agents/skills/test-ffi-surface/SKILL.md)

Rebuild the FFI crate in release mode so the shared library and header stay in sync

Files:

  • crates/ffi/src/callable.rs
{crates/ffi/nemo_flow.h,crates/ffi/src/**/*.rs}

📄 CodeRabbit inference engine (.agents/skills/test-ffi-surface/SKILL.md)

Check the generated header diff when any exported symbol or type changed in the FFI surface

Files:

  • crates/ffi/src/callable.rs
crates/wasm/**/*.rs

📄 CodeRabbit inference engine (.agents/skills/test-wasm-binding/SKILL.md)

crates/wasm/**/*.rs: Run cargo fmt --all, just test-rust, and cargo clippy --workspace --all-targets -- -D warnings when Rust files changed as part of WebAssembly work
Add cargo test -p nemo-flow-wasm when Rust-only WebAssembly helpers changed

Files:

  • crates/wasm/src/callable.rs
crates/core/src/api/runtime/state.rs

📄 CodeRabbit inference engine (.agents/skills/add-middleware/SKILL.md)

crates/core/src/api/runtime/state.rs: Add registry fields to NemoFlowContextState in crates/core/src/api/runtime/state.rs using SortedRegistry<GuardrailEntry<T>> or SortedRegistry<Intercept<T>> patterns when implementing middleware
Add chain execution helper methods to NemoFlowContextState in crates/core/src/api/runtime/state.rs following the pattern of tool_sanitize_request_chain or tool_request_intercepts_chain

Files:

  • crates/core/src/api/runtime/state.rs
🔇 Additional comments (28)
crates/core/src/observability/plugin_component.rs (1)

24-25: LGTM!

crates/core/src/registry.rs (1)

1-143: LGTM!

crates/core/src/api/registry.rs (1)

1-685: LGTM!

crates/core/src/api/runtime/callbacks.rs (1)

1-310: LGTM!

crates/core/src/api/runtime.rs (1)

1-25: LGTM!

crates/core/tests/unit/context_tests.rs (1)

13-13: LGTM!

Also applies to: 44-52, 100-116, 123-123, 128-150, 157-157, 162-182, 184-229

crates/core/tests/unit/plugin_tests.rs (1)

98-98: LGTM!

Also applies to: 650-650, 662-662, 887-887, 893-893, 905-905, 911-911, 962-962, 970-970, 978-978, 985-985, 993-993, 1000-1000, 1023-1023, 1030-1030, 1038-1038, 1045-1045, 1105-1105, 1112-1112, 1149-1149, 1155-1155, 1161-1161, 1173-1173, 1179-1179, 1203-1203

crates/core/tests/unit/registry_tests.rs (1)

9-12: LGTM!

Also applies to: 14-30, 34-40, 50-50, 66-66, 73-76, 88-92, 102-102, 108-110, 117-118, 137-143, 153-155, 161-161

crates/core/tests/unit/shared_tests.rs (1)

125-125: LGTM!

Also applies to: 153-153

crates/ffi/src/callable.rs (1)

13-17: LGTM!

Also applies to: 27-28, 253-255, 299-300, 570-571, 646-649, 663-666

crates/node/src/callable.rs (1)

19-20: LGTM!

Also applies to: 101-104, 159-160, 216-217, 282-285, 315-318

crates/python/src/py_callable.rs (1)

29-30: LGTM!

Also applies to: 186-187, 241-242, 591-592, 648-649, 821-823

crates/wasm/src/callable.rs (1)

8-10: LGTM!

Also applies to: 35-37, 157-159, 162-165, 210-211, 216-217, 267-278, 350-352, 355-358, 894-897, 900-903

crates/adaptive/src/acg_component.rs (1)

597-603: Please confirm full cross-language validation for crates/adaptive changes.

The listed validation is Rust-focused; this change set also touches crates/adaptive, which requires the full language matrix before merge.

As per coding guidelines, crates/adaptive/**/*.rs: “When crates/adaptive changes, run the full validation matrix across Rust, Python, Go, Node.js, and WebAssembly.”

crates/adaptive/src/adaptive_hints_intercept.rs (1)

174-175: LGTM!

crates/adaptive/tests/integration/runtime_integration_tests.rs (1)

721-724: LGTM!

Also applies to: 730-735

crates/core/tests/integration/api_surface_tests.rs (1)

345-898: LGTM!

crates/core/tests/integration/middleware_tests.rs (1)

99-2193: LGTM!

crates/core/tests/integration/pipeline_tests.rs (1)

224-819: LGTM!

crates/core/tests/integration/scope_local_tests.rs (1)

74-550: LGTM!

crates/adaptive/tests/unit/runtime_features_tests.rs (1)

12-158: LGTM!

Also applies to: 306-440, 550-589, 668-705

crates/cli/tests/coverage/server_tests.rs (1)

534-536: LGTM!

crates/core/src/api/runtime/state.rs (1)

49-75: LGTM!

Also applies to: 85-95, 596-608, 620-633, 644-651, 680-721, 740-755, 768-784, 795-828, 839-847, 874-913, 934-954, 969-1018

crates/core/src/api/runtime/scope_stack.rs (1)

8-9: LGTM!

Also applies to: 20-20, 164-172, 183-192, 199-205

crates/core/src/context/registries.rs (1)

12-12: LGTM!

Also applies to: 26-52, 60-75, 96-107, 117-128, 141-156

crates/core/src/api/tool.rs (1)

389-389: LGTM!

Also applies to: 536-536

crates/core/src/api/llm.rs (1)

535-535: LGTM!

Also applies to: 683-683, 825-825

crates/core/src/lib.rs (1)

65-65: Make crates/core/src/lib.rs crate-root registry private safely

  • No external Rust code outside crates/core references the crate-root module (nemo_flow::registry / crate::registry); downstreams use nemo_flow::api::registry, which remains public (crates/core/src/api/mod.rs has pub mod registry;).
  • SortedRegistry is used within crates/core (including its tests) as an internal implementation detail, consistent with the visibility change.

Comment thread crates/adaptive/tests/unit/runtime_features_tests.rs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking PR introduces a breaking change Improvement improvement to existing functionality lang:rust PR changes/introduces Rust code size:XL PR is extra large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant