Skip to content

refactor(sdk): check plan observations against compiled addresses - #12773

Merged
cv merged 1 commit into
NVIDIA:v1from
bowenzhu21:refactor/compiled-observation-addresses
Oct 7, 2026
Merged

cv merged 1 commit into
NVIDIA:v1from
bowenzhu21:refactor/compiled-observation-addresses

Conversation

@bowenzhu21

Copy link
Copy Markdown

Summary

Plan validation now accepts only the observations a compiled graph reads. Compilation supplies those addresses, so plan.rs no longer rebuilds them from name prefixes.

Fixes #12534.

Failure

observation() in deployment/plan.rs rebuilt allowed observation names from prefixes that sandbox, runtime, and Docker compilation also encode. Across the 44 examples, those rules accepted observations no compiled graph reads:

  • any numbered discovery address, such as data.nemoclaw_fabric_capabilities.sandbox_99;
  • data.nemoclaw_engine_capabilities.current and the gateway capability observations, when the graph does not read them;
  • runtime image checks for a container the graph does not check, such as managed_gateway_runtime.

Its capacity rule matched data.nemoclaw_service_capacity, which SDK graphs stopped emitting in bd5f8df94; it accepted nothing on any example graph.

Changes

  • compile::observations returns the data sources a compiled graph reads. Apply, the runtime stage, and teardown add them to the addresses the plan gate expects. Teardown keeps the applied graph's observations before it removes the data block.
  • observation() accepts a data source only when it is expected. Its action, duplicate, deposed, and mode rules are unchanged.
  • Remove the prefix rules, compile::is_gateway_observation, discovery_graph::is_observation, and services::capacity, which only the gate used.
  • The gateway observation test now declares the observation it checks, because declaration is what the gate checks.

A new service kind, such as the containers in #12619, needs no change in plan.rs.

Evidence

  • New tests compile the deployment and runtime graphs of every example (63 graphs). Every observation a graph reads passes, and undeclared observations are rejected on apply and on teardown. Against the gate on 72d12f7, both rejection tests fail with sandbox_99 accepted.
  • A new test keeps deposed observations and unsupported resource modes rejected; it passes before and after.
  • Linux ARM64: cargo ci passes (1251 tests, 101 lifecycle tests), and cargo ci live-docker passes all 10 Docker live tests.
  • macOS ARM64: cargo fmt --check, Clippy with -D warnings, and the SDK unit tests pass.

Notes

  • With OpenTofu 1.12.6, destroy plans for the teardown graph list no data sources, because compile_teardown removes the data block. Teardown still passes the applied graph's observations, so the gate keeps accepting their discard as gateway_observations_are_read_only_in_plans_and_discardable_during_teardown expects.

Not in this PR

deployment/reporting.rs and deployment/apply.rs still derive some observation names for reporting and readiness. They do not decide plan acceptance.


Signed-off-by: Bowen Zhu [email protected]

Plan validation rebuilt the observations a plan may read from address
prefixes that compilation also encodes. Across the examples, the prefix
rules accepted observations no compiled graph reads: any numbered
discovery address, gateway and engine capabilities the graph does not
read, and runtime image checks for unchecked containers. Its capacity
rule matched a data source SDK graphs no longer emit.

Compilation now reports the data sources its graph reads, and apply, the
runtime stage, and teardown add them to the addresses the plan gate
expects. Teardown keeps the applied graph's observations before it
removes them. The gate keeps its action, duplicate, deposed, and mode
rules. The prefix rules, compile::is_gateway_observation,
discovery_graph::is_observation, and services::capacity are removed. The
gateway observation test now declares its observation, because
declaration is the contract the gate checks.

Validation: across all 63 deployment and runtime graphs of the 44
examples, every observation a graph reads passes, and undeclared
observations are rejected on apply and teardown; the rejection tests fail
against the gate on 72d12f7. On Linux ARM64, cargo ci (1251 tests, 101
lifecycle tests) and cargo ci live-docker (10 tests) pass. On macOS,
fmt, strict Clippy, and the SDK unit tests pass.

Signed-off-by: Bowen Zhu <[email protected]>
@copy-pr-bot

copy-pr-bot Bot commented Oct 7, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@cv
cv merged commit f4b23a9 into NVIDIA:v1 Oct 7, 2026
16 checks passed
@cv cv added the v1 NemoClaw v1 branch label Oct 12, 2026
@wscurran wscurran added area: architecture Architecture, design debt, major refactors, or maintainability refactor PR restructures code without intended behavior change security area: security Security controls, permissions, secrets, or hardening and removed security labels Oct 28, 2026
@cv cv added this to the Roadmap: GTC DC 2026 milestone Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: architecture Architecture, design debt, major refactors, or maintainability area: security Security controls, permissions, secrets, or hardening refactor PR restructures code without intended behavior change v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants