Skip to content

test(provider): move single-type nemoclaw tests into the provider's contract tests - #12939

Merged
cv merged 38 commits into
v1from
test/nemoclaw-contract
Oct 10, 2026
Merged

cv merged 38 commits into
v1from
test/nemoclaw-contract

Conversation

@cv

@cv cv commented Oct 9, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #12879 and #12876.

Failure

The nemoclaw provider's OpenTofu tests sat in nemoclaw-e2e beside the system scenarios, and the lifecycle profile selected them by name pattern. Nothing checked that every type had one, and #12868 added several by hand.

Decision

  • Contract binary: nemoclaw-provider gets a contract test binary, like the openshell and fabric ones. service_storage, kubernetes_hcl, runtime_image, vllm_runtime, gateway_readiness, and discovery move into it unchanged.
  • Coverage test: every_type_has_a_contract_test lists each resource and data source the provider serves, and fails for any type without a contract test.
  • Exceptions list: ELSEWHERE records the types still tested only elsewhere, each with its reason. The test also fails when one of them gains a contract test.
Type Tested in Why not in the contract binary yet
managed_gateway nemoclaw-e2e provider_protocol Needs that crate's fixture provider (#12878)
service_capacity, service_readiness nemoclaw-e2e Needs that crate's SSH fixture (#12878)
gateway_storage nemoclaw-e2e managed and the live Docker gateway test Needs Docker
inference_capabilities nemoclaw-e2e inference_discovery Read only through SDK deployments
  • Lifecycle profile: it now selects all three providers' contract binaries. It lists only the system modules that remain in nemoclaw-e2e.
  • Docs: docs/contributing/integration-tests.md describes the binary and the exceptions.

Still to do for #12879

  • Kubernetes: kubernetes_hcl checks the Kubernetes resources only through plan. Testing apply and refresh needs a fake Kubernetes API.
  • Exceptions: the five types above need contract tests. Three of them depend on fixture binaries that would first move into a shared crate (Share one test harness driven by the bundle #12878).

Validation

  • Local run: through the lifecycle profile, the contract binary (16 tests) and the three tests left in nemoclaw-e2e pass in 13 s. The coverage test failed at first for two reasons. The runtime data sources are named indirectly in vllm_runtime, so the test now also matches type names. The rest are the types listed in ELSEWHERE.
  • Checks: workspace clippy at -D warnings and fmt are clean.

cv added 29 commits October 8, 2026 23:42
Test time had no visible budget: the lifecycle step reached 684 s on
linux_arm64 for 2,673 s of tests, and finding the slow tests meant
downloading an artifact and reading JUnit XML.

After the test, lifecycle, and live steps, cargo ci reads the step's
nextest JUnit report and prints its test count, wall and summed time,
the time per test binary and module, and the slowest tests. In GitHub
Actions the report goes to the job summary. The deterministic step now
writes and uploads a JUnit report too.

Part of #12877.
The timing report parsed JUnit XML by hand. quick-junit, the library
nextest writes these reports with, deserializes them. The report also
limits its module table to the slowest rows and sums the rest, since
the deterministic step has over a hundred modules.
#12884 moved the native test steps into native-platform.yml and runs the
Unix lifecycle in two partitions. The timing report now names the
partition it covers, and the deterministic step's JUnit report is
uploaded from the new workflow.
The deployment module took 1,331 s of the 2,948 s summed lifecycle time
on linux_amd64. Profiling one lifecycle() locally showed where it goes:
about 11-18 s per full plan, apply, CLI export, reapply, drift checks,
and CLI destroy, of which five OpenTofu plans take a third. On CI each
lifecycle takes about 33 s, and 12 tests ran 24 of them to cover
configuration variants that the SDK already proves equivalent.

Each variant group now deploys once per behavior the deployment owns:

- web_search: 6 -> 2 lifecycles. One per provider, in different scopes;
  web_search::agent_inline_and_enclosing_definitions_compile_to_the_same_search_grants
  owns scope equivalence.
- execution_settings: 3 -> 1. Heartbeats are opaque native settings;
  execution_settings owns the timeout projection.
- tool_disclosure: 2 -> 1. agent_tools::disclosure_belongs_to_opaque_native_settings
  owns both modes.
- provider_definitions: 4 -> 2. One scope per harness;
  inference_references owns that both scopes compile and export unchanged.

Locally the four tests take 34 s at four threads instead of over 109 s
for web_search alone.

Part of #12882.
cli_redaction ran 13 CLI applies, about 30 s locally: four credentials in
both output formats. nemoclaw-sdk's process tests own the redaction rules
for short, colliding, overlapping, and Unicode credentials. The CLI test
now checks that each rule reaches a failed apply's output, one credential
per rule across both formats, in 18 s.

Part of #12882.
remote_service took 697 s summed on linux_amd64. Locally each of its
five full lifecycles runs about 30 CLI commands in 80-136 s, and only two
steps depend on the harness: image pull checks for OpenClaw and refused
sandbox changes for Pi.

- The non-authenticated Hermes lifecycle repeated the OpenClaw vLLM
  lifecycle step for step. Hermes with remote vLLM stays covered by the
  bearer lifecycle, and fabric_deployment covers each harness.
- Pi stops after admission without generation, its refused sandbox
  changes, and destroy; the service recovery that followed did not
  depend on the harness.
- Refused sandbox changes exported after each of eight refusals, about
  4 s each, while byte comparisons of the saved intent and state already
  prove nothing changed. One export after the refusals checks that the
  intent still reproduces the accepted document.

Locally the module sums 400 s instead of 562 s across its tests.

Part of #12882.
…OpenTofu

production_provider_applies_refreshes_and_destroys_the_reference_graph
was the slowest test in opentofu_openshell, 113 s on linux_amd64, with 23
OpenTofu runs locally. It planned once per incompatibility reason, five
times, and re-applied a saved plan for both failure kinds in both the
unchanged and creating cases.

nemoclaw-openshell's observation tests own every incompatibility reason
and its message. Through OpenTofu, one precondition failure and one
failed read now show both diagnostics reach the user, and the saved-plan
check runs each failure kind once: the driver change for an unchanged
plan and the failed read while creating. The test runs 14 OpenTofu
commands in 19 s locally instead of 30 s.

Part of #12882.
# Conflicts:
#	crates/nemoclaw-e2e/tests/remote_service.rs
fabric_deployment took 328 s summed on linux_amd64, about 30 s for each
of ten harnesses. Locally each harness took 26 s: 3 s to apply, 16 s
for a model change and its export, and 7 s refusing adapter, image, and
observed sandbox changes and destroying. Only the first part depends on
the harness; the rest exercises the Fabric provider and the SDK's
sandbox protections the same way every time.

Every harness still applies, reapplies without rewriting its runtime
configuration, exports unchanged, and destroys. OpenClaw also runs the
model change and the refusals, and Pi its route-role model change.

Locally the module sums about 146 s instead of 280 s; eight harnesses
take 9 s each instead of 26 s.

Part of #12882.
The onboarding TUI journeys took 168 s summed in the deterministic step on
linux_amd64, up to 15 s per journey. Each answer resolves the journey
several times, and each resolution validates the partial document against
the SDK's JSON Schema and parses it; unoptimized, jsonschema and its
regex and JSON dependencies made one resolution take about 8 ms.

Dependencies now build at opt-level 2 in the dev and test profiles;
workspace crates stay unoptimized. Locally the slowest journey takes
1.0 s instead of 2.5 s, and the nemoclaw-onboarding, nemoclaw-authoring,
and nemoclaw-sdk tests finish in 8.0 s instead of 13.4 s at eight
threads. A cold workspace build takes 82 s instead of 46 s locally; CI
restores dependencies from its cache, and this file is part of the cache
key, so the first run after this change builds cold.

Part of #12882.
Stacked on #12885. Part of #12882.

## Failure

The onboarding wizard resolved its journey again for each of these: the
next question, each step, the review document, and every view redraw. A
resolution validates the partial document against the SDK schema and
parses it. Instrumenting the slowest example journey,
`spark_spark_inline`, showed 196 resolutions across 36 answers, about 8
ms each in a debug build. This made the TUI journey tests the largest
cost in the deterministic test step: 168 s summed on `linux_amd64`.
Every redraw of the running TUI paid the same cost.

## Decision

- `JourneyWizard` keeps its last resolution, including a failed one, and
reuses it until the state or observations change.
- `state` and `observations` are private. Every change goes through
`submit`, `delegate`, `back`, or `remember`, which clear the kept
resolution. The view and terminal read them through accessors. Tests
record observations through a test-only `record` method that also clears
it.
- The view's information notes and review document use the kept
resolution.
- `JourneyState::answer` still resolves internally. That code is in
`nemoclaw-authoring` and unchanged here.

## Validation

- **New test:** asking for the next question and the document repeatedly
resolves once. An answer, an undo, and a new observation each cause
exactly one new resolution. The test was written first and failed to
compile without the counter.
- **Timings:** on top of #12885's optimized dependencies,
`spark_spark_inline` takes 0.74 s locally instead of 1.06 s. The
`nemoclaw-onboarding` library tests take 0.92 s instead of 1.28 s.
- **Checks:** all 79 library tests pass, and clippy at `-D warnings` and
fmt are clean.
optional_catalog_failures_preserve_complete_unchanged_plans_and_typed_uncertainty
took 50 s on linux_amd64. For both provider protocols it planned four
catalog responses twice, through the CLI and the SDK: 16 plans.

nemoclaw-discovery's inference tests own how each catalog response is
classified. The deployment test now plans each response once through
the CLI, split across the Anthropic and OpenAI protocols so both still
read their catalog and the Anthropic version header is still sent. The
CLI's JSON already shows the plan is complete and unchanged, which the
SDK preview repeated. The test takes 22 s locally.

Part of #12882.
# Conflicts:
#	.cargo/config.toml
#	Cargo.lock
#	crates/nemoclaw-build/Cargo.toml
Export's consistency check ran only inside end-to-end lifecycles, about
30 s each on CI, so whether a configuration exports unchanged was proven
one deployment at a time. The check itself is pure: it compares the
saved document's compiled provider and sandbox targets with refreshed
observations.

Export now passes those observations to a pure function, exported. A
unit test compiles every example, echoes its targets as observations,
and checks that the saved document exports unchanged, and that a
drifted sandbox image, a drifted provider endpoint, or a missing
observation stops the export. It runs in 0.3 s.

Part of #12882.
About 35 system tests repeated the generic lifecycle (export reproduces
the document, an unchanged reapply is a no-op, destroy cleans up) for one
configuration variant each, about 30 s apiece on CI.

- Export round trips for every example now run in the SDK's unit tests.
- Drift detection keeps one lifecycle per kind: web search registrations
  (Tavily only; Brave is the same code path), sandbox policy across
  sandboxes, and harness native settings (tool_disclosure).
- Removed from deployment: explicit_network, inference_settings,
  execution_settings, observability, openclaw_interfaces,
  hermes_interfaces, and provider_definitions lifecycles.
- Removed from fabric_deployment: eight harnesses' apply, reapply, and
  export checks; OpenClaw and Pi remain. Every harness example compiles,
  passes the Fabric planner, and exports in the SDK's tests.
- The unsupported ownership annotation check moves to nemoclaw-cli: the
  schema rejects it, naming the field, before the saved intent or state
  is read, so it needs no deployment.

Whether the fake gateway accepts and reads back each variant unchanged
is left to the openshell and fabric contract tests in #12880.

Part of #12882.
Stacked on #12885. Part of #12876 (finding 1 in [the overlap
map](#12876 (comment))).

## Failure

About 35 system tests repeated the generic lifecycle for one
configuration variant each, about 30 s apiece on CI. The lifecycle
checks that export reproduces the document, an unchanged reapply is a
no-op, and destroy cleans up. Most variants differ only in what they
compile to, which unit tests already cover. Export's consistency check
could not run without OpenTofu.

## Decision

- **Pure export check:** export's consistency check is now a pure
function, `exported`. A new unit test compiles every example, echoes its
targets back as provider observations, and checks three things: the
saved document exports unchanged, a drifted sandbox image or provider
endpoint stops the export, and a missing observation stops it too.
- **One system lifecycle per drift kind:**
- Web search registrations: Tavily only, since Brave uses the same code
path.
  - Sandbox policy across sandboxes: `separate_agent_sandboxes`.
  - Harness native settings: `tool_disclosure`.
- The external-gateway lifecycle (`sdk_apply_cli_export…`) and the
remote Podman lifecycles remain.
- **Removed system tests:**
- From `deployment`: `explicit_network`, `inference_settings`,
`execution_settings`, `observability`, `openclaw_interfaces`,
`hermes_interfaces`, and `provider_definitions`.
- From `fabric_deployment`: the apply, reapply, and export checks for
eight harnesses. OpenClaw and Pi remain, and every harness's example
compiles, passes the Fabric planner, and exports in the SDK's tests.
- **Moved:** the unsupported ownership annotation check now lives in
`nemoclaw-cli`. The schema rejects the annotation, naming its field,
before the CLI reads saved intent or state, so the check needs no
deployment.
- **Known gap until #12880:** nothing at the system layer now checks
that the fake gateway accepts and reads back each removed variant
unchanged. The `openshell` and `fabric` contract tests will own that.

## Validation

- **New tests:** the export test covers more than 20 examples in 0.3 s.
The CLI annotation test passes in 0.05 s.
- **Remaining lifecycles:** locally against a rebuilt bundle, the
remaining `deployment` lifecycles and all `fabric_deployment` tests
pass, 8 tests in 39 s.
- **Checks:** `nemoclaw-sdk`, `nemoclaw-cli`, and `nemoclaw-e2e` clippy
at `-D warnings` and fmt are clean.
…t tests

#12906 removed system lifecycles that were the only check that the fake
gateway accepts each configuration variant's OpenShell resources and
reads them back unchanged. Those checks belong to the openshell
provider's contract tests, which did not exist: its types were tested
only from nemoclaw-e2e, and the provider crate could not use the fake
gateway because nemoclaw-e2e depends on the providers.

- nemoclaw-test-fixtures now holds the fake OpenShell gateway and the
  owned OpenTofu workspace; nemoclaw-e2e re-exports them.
- openshell-provider's contract binary applies one fixture per example
  with an external gateway through OpenTofu, checks that the next plan
  changes no managed resource, and tears down as the SDK does: every
  sandbox, registration, and profile is removed and the workspace kept.
  A coverage test requires a test per fixture and a fixture per type.
- The fixtures are the OpenShell resources the SDK compiles for each
  example. nemoclaw-e2e fails when they differ, and
  NEMOCLAW_REGENERATE_FIXTURES=1 rewrites them.
- The lifecycle profile selects the contract binary.

Part of #12880.
…ntract tests

opentofu_openshell and standalone_openshell in nemoclaw-e2e exercised
only the openshell provider, but generated their configuration with the
SDK and ran beside the system scenarios.

- The standalone tests now apply a static authored configuration from
  tests/contract/standalone; only the Pi configuration test, which also
  needs the fabric provider, stays in nemoclaw-e2e as standalone_pi until
  the fabric provider has contract tests.
- Gateway capability tests use the local example's contract fixture
  instead of compiling the reference graph: an incompatible gateway and a
  failed read stop planning, a failed object read stops the next plan,
  and a saved plan observes the gateway again, all without changing the
  gateway or managed state. Teardown is covered by every fixture.
- The client-level capability observation test and the bootstrap
  dependency test move unchanged.

Part of #12880.
# Conflicts:
#	crates/openshell-provider/tests/contract/standalone.rs
Fabric types were exercised through OpenTofu only by SDK-generated
system scenarios and one Pi test in nemoclaw-e2e that needed both the
openshell and fabric providers.

fabric-provider's contract binary, using the shared fake gateway:

- fabric_agent_configuration: the Pi test moves here unchanged, applying
  a static fixture. Invalid configurations fail at their field without
  the value; updates keep the sandbox; a stopped host is reconfigured; a
  lost reply is not retried.
- fabric_sandbox_readiness: the configured agent reads ready, failed
  health reads not ready without failing apply or writing to the
  sandbox, and recovered health reads ready again.
- fabric_capabilities: a fake Docker engine serves an image declaring a
  Fabric catalog. A compatible image reports its runtime binaries; another
  platform, or a read policy without the runtime's paths, is unsupported;
  a missing image is unknown; the engine is only read.
- A coverage test requires a contract test for every Fabric type.

nemoclaw-e2e no longer tests a single provider type, and the lifecycle
profile selects the Fabric contract binary.

Part of #12880.
# Conflicts:
#	crates/nemoclaw-e2e/tests/opentofu_openshell.rs
…ontract tests

The nemoclaw provider's OpenTofu tests sat in nemoclaw-e2e beside the
system scenarios, selected by name patterns, and nothing checked that
every type had one.

- nemoclaw-provider gets a contract binary. service_storage,
  kubernetes_hcl, runtime_image, vllm_runtime, gateway_readiness, and
  discovery move into it unchanged.
- every_type_has_a_contract_test lists each resource and data source the
  provider serves and fails for one without a contract test. Its
  ELSEWHERE list records the five still tested only elsewhere and why,
  and fails when one of them gains a contract test.
- provider_protocol, service_capacity, and service_readiness stay in
  nemoclaw-e2e: they need that crate's fixture provider and SSH fixture
  binaries.
- The lifecycle profile selects all three providers' contract binaries.

Part of #12879.
@cv cv added the area: e2e End-to-end tests, nightly failures, or validation infrastructure label Oct 9, 2026
@cv cv added the v1 NemoClaw v1 branch label Oct 9, 2026
Base automatically changed from test/fabric-contract to v1 October 9, 2026 22:49
# Conflicts:
#	.config/nextest.toml
#	crates/nemoclaw-e2e/tests/main.rs
@github-actions

Copy link
Copy Markdown
Contributor

@cv
cv merged commit c91a37c into v1 Oct 10, 2026
@cv
cv deleted the test/nemoclaw-contract branch October 10, 2026 04:03
@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: e2e End-to-end tests, nightly failures, or validation infrastructure 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