Skip to content

refactor: enforce cognitive complexity threshold - #636

Open
willkill07 wants to merge 1 commit into
NVIDIA:release/0.7from
willkill07:refactor/cognitive-complexity-release-0.7
Open

refactor: enforce cognitive complexity threshold#636
willkill07 wants to merge 1 commit into
NVIDIA:release/0.7from
willkill07:refactor/cognitive-complexity-release-0.7

Conversation

@willkill07

@willkill07 willkill07 commented Aug 2, 2026

Copy link
Copy Markdown
Member

Overview

Enables Clippy cognitive-complexity enforcement at a threshold of 18 and refactors flagged production functions without suppressing the lint.

  • 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

  • Configure cognitive_complexity as deny in the root Cargo.toml and set the threshold to 18 in clippy.toml.
  • Split complex adaptive, observability, plugin, stream, Python binding, Go binding, and packaging functions into focused helpers.
  • Preserve behavior and avoid per-function allow attributes.
  • This PR is intended to merge last, after the Rust coverage and CLI coverage PRs, because those PRs contain the corresponding test-function refactors required by the newly enforced threshold.
  • No breaking API changes.

Validation performed on the intended combined result:

  • uv run pre-commit run --all-files, including cargo clippy --workspace --all-targets -- -D warnings
  • Rust workspace tests; the CLI global-state-sensitive suite passed with one test thread
  • Exact four-branch merge tree comparison against the original combined branch

Where should the reviewer start?

Start with Cargo.toml and clippy.toml, then review crates/core/src/plugin.rs and crates/python/src/py_callable.rs as representative refactors.

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

Summary by CodeRabbit

  • Refactor

    • Improved validation, response caching, streaming, sanitization, plugin configuration, and OpenTelemetry configuration internals without changing expected behavior.
    • Preserved existing error handling, cache bypass rules, guarded-stream behavior, and telemetry attribute processing.
    • Improved command-line option parsing for Linux package tooling.
  • Chores

    • Added workspace linting to flag functions with excessive cognitive complexity.
    • Clarified licensing headers and lint-suppression reasons.

Signed-off-by: Will Killian <wkillian@nvidia.com>
@willkill07
willkill07 requested a review from a team as a code owner August 2, 2026 00:53
@github-actions github-actions Bot added size:L PR is large Improvement improvement to existing functionality lang:go PR changes/introduces Go code lang:js PR changes/introduces Javascript/Typescript code lang:rust PR changes/introduces Rust code labels Aug 2, 2026
@coderabbitai

coderabbitai Bot commented Aug 2, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The PR enables workspace Clippy cognitive-complexity enforcement and refactors adaptive, core, Python, Go, and packaging code into focused helper functions. Existing validation, caching, streaming, observability, configuration, and argument-handling behavior remains represented in the extracted paths.

Changes

Complexity refactor

Layer / File(s) Summary
Cognitive complexity lint configuration
Cargo.toml, clippy.toml
Adds workspace enforcement and sets the cognitive-complexity threshold to 18.
Adaptive validation and response-cache helpers
crates/adaptive/src/plugin_component.rs, crates/adaptive/src/response_cache/*
Extracts adaptive state, response-cache, cache-bypass, and replay chunk synthesis logic into helpers.
Core configuration and observability helpers
crates/core/src/observability/*, crates/core/src/plugin.rs
Extracts scalar lookup, OpenTelemetry header handling, and plugin overlay cleanup logic.
Stream and Python sanitizer orchestration
crates/core/src/stream.rs, crates/python/src/py_callable.rs
Extracts sanitizer snapshotting, event preparation, callback dispatch, and awaitable handling.
Guardrails provider stream helpers
crates/core/src/plugins/nemo_guardrails/python.rs
Separates stream error handling, blocked output, chunk delivery, cancellation, and cleanup.
Relay configuration and packaging argument handling
go/nemo_relay/nemo_relay.go, scripts/package_node_musllinux.mjs
Extracts OpenTelemetry configuration normalization and changes packaging option parsing to process name/value pairs.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 30.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title uses valid Conventional Commits format, accurately describes the refactoring, and meets the length and punctuation requirements.
Description check ✅ Passed The description includes all required sections, checkboxes, implementation details, reviewer guidance, related issue information, and validation results.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.12.2)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


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

@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 `@scripts/package_node_musllinux.mjs`:
- Around line 23-24: Update the argument parsing loop around argumentsFrom so it
validates args[index + 1] before assigning it to version, output, or platform:
reject undefined values and tokens beginning with the option prefix, and handle
the malformed invocation consistently with existing argument errors. Add
regression coverage confirming option tokens cannot be accepted as values.
🪄 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: bb2afe70-9766-41ac-bd70-3eee10309294

📥 Commits

Reviewing files that changed from the base of the PR and between 31c4a5c and 7dc32b5.

📒 Files selected for processing (13)
  • Cargo.toml
  • clippy.toml
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/core/src/observability/otel_genai.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugin.rs
  • crates/core/src/plugins/nemo_guardrails/python.rs
  • crates/core/src/stream.rs
  • crates/python/src/py_callable.rs
  • go/nemo_relay/nemo_relay.go
  • scripts/package_node_musllinux.mjs
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: Check / Run
  • GitHub Check: Preview docs
🧰 Additional context used
📓 Path-based instructions (26)
**/*.toml

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all TOML files using the # comment form.

Files:

  • clippy.toml
  • Cargo.toml
**/*

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

**/*: Format changed files with the language-native formatter before the final lint/test pass.
If dynamic plugin behavior changed, use maintain-dynamic-plugins and include the native SDK, worker protocol, Python SDK, docs, packaging, and Codecov surfaces in the validation plan.
If code changes alter APIs, bindings, commands, paths, packaging behavior, observability/adaptive semantics, or documented best practices, update any dependent maintainer or consumer skills in the same branch.
During iteration, prefer uv run pre-commit run --files <changed files...>.
Before review or handoff, run uv run pre-commit run --all-files.

Files:

  • clippy.toml
  • Cargo.toml
  • crates/core/src/observability/otel_genai.rs
  • crates/core/src/plugin.rs
  • crates/adaptive/src/plugin_component.rs
  • scripts/package_node_musllinux.mjs
  • crates/adaptive/src/response_cache/key.rs
  • crates/python/src/py_callable.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/core/src/stream.rs
  • go/nemo_relay/nemo_relay.go
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugins/nemo_guardrails/python.rs
**/Cargo.toml

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

Confirm or infer the target release version from upstream/main:Cargo.toml. Derive the release branch as release/<major>.<minor>.

Keep Rust package names and workspace metadata in Cargo.toml internally consistent across the project.

OpenTelemetry and OpenInference dependencies must be unconditional rather than Cargo feature-gated.

Files:

  • Cargo.toml
Cargo.toml

📄 CodeRabbit inference engine (.agents/skills/update-project-version/SKILL.md)

In Cargo.toml, treat [workspace.package].version as the source of truth for the Rust workspace and Python build versioning, and keep workspace.dependencies.nemo-relay.version, workspace.dependencies.nemo-relay-adaptive.version, workspace.dependencies.nemo-relay-pii-redaction.version, workspace.dependencies.nemo-relay-ffi.version, and workspace.dependencies.nemo-relay-cli.version aligned when the workspace version changes.

Files:

  • Cargo.toml
**/*.rs

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

**/*.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 all FFI work since it is Rust work
Run just test-rust to validate FFI changes
Run cargo clippy --workspace --all-targets -- -D warnings to enforce strict linting on FFI work

When Rust files changed as part of Go work, also run cargo fmt --all, just test-rust, and cargo clippy --workspace --all-targets -- -D warnings

**/*.rs: Run cargo fmt --all when Rust files are changed as part of Node work
Run cargo clippy --workspace --all-targets -- -D warnings when Rust files are changed as part of Node work
Run just test-rust when Rust files are changed as part of Node work

When changing the core Rust runtime or Rust-facing API surface, format Rust code with cargo fmt (rustfmt defaults), keep cargo clippy -- -D warnings clean, and satisfy cargo deny check per deny.toml.

**/*.rs: If any Rust code changed, always run just test-rust.
If any Rust code changed, also run cargo fmt --all.
If any Rust code changed, also run cargo clippy --workspace --all-targets -- -D warnings.
For Rust changes headed for review, run cargo fmt --all and cargo clippy --workspace --all-targets -- -D warnings even if relying on pre-commit.

Files:

  • crates/core/src/observability/otel_genai.rs
  • crates/core/src/plugin.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/python/src/py_callable.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/core/src/stream.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugins/nemo_guardrails/python.rs
{crates/core,crates/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/core/src/observability/otel_genai.rs
  • crates/core/src/plugin.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/core/src/stream.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugins/nemo_guardrails/python.rs
crates/core/**/*.rs

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

If the change touched crates/core or shared runtime semantics, also use validate-change for broader validation

Files:

  • crates/core/src/observability/otel_genai.rs
  • crates/core/src/plugin.rs
  • crates/core/src/stream.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugins/nemo_guardrails/python.rs
**/*.{rs,py}

📄 CodeRabbit inference engine (AGENTS.md)

Follow binding naming conventions in Rust and Python: use snake_case.

Files:

  • crates/core/src/observability/otel_genai.rs
  • crates/core/src/plugin.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/python/src/py_callable.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/core/src/stream.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugins/nemo_guardrails/python.rs
**/*.{rs,py,js,mjs,cjs,ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{rs,py,js,mjs,cjs,ts,tsx}: 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, and keep errors explicit and binding-appropriate at the wrapper layer.
Keep async behavior on the existing tokio-based model; bindings should preserve callback and future lifetimes rather than blocking or hiding async work unexpectedly.

Files:

  • crates/core/src/observability/otel_genai.rs
  • crates/core/src/plugin.rs
  • crates/adaptive/src/plugin_component.rs
  • scripts/package_node_musllinux.mjs
  • crates/adaptive/src/response_cache/key.rs
  • crates/python/src/py_callable.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/core/src/stream.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugins/nemo_guardrails/python.rs
**/*.{rs,py,go,js,ts,c,h}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Use language-appropriate naming conventions: Rust snake_case, C FFI exports prefixed nemo_relay_, Go PascalCase, Node.js camelCase, and Python snake_case.

Files:

  • crates/core/src/observability/otel_genai.rs
  • crates/core/src/plugin.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/python/src/py_callable.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/core/src/stream.rs
  • go/nemo_relay/nemo_relay.go
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugins/nemo_guardrails/python.rs
**/*.{rs,go,js,ts}

📄 CodeRabbit inference engine (CONTRIBUTING.md)

Add the SPDX license header to all Rust, Go, JavaScript, and TypeScript source files using the corresponding // comment form.

Files:

  • crates/core/src/observability/otel_genai.rs
  • crates/core/src/plugin.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/python/src/py_callable.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/core/src/stream.rs
  • go/nemo_relay/nemo_relay.go
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugins/nemo_guardrails/python.rs
{crates/**/src/**/*.rs,python/**/*.py}

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

Do not add tests under src; Rust tests belong in crate tests/ trees, and Python SDK tests belong under python/tests.

Files:

  • crates/core/src/observability/otel_genai.rs
  • crates/core/src/plugin.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/python/src/py_callable.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/core/src/stream.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugins/nemo_guardrails/python.rs
crates/{core,adaptive}/**/*

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

If crates/core or crates/adaptive changed, run the full validation matrix across Rust, Python, Go, and Node.js.

Files:

  • crates/core/src/observability/otel_genai.rs
  • crates/core/src/plugin.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/core/src/stream.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugins/nemo_guardrails/python.rs
**/*.{rs,py,go,js,ts}

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

If a language surface changed, always run that language's test target even when Rust core did not change.

**/*.{rs,py,go,js,ts}: When observability configuration or lifecycle is exposed, keep FFI and Python, Go, and Node.js binding-native config objects and subscriber/exporter methods aligned in logical knobs and semantics.
Require every OpenTelemetry endpoint to have a type and nonblank destination; resolve header_env values at activation and reject missing, blank, or duplicate headers.
Concatenate layered ATOF sink, ATIF storage, and OpenTelemetry endpoint lists with higher-precedence entries first.
Preserve correct handling of mark events, start/end events, orphan cases, and span or trajectory fields derived from intended event data.
Run affected Rust tests and just test-rust when event fields change; run just test-python, just test-go, and just test-node when binding-native configuration or lifecycle changes.

Files:

  • crates/core/src/observability/otel_genai.rs
  • crates/core/src/plugin.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/python/src/py_callable.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/core/src/stream.rs
  • go/nemo_relay/nemo_relay.go
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugins/nemo_guardrails/python.rs
**/*.{rs,py,js,ts,tsx,go,java,kt,swift}

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

Add tests covering registration and duplicate names, deregistration and missing names, priority ordering, callback failure policy, scope-local inheritance and cleanup, event payload semantics, immutable mark and scope fields, and parity across affected bindings.

Files:

  • crates/core/src/observability/otel_genai.rs
  • crates/core/src/plugin.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/python/src/py_callable.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/core/src/stream.rs
  • go/nemo_relay/nemo_relay.go
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugins/nemo_guardrails/python.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/core/src/observability/otel_genai.rs
  • crates/core/src/plugin.rs
  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/replay.rs
  • crates/core/src/stream.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugins/nemo_guardrails/python.rs
crates/adaptive/**

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

Keep crates/adaptive aligned with the canonical adaptive config schema, built-in section helpers, plugin lifecycle, and validation/report behavior.

Files:

  • crates/adaptive/src/plugin_component.rs
  • crates/adaptive/src/response_cache/key.rs
  • crates/adaptive/src/response_cache/replay.rs
{.github/**,.gitlab-ci.yml,.pre-commit-config.yaml,justfile,scripts/**}

⚙️ CodeRabbit configuration file

{.github/**,.gitlab-ci.yml,.pre-commit-config.yaml,justfile,scripts/**}: Review automation changes for reproducibility, pinned versions where appropriate, secret handling, and consistency with the documented validation matrix.
Pay attention to commands that need generated native artifacts, FFI libraries, or platform-specific environment variables.

Files:

  • scripts/package_node_musllinux.mjs
crates/{python,ffi,node}/**/*

⚙️ CodeRabbit configuration file

crates/{python,ffi,node}/**/*: 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
go/nemo_relay/**/*.go

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

go/nemo_relay/**/*.go: Format changed Go packages with cd go/nemo_relay && go fmt ./...
Run Go tests with just test-go to build and test the NeMo Relay Go binding
Use just build-go when you want an explicit build-only pass or need the artifact for other work
Use just ci=true test-go when you need the CI-style coverage and JUnit path
On macOS, set DYLD_LIBRARY_PATH to the ../../target/release directory before running the raw go test command directly

Use PascalCase for public Go APIs.

Files:

  • go/nemo_relay/nemo_relay.go
**/*.go

📄 CodeRabbit inference engine (CONTRIBUTING.md)

When changing the experimental Go binding, format Go code with gofmt and keep go vet ./... passing.

Files:

  • go/nemo_relay/nemo_relay.go
{crates/python/src/py_api/mod.rs,python/nemo_relay/**/*.py,python/nemo_relay/**/*.pyi,go/nemo_relay/**/*.go,crates/node/src/api/**/*.rs}

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

Update the language-native bindings for every exposed surface in Python, Go, and Node.js.

Files:

  • go/nemo_relay/nemo_relay.go
{python/nemo_relay/**/*.py,python/nemo_relay/**/*.pyi,go/nemo_relay/**/*.go}

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

Update language wrapper helpers such as Python wrapper modules, Python type stubs, and Go shorthand packages when the new behavior belongs in those helper layers.

Files:

  • go/nemo_relay/nemo_relay.go
go/nemo_relay/**

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

Keep shared plugin helpers in go/nemo_relay aligned with plugin registration, composition, and lifecycle behavior.

Files:

  • go/nemo_relay/nemo_relay.go
**/*.{md,mdx,py,go,js,ts}

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

Examples and documentation must use each exporter's documented flush/deregister order before shutdown.

Files:

  • go/nemo_relay/nemo_relay.go
go/nemo_relay/**/*

⚙️ CodeRabbit configuration file

go/nemo_relay/**/*: Review Go binding changes for cgo memory ownership, race safety, callback cleanup, idiomatic exported APIs, and parity with Rust/FFI behavior.
Any API change should include focused Go tests and consider race-test behavior.

Files:

  • go/nemo_relay/nemo_relay.go
🧠 Learnings (1)
📚 Learning: 2026-07-28T20:07:29.880Z
Learnt from: willkill07
Repo: NVIDIA/NeMo-Relay PR: 571
File: crates/core/src/api/runtime/state.rs:996-1020
Timestamp: 2026-07-28T20:07:29.880Z
Learning: In NeMo Relay (RELAY-509), sanitizer callback failures must be treated as intentional fail-open behavior. When an event/tool (request/response) or LLM (request/response) sanitizer callback fails, the sanitizer chain should retain and publish the last valid event/payload snapshot (rather than dropping/invalidating the data) and log the failure including callback context (e.g., which sanitizer/callback failed and relevant identifiers). Apply this consistently across all sanitizer chains mentioned in the RELAY-509 documentation/migration guide.

Applied to files:

  • crates/core/src/observability/otel_genai.rs
  • crates/core/src/plugin.rs
  • crates/core/src/stream.rs
  • crates/core/src/observability/plugin_component.rs
  • crates/core/src/plugins/nemo_guardrails/python.rs
🔇 Additional comments (14)
crates/adaptive/src/plugin_component.rs (2)

218-280: LGTM!


282-363: 📐 Maintainability & Code Quality

Provide the required adaptive validation evidence.

Run cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, and just test-rust. Also run the required Python, Go, and Node.js test targets for this crates/adaptive change. Attach the command output or CI results before merge.

As per coding guidelines, “Any Rust change must run just test-rust,” cargo fmt --all, and strict Clippy. As per path instructions, crates/adaptive changes require the full Rust, Python, Go, and Node.js validation matrix.

Sources: Coding guidelines, Path instructions

crates/adaptive/src/response_cache/key.rs (1)

59-135: LGTM!

crates/adaptive/src/response_cache/replay.rs (1)

195-252: LGTM!

go/nemo_relay/nemo_relay.go (2)

2050-2070: LGTM!

Also applies to: 2089-2093


2017-2021: 🎯 Functional Correctness

Keep the current validation.

The FFI parser rejects whitespace-only endpoints before subscriber construction, and the Go tests already cover " \t".

			> Likely an incorrect or invalid review comment.
crates/core/src/observability/otel_genai.rs (1)

436-462: LGTM!

crates/core/src/observability/plugin_component.rs (1)

1792-1877: LGTM!

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

1627-1685: LGTM!

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

1730-1859: LGTM!

crates/core/src/plugins/nemo_guardrails/python.rs (1)

1110-1263: LGTM!

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

39-47: 🩺 Stability & Availability

Keep the structured log call. The workspace enables log with the kv feature and resolves version 0.4.29; this syntax is already used throughout the workspace.

			> Likely an incorrect or invalid review comment.
clippy.toml (1)

1-4: LGTM!

Cargo.toml (1)

48-50: 📐 Maintainability & Code Quality


			> Likely an incorrect or invalid review comment.

Comment on lines +23 to +24
for (let index = 0; index < args.length; index += 2) {
const value = args[index + 1];

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- file outline ---'
ast-grep outline scripts/package_node_musllinux.mjs --view expanded || true
printf '%s\n' '--- target file ---'
cat -n scripts/package_node_musllinux.mjs
printf '%s\n' '--- related tests and call sites ---'
rg -n --glob '!node_modules' 'package_node_musllinux|argumentsFrom|--version|--out|--platform' . | head -200
printf '%s\n' '--- package and formatter configuration ---'
rg -n --glob 'package.json' --glob 'pyproject.toml' --glob 'package_node_musllinux.mjs' 'test|check|format|prettier|eslint|node' .

Repository: NVIDIA/NeMo-Relay

Length of output: 21258


🏁 Script executed:

#!/bin/bash
set -eu
printf '%s\n' '--- packaging invocation ---'
sed -n '1595,1630p' justfile
printf '%s\n' '--- downstream version handling ---'
sed -n '110,155p' scripts/package-node-bin.py
rg -n 'version|Version|metadata|output' scripts/package-node-bin.py | head -80
printf '%s\n' '--- node tests layout ---'
find crates/node/tests -maxdepth 1 -type f -print 2>/dev/null | sort | head -80
printf '%s\n' '--- target script references ---'
rg -n -C 3 'package_node_musllinux|package-node-musllinux|musllinux' justfile scripts README.md docs .github 2>/dev/null | head -160
printf '%s\n' '--- deterministic parser probe ---'
node - <<'JS'
function argumentsFrom(args) {
  let version;
  let output;
  let platform;
  for (let index = 0; index < args.length; index += 2) {
    const value = args[index + 1];
    if (args[index] === "--version") {
      version = value;
    } else if (args[index] === "--out") {
      output = value;
    } else if (args[index] === "--platform") {
      platform = value;
    } else {
      throw new Error(`Unexpected argument: ${args[index]}`);
    }
  }
  if (!version || !output || !platform) {
    throw new Error("Usage");
  }
  return { output, platform, version };
}
for (const args of [
  ["--version", "--out", "--out", "out", "--platform", "linux"],
  ["--version", "1.2.3", "--out"],
  ["--version", "--platform", "--out", "out", "--platform", "linux"],
]) {
  try {
    console.log(JSON.stringify(args), "=>", JSON.stringify(argumentsFrom(args)));
  } catch (error) {
    console.log(JSON.stringify(args), "=> ERROR:", error.message);
  }
}
JS

Repository: NVIDIA/NeMo-Relay

Length of output: 17416


Reject option tokens used as values.

When args[index + 1] is another option, argumentsFrom stores it as version, output, or platform. This can pass values such as "--out" into package metadata and artifact filenames. Reject undefined and option tokens before assignment. Add regression coverage for the malformed invocation.

🤖 Prompt for 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.

In `@scripts/package_node_musllinux.mjs` around lines 23 - 24, Update the argument
parsing loop around argumentsFrom so it validates args[index + 1] before
assigning it to version, output, or platform: reject undefined values and tokens
beginning with the option prefix, and handle the malformed invocation
consistently with existing argument errors. Add regression coverage confirming
option tokens cannot be accepted as values.

Source: Path instructions

@willkill07 willkill07 added this to the 0.7 milestone Aug 2, 2026
@willkill07 willkill07 self-assigned this Aug 2, 2026
@willkill07 willkill07 added the DO NOT MERGE PR should not be merged; see PR for details label Aug 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DO NOT MERGE PR should not be merged; see PR for details Improvement improvement to existing functionality lang:go PR changes/introduces Go code lang:js PR changes/introduces Javascript/Typescript code lang:rust PR changes/introduces Rust code size:L PR is large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant