Skip to content

fix(core): harden runtime contract invariants - #25

Merged
dagardner-nv merged 2 commits into
NVIDIA:mainfrom
AjayThorve:ajay/fabric-sdk-consumer-contract
Jun 29, 2026
Merged

fix(core): harden runtime contract invariants#25
dagardner-nv merged 2 commits into
NVIDIA:mainfrom
AjayThorve:ajay/fabric-sdk-consumer-contract

Conversation

@AjayThorve

@AjayThorve AjayThorve commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Ensures run_plan cleans up started runtimes on invoke errors and validates runtime handles before invoke/stop dispatch.
  • Adds explicit unsupported capability routing instead of implying unimplemented Fabric-managed tools/skills/MCP execution.
  • Adds doctor warnings for modeled-but-unimplemented service/http/native-plugin runtime surfaces and regenerates schema snapshots.
  • Updates CodeRabbit config in the same concise style as NeMo Relay, including draft PR reviews.

Test Plan

  • git diff --check HEAD~1..HEAD
  • cargo fmt --check
  • cargo test --workspace
  • cargo check -p fabric-python
  • python3 tests/smoke_cli.py
  • python3 python/tests/smoke_native_sdk.py
  • python3 python/tests/smoke_typed_config.py
  • python3 python/tests/smoke_sdk.py

Closes FABRIC-38

Summary by CodeRabbit

  • New Features
    • Added an explicit unsupported capability state for configured but non-executable targets, with aligned planning behavior and schema updates.
    • Runtime handles now include a runtime binding used to strengthen plan/handle consistency.
  • Bug Fixes
    • Runtime is now properly stopped when invocation fails.
    • Improved diagnostics for “modeled but not implemented” scenarios, including service mode and unsupported capability routes.
    • Stricter runtime-handle validation prevents mismatches against the selected run plan.
  • Chores
    • Expanded automated PR review/check rules and path-specific guidance, plus further schema/tooling alignment.

@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

The PR expands CodeRabbit review configuration, adds unsupported capability routing and schema support, extends doctor diagnostics, and adds runtime handle validation plus shutdown handling.

Changes

CodeRabbit review configuration

Layer / File(s) Summary
Review configuration
\.coderabbit.yaml
The review profile, tone, merge checks, title rules, auto-review settings, path filters, path instructions, tools, and knowledge-base patterns are updated.

Core runtime checks

Layer / File(s) Summary
Capability contracts and schemas
crates/fabric-core/src/config.rs, schemas/*.schema.json
The unsupported capability target is added to config and schema shapes, including defaults and exported types.
Capability routing
crates/fabric-core/src/config.rs
Tools, skills, and MCP server routing now records unsupported capability plans and routes, with matching test assertions.
Doctor diagnostics
crates/fabric-core/src/doctor.rs
Doctor now checks runtime execution surface, warns on unsupported capability routes, and updates the service-resolution message.
Runtime handle validation and shutdown
crates/fabric-core/src/error.rs, crates/fabric-core/src/runtime.rs, schemas/runtime-handle.schema.json
The runtime handle gains a binding field, invoke and stop paths validate plan/handle consistency, invoke failure triggers runtime shutdown, and tests cover mismatches and stop tracking.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 45.24% 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 follows Conventional Commits and accurately summarizes the runtime-contract hardening changes.
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.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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

@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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/fabric-core/src/config.rs (1)

1087-1142: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

This silently changes the public capability-routing contract.

CapabilityPlan/CapabilityTarget are serialized into the public schemas, and these branches now emit unsupported where existing consumers previously saw fabric_managed plus populated managed.*. Any downstream code branching on CapabilityTarget::FabricManaged or reading capability_plan.managed will change behavior immediately. If this rename is intentional, it needs a versioned contract or compatibility window rather than an in-place target swap.

As per path instructions, "Public API changes should preserve existing behavior unless tests and docs show the intended migration path."

Also applies to: 1153-1153, 1300-1302, 1355-1356

🤖 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 `@crates/fabric-core/src/config.rs` around lines 1087 - 1142, The
capability-routing logic in CapabilityPlan is changing a public serialized
contract by emitting CapabilityTarget::Unsupported and filling unsupported.*
where consumers previously relied on CapabilityTarget::FabricManaged and
managed.*. Update the mapping in the capability route construction paths (the
Skills/MCP branches and any similar ones) to preserve existing behavior or add
an explicit versioned migration/compatibility layer so downstream code and
schemas do not break unexpectedly.

Source: Path instructions

🤖 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/fabric-core/src/runtime.rs`:
- Around line 454-524: The runtime handle validation in validate_runtime_handle
still allows a cloned RunPlan with different invocation-affecting settings to
pass because it only checks a few human-readable fields. Add a stable plan
identity/fingerprint to RuntimeHandle when start_runtime() creates it, and have
validate_runtime_handle/expect_runtime_field verify that single identity instead
of comparing only agent_name, adapter_kind, runtime.mode, adapter_id, and
environment fields. Update invoke_runtime() callers accordingly so the handle is
bound to the exact plan that created it, and add a regression test that changes
harness.settings or another adapter input while keeping the existing handle.

---

Outside diff comments:
In `@crates/fabric-core/src/config.rs`:
- Around line 1087-1142: The capability-routing logic in CapabilityPlan is
changing a public serialized contract by emitting CapabilityTarget::Unsupported
and filling unsupported.* where consumers previously relied on
CapabilityTarget::FabricManaged and managed.*. Update the mapping in the
capability route construction paths (the Skills/MCP branches and any similar
ones) to preserve existing behavior or add an explicit versioned
migration/compatibility layer so downstream code and schemas do not break
unexpectedly.
🪄 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: 93ddc952-3b6a-4910-bc7b-59be8c884ccd

📥 Commits

Reviewing files that changed from the base of the PR and between b498c3a and 7917015.

📒 Files selected for processing (7)
  • .coderabbit.yaml
  • crates/fabric-core/src/config.rs
  • crates/fabric-core/src/doctor.rs
  • crates/fabric-core/src/error.rs
  • crates/fabric-core/src/runtime.rs
  • schemas/adapter-invocation.schema.json
  • schemas/run-plan.schema.json
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Test
⚠️ CI failures not shown inline (2)

GitHub Actions: Rust / Test: fix(core): harden runtime contract invariants

Conclusion: failure

View job details

##[group]Run cargo test --workspace --locked
 �[36;1mcargo test --workspace --locked�[0m
 shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
 env:
   CARGO_INCREMENTAL: 0
   CARGO_PROFILE_DEV_DEBUG: 0
   CARGO_TERM_COLOR: always
   RUST_BACKTRACE: short
   RUSTFLAGS: -D warnings
   CARGO_UNSTABLE_SPARSE_REGISTRY: true
   CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
   CACHE_ON_FAILURE: false
 ##[endgroup]
 �[1m�[92m   Compiling�[0m fabric-core v0.1.0 (/home/runner/work/NeMo-Fabric/NeMo-Fabric/crates/fabric-core)
 �[1m�[92m   Compiling�[0m fabric-cli v0.1.0 (/home/runner/work/NeMo-Fabric/NeMo-Fabric/crates/fabric-cli)
 �[1m�[92m    Finished�[0m `test` profile [unoptimized] target(s) in 7.60s
 �[1m�[92m     Running�[0m unittests src/main.rs (target/debug/deps/fabric-d6b0cd643d758f74)
 running 0 tests
 test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
 �[1m�[92m     Running�[0m unittests src/lib.rs (target/debug/deps/fabric_core-039dd9c04deba413)
 running 31 tests
 test config::tests::errors_for_unknown_manifest_profile ... ok

GitHub Actions: Rust / 0_Test.txt: fix(core): harden runtime contract invariants

Conclusion: failure

View job details

##[group]Run cargo test --workspace --locked
 �[36;1mcargo test --workspace --locked�[0m
 shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
 env:
   CARGO_INCREMENTAL: 0
   CARGO_PROFILE_DEV_DEBUG: 0
   CARGO_TERM_COLOR: always
   RUST_BACKTRACE: short
   RUSTFLAGS: -D warnings
   CARGO_UNSTABLE_SPARSE_REGISTRY: true
   CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
   CACHE_ON_FAILURE: false
 ##[endgroup]
 �[1m�[92m   Compiling�[0m fabric-core v0.1.0 (/home/runner/work/NeMo-Fabric/NeMo-Fabric/crates/fabric-core)
 �[1m�[92m   Compiling�[0m fabric-cli v0.1.0 (/home/runner/work/NeMo-Fabric/NeMo-Fabric/crates/fabric-cli)
 �[1m�[92m    Finished�[0m `test` profile [unoptimized] target(s) in 7.60s
 �[1m�[92m     Running�[0m unittests src/main.rs (target/debug/deps/fabric-d6b0cd643d758f74)
 running 0 tests
 test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
 �[1m�[92m     Running�[0m unittests src/lib.rs (target/debug/deps/fabric_core-039dd9c04deba413)
 running 31 tests
 test config::tests::errors_for_unknown_manifest_profile ... ok
🧰 Additional context used
📓 Path-based instructions (2)
crates/fabric-core/src/**/*.rs

⚙️ CodeRabbit configuration file

crates/fabric-core/src/**/*.rs: Review the Rust core for runtime lifecycle correctness, handle validation, capability routing accuracy, schema stability, and error semantics.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.

Files:

  • crates/fabric-core/src/error.rs
  • crates/fabric-core/src/doctor.rs
  • crates/fabric-core/src/config.rs
  • crates/fabric-core/src/runtime.rs
schemas/**/*

⚙️ CodeRabbit configuration file

schemas/**/*: Schemas are generated public contract snapshots. Check that schema diffs correspond to intentional Rust type changes and are covered by core tests.

Files:

  • schemas/adapter-invocation.schema.json
  • schemas/run-plan.schema.json
🧬 Code graph analysis (3)
crates/fabric-core/src/error.rs (1)
crates/fabric-core/src/config.rs (1)
  • FabricError (15-15)
crates/fabric-core/src/doctor.rs (1)
crates/fabric-core/src/config.rs (5)
  • ResolutionStrategy (257-272)
  • AdapterKind (407-416)
  • RuntimeMode (455-462)
  • Transport (467-476)
  • RunPlan (1221-1255)
crates/fabric-core/src/runtime.rs (1)
crates/fabric-core/src/config.rs (3)
  • ControlLocation (277-282)
  • AdapterKind (407-416)
  • RuntimeMode (455-462)
🔇 Additional comments (3)
.coderabbit.yaml (3)

39-39: 📐 Maintainability & Code Quality

Confirm these matchers use supported syntax.

Line 39 relies on release/.*, and Lines 68-79 rely on brace alternation. If these fields accept only literal branch names or plain globs, release auto-reviews and several path instructions will silently never match.

Also applies to: 68-79


52-52: 📐 Maintainability & Code Quality

docs/python-sdk/** is excluded before the docs instruction can run.

Line 52 removes that subtree from review entirely, so the documentation guidance on Lines 74-76 can never apply there. If this directory is generated output, fine; otherwise this drops review coverage on a public SDK surface.

Also applies to: 74-76


85-102: 📐 Maintainability & Code Quality

Verify tools is nested at the correct schema level.

This block currently sits under reviews:. If the current CodeRabbit schema expects tools at the top level, every scanner toggle here will be ignored.

Comment thread crates/fabric-core/src/runtime.rs

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/fabric-core/src/runtime.rs (1)

489-500: 🗄️ Data Integrity & Integration | 🟠 Major | 🏗️ Heavy lift

Validate the full prepared environment, not just provider/control.

plan_fingerprint only binds the handle to the RunPlan; it does not protect runtime.environment from being swapped or mutated. A handle with the same plan_fingerprint but a different workspace/artifacts path would pass these checks and dispatch the adapter against the wrong prepared environment. Compare all execution-affecting EnvironmentHandle fields against the environment prepared for plan, or store/validate an environment fingerprint created at start_runtime().

🤖 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 `@crates/fabric-core/src/runtime.rs` around lines 489 - 500, The current
validation in runtime.rs only checks environment.provider and
environment.control_location, so a RuntimeHandle can still point at a swapped or
mutated runtime.environment. Update the runtime validation around the existing
expect_runtime_field checks to compare all execution-affecting EnvironmentHandle
fields for the prepared environment associated with the RunPlan, or
alternatively persist and verify an environment fingerprint created in
start_runtime(). Use the existing runtime, plan, and
expected_environment_provider/expected_control_location flow as the anchor for
the fix.

Source: Path instructions

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

Outside diff comments:
In `@crates/fabric-core/src/runtime.rs`:
- Around line 489-500: The current validation in runtime.rs only checks
environment.provider and environment.control_location, so a RuntimeHandle can
still point at a swapped or mutated runtime.environment. Update the runtime
validation around the existing expect_runtime_field checks to compare all
execution-affecting EnvironmentHandle fields for the prepared environment
associated with the RunPlan, or alternatively persist and verify an environment
fingerprint created in start_runtime(). Use the existing runtime, plan, and
expected_environment_provider/expected_control_location flow as the anchor for
the fix.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: 62d5fbab-6e43-46fc-8ba8-7b647f5176d8

📥 Commits

Reviewing files that changed from the base of the PR and between 7917015 and ba31e0c.

📒 Files selected for processing (2)
  • crates/fabric-core/src/runtime.rs
  • schemas/runtime-handle.schema.json
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Test
⚠️ CI failures not shown inline (2)

GitHub Actions: Rust / 0_Test.txt: fix(core): harden runtime contract invariants

Conclusion: failure

View job details

##[group]Run cargo test --workspace --locked
 �[36;1mcargo test --workspace --locked�[0m
 shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
 env:
   CARGO_INCREMENTAL: 0
   CARGO_PROFILE_DEV_DEBUG: 0
   CARGO_TERM_COLOR: always
   RUST_BACKTRACE: short
   RUSTFLAGS: -D warnings
   CARGO_UNSTABLE_SPARSE_REGISTRY: true
   CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
   CACHE_ON_FAILURE: false
 ##[endgroup]
 �[1m�[92m   Compiling�[0m fabric-core v0.1.0 (/home/runner/work/NeMo-Fabric/NeMo-Fabric/crates/fabric-core)
 �[1m�[92m   Compiling�[0m fabric-cli v0.1.0 (/home/runner/work/NeMo-Fabric/NeMo-Fabric/crates/fabric-cli)
 �[1m�[92m    Finished�[0m `test` profile [unoptimized] target(s) in 7.82s
 �[1m�[92m     Running�[0m unittests src/main.rs (target/debug/deps/fabric-d6b0cd643d758f74)
 �[1m�[92m     Running�[0m unittests src/lib.rs (target/debug/deps/fabric_core-039dd9c04deba413)
 running 0 tests
 test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
 running 32 tests
 test config::tests::errors_for_unknown_manifest_profile ... ok

GitHub Actions: Rust / Test: fix(core): harden runtime contract invariants

Conclusion: failure

View job details

##[group]Run cargo test --workspace --locked
 �[36;1mcargo test --workspace --locked�[0m
 shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
 env:
   CARGO_INCREMENTAL: 0
   CARGO_PROFILE_DEV_DEBUG: 0
   CARGO_TERM_COLOR: always
   RUST_BACKTRACE: short
   RUSTFLAGS: -D warnings
   CARGO_UNSTABLE_SPARSE_REGISTRY: true
   CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
   CACHE_ON_FAILURE: false
 ##[endgroup]
 �[1m�[92m   Compiling�[0m fabric-core v0.1.0 (/home/runner/work/NeMo-Fabric/NeMo-Fabric/crates/fabric-core)
 �[1m�[92m   Compiling�[0m fabric-cli v0.1.0 (/home/runner/work/NeMo-Fabric/NeMo-Fabric/crates/fabric-cli)
 �[1m�[92m    Finished�[0m `test` profile [unoptimized] target(s) in 7.82s
 �[1m�[92m     Running�[0m unittests src/main.rs (target/debug/deps/fabric-d6b0cd643d758f74)
 �[1m�[92m     Running�[0m unittests src/lib.rs (target/debug/deps/fabric_core-039dd9c04deba413)
 running 0 tests
 test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
 running 32 tests
 test config::tests::errors_for_unknown_manifest_profile ... ok
🧰 Additional context used
📓 Path-based instructions (2)
schemas/**/*

⚙️ CodeRabbit configuration file

schemas/**/*: Schemas are generated public contract snapshots. Check that schema diffs correspond to intentional Rust type changes and are covered by core tests.

Files:

  • schemas/runtime-handle.schema.json
crates/fabric-core/src/**/*.rs

⚙️ CodeRabbit configuration file

crates/fabric-core/src/**/*.rs: Review the Rust core for runtime lifecycle correctness, handle validation, capability routing accuracy, schema stability, and error semantics.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.

Files:

  • crates/fabric-core/src/runtime.rs
🧬 Code graph analysis (1)
crates/fabric-core/src/runtime.rs (1)
crates/fabric-core/src/config.rs (1)
  • RunPlan (1221-1255)
🔇 Additional comments (1)
schemas/runtime-handle.schema.json (1)

161-178: LGTM!

@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 `@crates/fabric-core/src/runtime.rs`:
- Around line 466-472: The runtime validation in `runtime.rs` is still deriving
`expected_environment_fingerprint` from `runtime.environment`, which lets a
handle change invocation-affecting fields and recompute the fingerprint to
bypass checks. Update `expect_runtime_field` usage in `runtime` validation to
bind `environment_fingerprint` to the plan-derived environment (or explicitly
validate all invocation-affecting environment fields against the plan
environment), using the existing `environment_fingerprint` and
`runtime.environment`/plan-environment comparison logic. Add a regression test
that mutates both the environment fields and the fingerprint to confirm
validation fails.
🪄 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: 6a0d1e6f-5884-42af-bf67-46713cbbbf58

📥 Commits

Reviewing files that changed from the base of the PR and between ba31e0c and 61f3289.

📒 Files selected for processing (2)
  • crates/fabric-core/src/runtime.rs
  • schemas/runtime-handle.schema.json
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Test
⚠️ CI failures not shown inline (2)

GitHub Actions: Rust / 0_Test.txt: fix(core): harden runtime contract invariants

Conclusion: failure

View job details

##[group]Run cargo test --workspace --locked
 �[36;1mcargo test --workspace --locked�[0m
 shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
 env:
   CARGO_INCREMENTAL: 0
   CARGO_PROFILE_DEV_DEBUG: 0
   CARGO_TERM_COLOR: always
   RUST_BACKTRACE: short
   RUSTFLAGS: -D warnings
   CARGO_UNSTABLE_SPARSE_REGISTRY: true
   CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
   CACHE_ON_FAILURE: false
 ##[endgroup]
 �[1m�[92m   Compiling�[0m fabric-core v0.1.0 (/home/runner/work/NeMo-Fabric/NeMo-Fabric/crates/fabric-core)
 �[1m�[92m   Compiling�[0m fabric-cli v0.1.0 (/home/runner/work/NeMo-Fabric/NeMo-Fabric/crates/fabric-cli)
 �[1m�[92m    Finished�[0m `test` profile [unoptimized] target(s) in 7.17s
 �[1m�[92m     Running�[0m unittests src/main.rs (target/debug/deps/fabric-d6b0cd643d758f74)
 running 0 tests
 �[1m�[92m     Running�[0m unittests src/lib.rs (target/debug/deps/fabric_core-039dd9c04deba413)
 test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
 running 33 tests
 test config::tests::errors_for_unknown_manifest_profile ... ok

GitHub Actions: Rust / Test: fix(core): harden runtime contract invariants

Conclusion: failure

View job details

##[group]Run cargo test --workspace --locked
 �[36;1mcargo test --workspace --locked�[0m
 shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
 env:
   CARGO_INCREMENTAL: 0
   CARGO_PROFILE_DEV_DEBUG: 0
   CARGO_TERM_COLOR: always
   RUST_BACKTRACE: short
   RUSTFLAGS: -D warnings
   CARGO_UNSTABLE_SPARSE_REGISTRY: true
   CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
   CACHE_ON_FAILURE: false
 ##[endgroup]
 �[1m�[92m   Compiling�[0m fabric-core v0.1.0 (/home/runner/work/NeMo-Fabric/NeMo-Fabric/crates/fabric-core)
 �[1m�[92m   Compiling�[0m fabric-cli v0.1.0 (/home/runner/work/NeMo-Fabric/NeMo-Fabric/crates/fabric-cli)
 �[1m�[92m    Finished�[0m `test` profile [unoptimized] target(s) in 7.17s
 �[1m�[92m     Running�[0m unittests src/main.rs (target/debug/deps/fabric-d6b0cd643d758f74)
 running 0 tests
 �[1m�[92m     Running�[0m unittests src/lib.rs (target/debug/deps/fabric_core-039dd9c04deba413)
 test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
 running 33 tests
 test config::tests::errors_for_unknown_manifest_profile ... ok
🧰 Additional context used
📓 Path-based instructions (2)
schemas/**/*

⚙️ CodeRabbit configuration file

schemas/**/*: Schemas are generated public contract snapshots. Check that schema diffs correspond to intentional Rust type changes and are covered by core tests.

Files:

  • schemas/runtime-handle.schema.json
crates/fabric-core/src/**/*.rs

⚙️ CodeRabbit configuration file

crates/fabric-core/src/**/*.rs: Review the Rust core for runtime lifecycle correctness, handle validation, capability routing accuracy, schema stability, and error semantics.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.

Files:

  • crates/fabric-core/src/runtime.rs
🧬 Code graph analysis (1)
crates/fabric-core/src/runtime.rs (1)
crates/fabric-core/src/config.rs (1)
  • resolve_run_plan (673-676)
🔇 Additional comments (2)
crates/fabric-core/src/runtime.rs (1)

10-11: LGTM!

Also applies to: 26-27, 232-235, 339-345, 434-434, 446-447, 458-465, 473-545, 596-597, 617-621, 643-644, 664-668, 1139-1183, 1852-1852, 1893-1896, 1991-2062, 2083-2103

schemas/runtime-handle.schema.json (1)

153-177: LGTM!

Comment thread crates/fabric-core/src/runtime.rs Outdated

@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 `@crates/fabric-core/src/runtime.rs`:
- Around line 232-233: Preserve `RuntimeHandle` JSON compatibility by updating
the `RuntimeHandle` struct so `runtime_binding` can be omitted during
deserialization, or explicitly document a breaking migration if that field must
remain required. Apply the fix on the `runtime_binding` field in `RuntimeHandle`
with serde handling that allows older persisted handles to deserialize before
`RuntimeHandleMismatch` is checked.
🪄 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: e9d72394-065a-486c-855c-767ecba52392

📥 Commits

Reviewing files that changed from the base of the PR and between 61f3289 and 94306da.

📒 Files selected for processing (2)
  • crates/fabric-core/src/runtime.rs
  • schemas/runtime-handle.schema.json
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Test
⚠️ CI failures not shown inline (2)

GitHub Actions: Rust / Test: fix(core): harden runtime contract invariants

Conclusion: failure

View job details

##[group]Run cargo test --workspace --locked
 �[36;1mcargo test --workspace --locked�[0m
 shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
 env:
   CARGO_INCREMENTAL: 0
   CARGO_PROFILE_DEV_DEBUG: 0
   CARGO_TERM_COLOR: always
   RUST_BACKTRACE: short
   RUSTFLAGS: -D warnings
   CARGO_UNSTABLE_SPARSE_REGISTRY: true
   CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
   CACHE_ON_FAILURE: false
 ##[endgroup]
 �[1m�[92m   Compiling�[0m fabric-core v0.1.0 (/home/runner/work/NeMo-Fabric/NeMo-Fabric/crates/fabric-core)
 �[1m�[92m   Compiling�[0m fabric-cli v0.1.0 (/home/runner/work/NeMo-Fabric/NeMo-Fabric/crates/fabric-cli)
 �[1m�[92m    Finished�[0m `test` profile [unoptimized] target(s) in 12.22s
 �[1m�[92m     Running�[0m unittests src/main.rs (target/debug/deps/fabric-d6b0cd643d758f74)
 running 0 tests
 test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
 �[1m�[92m     Running�[0m unittests src/lib.rs (target/debug/deps/fabric_core-039dd9c04deba413)
 running 34 tests
 test config::tests::errors_for_unknown_manifest_profile ... ok

GitHub Actions: Rust / 0_Test.txt: fix(core): harden runtime contract invariants

Conclusion: failure

View job details

##[group]Run cargo test --workspace --locked
 �[36;1mcargo test --workspace --locked�[0m
 shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
 env:
   CARGO_INCREMENTAL: 0
   CARGO_PROFILE_DEV_DEBUG: 0
   CARGO_TERM_COLOR: always
   RUST_BACKTRACE: short
   RUSTFLAGS: -D warnings
   CARGO_UNSTABLE_SPARSE_REGISTRY: true
   CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
   CACHE_ON_FAILURE: false
 ##[endgroup]
 �[1m�[92m   Compiling�[0m fabric-core v0.1.0 (/home/runner/work/NeMo-Fabric/NeMo-Fabric/crates/fabric-core)
 �[1m�[92m   Compiling�[0m fabric-cli v0.1.0 (/home/runner/work/NeMo-Fabric/NeMo-Fabric/crates/fabric-cli)
 �[1m�[92m    Finished�[0m `test` profile [unoptimized] target(s) in 12.22s
 �[1m�[92m     Running�[0m unittests src/main.rs (target/debug/deps/fabric-d6b0cd643d758f74)
 running 0 tests
 test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
 �[1m�[92m     Running�[0m unittests src/lib.rs (target/debug/deps/fabric_core-039dd9c04deba413)
 running 34 tests
 test config::tests::errors_for_unknown_manifest_profile ... ok
🧰 Additional context used
📓 Path-based instructions (2)
schemas/**/*

⚙️ CodeRabbit configuration file

schemas/**/*: Schemas are generated public contract snapshots. Check that schema diffs correspond to intentional Rust type changes and are covered by core tests.

Files:

  • schemas/runtime-handle.schema.json
crates/fabric-core/src/**/*.rs

⚙️ CodeRabbit configuration file

crates/fabric-core/src/**/*.rs: Review the Rust core for runtime lifecycle correctness, handle validation, capability routing accuracy, schema stability, and error semantics.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.

Files:

  • crates/fabric-core/src/runtime.rs
🧬 Code graph analysis (1)
crates/fabric-core/src/runtime.rs (1)
crates/fabric-core/src/config.rs (2)
  • resolve_run_plan (673-676)
  • RunPlan (1221-1255)
🔇 Additional comments (3)
crates/fabric-core/src/runtime.rs (2)

456-462: Bind validation to the plan-derived environment.

This still computes the expected binding from runtime.environment; a caller that mutates environment fields such as workspace/artifacts and supplies a matching binding can bypass the intended plan/environment check. The regression only mutates the environment without updating the binding, so it does not cover that bypass. This is the same unresolved handle-validation concern from the previous review.

As per path instructions, "Review the Rust core for runtime lifecycle correctness, handle validation, capability routing accuracy, schema stability, and error semantics."

Also applies to: 521-531, 2071-2089

Source: Path instructions


592-592: LGTM!

Also applies to: 612-616, 638-638, 658-662, 1846-1848, 1887-1889, 1985-2023, 2024-2110

schemas/runtime-handle.schema.json (1)

161-172: Same compatibility concern as the Rust handle field.

Making runtime_binding required in the public schema means old serialized runtime handles are rejected at schema/deserialization time instead of receiving the new mismatch error. Keep this aligned with the RuntimeHandle migration decision.

Source: Path instructions

Comment thread crates/fabric-core/src/runtime.rs

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/fabric-core/src/runtime.rs (1)

445-460: 🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Avoid re-resolving the environment during stop/validation
prepare_environment is read-only, but validate_runtime_handle still depends on a fresh current_dir/path normalization pass. That makes teardown fail if cwd resolution breaks, even though runtime.environment is already available. Reuse the stored environment for stop-path validation and avoid repeating the same normalization on every invoke.

🤖 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 `@crates/fabric-core/src/runtime.rs` around lines 445 - 460,
`validate_runtime_handle` is re-building environment state via
`prepare_environment(plan)` during stop, which re-runs cwd/path normalization
unnecessarily. Update the stop-path validation to reuse the already stored
`runtime.environment` (and the existing
`runtime_binding`/`validate_runtime_handle` flow) instead of resolving a fresh
environment so teardown does not depend on current working directory state.

Source: Path instructions

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

Outside diff comments:
In `@crates/fabric-core/src/runtime.rs`:
- Around line 445-460: `validate_runtime_handle` is re-building environment
state via `prepare_environment(plan)` during stop, which re-runs cwd/path
normalization unnecessarily. Update the stop-path validation to reuse the
already stored `runtime.environment` (and the existing
`runtime_binding`/`validate_runtime_handle` flow) instead of resolving a fresh
environment so teardown does not depend on current working directory state.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Enterprise

Run ID: d5c8d3da-ae5d-4486-8813-8fe21c1e66f4

📥 Commits

Reviewing files that changed from the base of the PR and between 94306da and 7592951.

📒 Files selected for processing (2)
  • crates/fabric-core/src/runtime.rs
  • schemas/runtime-handle.schema.json
💤 Files with no reviewable changes (1)
  • schemas/runtime-handle.schema.json
📜 Review details
⏰ Context from checks skipped due to timeout. (1)
  • GitHub Check: Test
⚠️ CI failures not shown inline (2)

GitHub Actions: Rust / Test: fix(core): harden runtime contract invariants

Conclusion: failure

View job details

##[group]Run cargo test --workspace --locked
 �[36;1mcargo test --workspace --locked�[0m
 shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
 env:
   CARGO_INCREMENTAL: 0
   CARGO_PROFILE_DEV_DEBUG: 0
   CARGO_TERM_COLOR: always
   RUST_BACKTRACE: short
   RUSTFLAGS: -D warnings
   CARGO_UNSTABLE_SPARSE_REGISTRY: true
   CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
   CACHE_ON_FAILURE: false
 ##[endgroup]
 �[1m�[92m   Compiling�[0m fabric-core v0.1.0 (/home/runner/work/NeMo-Fabric/NeMo-Fabric/crates/fabric-core)
 �[1m�[92m   Compiling�[0m fabric-cli v0.1.0 (/home/runner/work/NeMo-Fabric/NeMo-Fabric/crates/fabric-cli)
 �[1m�[92m    Finished�[0m `test` profile [unoptimized] target(s) in 8.42s
 �[1m�[92m     Running�[0m unittests src/main.rs (target/debug/deps/fabric-d6b0cd643d758f74)
 running 0 tests
 test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
 �[1m�[92m     Running�[0m unittests src/lib.rs (target/debug/deps/fabric_core-039dd9c04deba413)
 running 36 tests
 test config::tests::errors_for_unknown_manifest_profile ... ok

GitHub Actions: Rust / 0_Test.txt: fix(core): harden runtime contract invariants

Conclusion: failure

View job details

##[group]Run cargo test --workspace --locked
 �[36;1mcargo test --workspace --locked�[0m
 shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
 env:
   CARGO_INCREMENTAL: 0
   CARGO_PROFILE_DEV_DEBUG: 0
   CARGO_TERM_COLOR: always
   RUST_BACKTRACE: short
   RUSTFLAGS: -D warnings
   CARGO_UNSTABLE_SPARSE_REGISTRY: true
   CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
   CACHE_ON_FAILURE: false
 ##[endgroup]
 �[1m�[92m   Compiling�[0m fabric-core v0.1.0 (/home/runner/work/NeMo-Fabric/NeMo-Fabric/crates/fabric-core)
 �[1m�[92m   Compiling�[0m fabric-cli v0.1.0 (/home/runner/work/NeMo-Fabric/NeMo-Fabric/crates/fabric-cli)
 �[1m�[92m    Finished�[0m `test` profile [unoptimized] target(s) in 8.42s
 �[1m�[92m     Running�[0m unittests src/main.rs (target/debug/deps/fabric-d6b0cd643d758f74)
 running 0 tests
 test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s
 �[1m�[92m     Running�[0m unittests src/lib.rs (target/debug/deps/fabric_core-039dd9c04deba413)
 running 36 tests
 test config::tests::errors_for_unknown_manifest_profile ... ok
🧰 Additional context used
📓 Path-based instructions (1)
crates/fabric-core/src/**/*.rs

⚙️ CodeRabbit configuration file

crates/fabric-core/src/**/*.rs: Review the Rust core for runtime lifecycle correctness, handle validation, capability routing accuracy, schema stability, and error semantics.
Public API changes should preserve existing behavior unless tests and docs show the intended migration path.

Files:

  • crates/fabric-core/src/runtime.rs
🧬 Code graph analysis (1)
crates/fabric-core/src/runtime.rs (2)
crates/fabric-core/src/config.rs (2)
  • ControlLocation (277-282)
  • EnvironmentOwnership (287-292)
crates/fabric-core/src/error.rs (1)
  • FabricError (16-194)
🔇 Additional comments (6)
crates/fabric-core/src/runtime.rs (6)

232-234: LGTM!


554-572: LGTM!


677-689: LGTM!

Also applies to: 725-737


2062-2125: LGTM!


2194-2214: LGTM!


605-619: 🗄️ Data Integrity & Integration

Drop this concern. runtime_binding is intentionally an exact fingerprint of the resolved RunPlan plus environment, and validation is meant to reject stale handles when any of those inputs drift. The config maps here use serde_json::Map/BTreeMap, not HashMap, so this is not a nondeterministic-serialization bug.

			> Likely an incorrect or invalid review comment.

@AjayThorve
AjayThorve marked this pull request as ready for review June 27, 2026 05:14
@linear

linear Bot commented Jun 27, 2026

Copy link
Copy Markdown

Signed-off-by: Ajay Thorve <athorve@nvidia.com>
Signed-off-by: Ajay Thorve <athorve@nvidia.com>
@AjayThorve
AjayThorve force-pushed the ajay/fabric-sdk-consumer-contract branch from 5fffb2d to a573d8d Compare June 28, 2026 01:48
@AjayThorve
AjayThorve requested a review from dagardner-nv June 29, 2026 05:15
@dagardner-nv
dagardner-nv merged commit 11c9e74 into NVIDIA:main Jun 29, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants