Skip to content

test(sdk): check export and state parsing without OpenTofu - #12996

Merged
cv merged 1 commit into
v1from
test/move-tests-to-owning-layer
Oct 11, 2026
Merged

cv merged 1 commit into
v1from
test/move-tests-to-owning-layer

Conversation

@cv

@cv cv commented Oct 11, 2026

Copy link
Copy Markdown
Collaborator

Part of #12881.

Failure

Two nemoclaw-sdk unit tests ran OpenTofu from NEMOCLAW_TEST_BUNDLE in the lifecycle step:

  • deployment::export::tests::runtime_export_declares_the_native_helm_provider_inputs built a Kubernetes runtime stage, fabricated its state, and ran export against an unreachable cluster to check that OpenTofu did not report an undeclared input variable.
  • state::tests::native_state_json_preserves_module_and_instance_identity_without_refresh applied OpenTofu's builtin terraform_data resources to check how the SDK reads tofu show -json.

Unit tests must not run OpenTofu; the rule each checked is pure SDK logic.

Decision

  • Export's provider-only configuration is now one function, observation_configuration. A unit test, export_configuration_declares_every_variable_its_providers_read, compiles the Kubernetes runtime graph and checks that the configuration keeps the graph's terraform and provider blocks, has no resources or data sources, and declares every var. its providers read, including nemoclaw_kubeconfig. Removing the variable copy fails it: export reads undeclared variable nemoclaw_kubeconfig.
  • The state test is removed; the tests below keep its checks.
  • .config/nextest.toml drops both names from the lifecycle filter.
Removed assertion Test that keeps it
Export declares the Helm provider's input variables before refreshing deployment::export::tests::export_configuration_declares_every_variable_its_providers_read (unit)
A failed export observation leaves the source state unchanged export_observations::export_refreshes_through_opentofu_without_applying_or_losing_bindings (nemoclaw-e2e): the provider read fails, and terraform.tfstate and intent.json keep their bytes
Export reaches provider observation The same test: the error comes from the refresh-only plan after the provider read fails
Module and for_each instance addresses stay distinct state::tests::documented_state_json_preserves_full_instance_addresses (unit, OpenTofu's documented show -json format)
Reading bindings does not rewrite state export_observations::export_refreshes_through_opentofu_without_applying_or_losing_bindings: a successful export reads bindings and leaves terraform.tfstate unchanged
Unreadable state is an error state::tests::malformed_duplicate_and_unsupported_state_is_not_empty for state that parses wrongly; for a file OpenTofu cannot read, show fails and bindings returns that failure

The Kubernetes-specific part of the export test, the declared variable, is now checked in the unit test only; the e2e keeper exercises the same export code on the root stage.

Validation

On linux_arm64:

  • cargo nextest run -p nemoclaw-sdk --lib: 190 passed.
  • The new unit test fails with the variable copy removed, and passes with it.
  • cargo nextest list --profile lifecycle -p nemoclaw-sdk --run-ignored all selects only the five helm_recovery tests, which a later change moves.
  • export_observations::export_refreshes_through_opentofu_without_applying_or_losing_bindings against a bundle built from this branch: passed.
  • cargo fmt --all --check and cargo clippy --workspace --all-targets -- -D warnings: clean.

Replace runtime_export_declares_the_native_helm_provider_inputs with a unit
test of the export's provider-only configuration, and remove
native_state_json_preserves_module_and_instance_identity_without_refresh,
whose checks unit and system tests keep.
@cv cv added area: ci CI workflows, checks, release automation, or GitHub Actions v1 NemoClaw v1 branch labels Oct 11, 2026
@github-actions

Copy link
Copy Markdown
Contributor

@cv
cv merged commit 875f4f1 into v1 Oct 11, 2026
@cv
cv deleted the test/move-tests-to-owning-layer branch October 11, 2026 19:36
cv added a commit that referenced this pull request Oct 11, 2026
Part of #12876: its last criterion, "the testing guide describes the
layers and budgets".

## Failure

`docs/contributing/testing.md` listed the step budgets but didn't
describe the unit, contract, system, and live layers, or which crates
and binaries belong to each. `docs/contributing/integration-tests.md`
had grown one fixture at a time, and some of its text no longer matched
the code:

- it named tests that no longer exist: `harness_codex`, the OpenClaw
interface lifecycle, and Hermes interface modes;
- it described ten Fabric harness tests, but `fabric_deployment` has two
(OpenClaw and Pi);
- its Docker tests are part of the `live-docker` suite, not the fixture
layers.

## Decision

- `testing.md` now has sections for the layers (what each checks, its
binaries, and what belongs there), how to run each layer with the one
`NEMOCLAW_TEST_BUNDLE` input, budgets and per-test limits (where each is
enforced and how to change one), timing reports, and how CI runs each
layer: jobs, partitions, archives, the Windows relay, and live suites on
pull requests. The dependency, image, schema, CLI, cache, and coverage
sections are unchanged.
- `integration-tests.md` now covers the contract and system layers: the
shared harness, each provider's contract binary by module, and the
system modules, built from the current test names.
- The four sections that need a real Docker engine move to
`live-tests.md` under a new Docker Live Suite section, next to the
Docker gateway tests already there. Their two inbound links are updated.
Other anchors are kept.
- After merging `v1` (#12995, #12996, #12998, #12999, #13000), the guide
describes what moved: the system layer's `nemoclaw-sdk` tests are now
only the Helm recovery tests, the OpenShell and Fabric backends'
fake-gateway tests (formerly `nemoclaw-e2e/tests/openshell.rs`) are
provider unit tests, the Kind suite runs `nemoclaw-e2e`'s
`kubernetes_live` and `kubernetes_chart`, and `Build live images` builds
the live images once and decides whether the live suites run.
- The `kubernetes_lifecycle` contract tests' `#[ignore]` reason named
`NEMOCLAW_TEST_TOFU` and `NEMOCLAW_TEST_PROVIDER`; it now names
`NEMOCLAW_TEST_BUNDLE`, which the tests read.
- Every statement was checked against `run_ci.rs`, `ci/timing.rs`,
`.config/`, the workflows, the `v1` ruleset, and the tests.

### Budget enforcement audit

Every budget in `.config/test-budgets.yaml` is enforced on the Linux
runners. In run
[38136353545](https://github.com/NVIDIA/NemoClaw/actions/runs/38136353545)
(linux_amd64), the `test`, `Lifecycle / 1`, `Live / Docker`, `Live /
Kind`, and `Lifecycle timing` logs each print their budget and "Within
budget." with no "reported only" note. The three binary budgets appear
in the `Lifecycle timing` table.

No budget is recorded but unenforced. These gaps remain:

- When `changes live` skips the live suites on a pull request, their
budgets aren't checked for that PR.
- The `test` wall budget covers the nextest run, not the doctests.
- `.config/test-budgets.yaml` isn't checked in the other direction. A
step key that names no step, or a binary budget whose binary has no
lifecycle tests (renamed, or every partition missing its report), passes
silently. `Lifecycle timing` names a partition with no report but
doesn't fail on it.

## Validation

- `cargo run --locked -p nemoclaw-build -- fern check`: 0 errors. Its
one warning is also on `v1`.
- `git diff --check`
- `cargo test -p nemoclaw-build --test integration ci::`: 15 passed.
- I ran the documented commands against a `linux_arm64` bundle:
- the nextest `lifecycle` command filtered to
`openshell-provider::contract` (44 passed);
  - `nemoclaw-sdk --lib -- --ignored helm_recovery` (5 passed);
  - `nemoclaw-e2e sandbox_readiness::` (1 passed);
  - `nemoclaw-provider --test contract service_readiness::` (2 passed);
  - `lifecycle-timing` on an empty directory.
- After the merge, against a rebuilt `linux_arm64` bundle: the same
commands again, plus `kubernetes_lifecycle::` (2 passed) and the
providers' `fake_gateway_tests` (3 and 9 passed); `cargo fmt --all
--check` and `cargo clippy --workspace --all-targets -- -D warnings`.
- No behavior changes: the only code change is an `#[ignore]` reason
string.
@wscurran wscurran added the chore Build, CI, dependency, or tooling maintenance label 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: ci CI workflows, checks, release automation, or GitHub Actions chore Build, CI, dependency, or tooling maintenance v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants