Repository navigation
test(openshell): apply every example's OpenShell resources in contract tests - #12908
Merged
Merged
Conversation
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
# Conflicts: # crates/nemoclaw-e2e/tests/opentofu_openshell.rs
cv
enabled auto-merge (squash)
October 9, 2026 18:51
Contributor
cv
added a commit
that referenced
this pull request
Oct 9, 2026
…#12913) Stacked on #12908. Closes #12880 together with it. ## Failure Fabric types were exercised through OpenTofu only by SDK-generated system scenarios, and by one Pi test in `nemoclaw-e2e` that needed both the `openshell` and `fabric` providers. Nothing checked each Fabric type on its own, and `fabric_capabilities` had no OpenTofu test at all. ## Decision `fabric-provider` gets a `contract` test binary that uses the shared fake gateway from #12908. - **`fabric_agent_configuration`:** the Pi test moves here unchanged and applies a static fixture. It checks four things: - An invalid configuration fails at its field without repeating 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`:** this uses the `config_json` and `filesystem_read` inputs from #12910. A fake Docker engine serves an image that declares a Fabric catalog. - A compatible image reports its runtime binaries. - Another platform is unsupported, and so is a read policy without the runtime's paths. - A missing image is unknown. - The engine is only read. - **Coverage:** a test requires a contract test for every Fabric type. - **`nemoclaw-e2e`:** no longer tests a single provider type. The unused `openshell_resources.tf` template is removed. - **CI:** the lifecycle profile selects the Fabric contract binary. - **Docs:** `docs/contributing/integration-tests.md` describes the Fabric contract tests. ## Validation - **Lifecycle profile:** locally, both contract binaries pass through the lifecycle profile: 50 tests in 41 s wall. - **Lint:** workspace clippy at `-D warnings` and fmt are clean. - **Docs tests:** the `nemoclaw-build` docs tests pass.
This was referenced Oct 10, 2026
cv
added a commit
that referenced
this pull request
Oct 12, 2026
#13042) Fixes #12530. ## Failure `lifecycle()` in `crates/nemoclaw-e2e/tests/deployment.rs` set up a deployment, ran the plan, apply, export, reapply, and destroy checks, and chose drift checks by inspecting each test's document: web search registrations when a search integration was bound, tool policies with more than one sandbox, native settings when the inference API, agent authentication, harness execution, or harness settings were set, and network policy drift, with its own setup change, when the policy was explicit. A test's body did not show which of these it ran. ## Decision `Lifecycle::start` owns the setup: the fixture gateway, image engine, secrets, progress recording, and deployment. The checks are named methods: `apply`, `export_and_reapply_unchanged`, `assert_search_registration_drift`, `assert_tool_policy_drift`, `assert_native_settings_drift`, and `destroy`. Each test calls the checks it exercises and asserts its own effect count, and each fault injection is still undone inside the check that makes it. Since #12885 kept one system lifecycle per drift kind (#12906), no test has an explicit network policy, so the policy setup change and drift check are removed rather than kept unreachable. Lower layers cover explicit policies: the `openshell` contract tests apply the resources compiled from `explicit-policy.yaml` and read them back unchanged (#12908), `explicit_policy_reaches_the_gateway_and_detects_drift` checks policy drift in the provider, and `policy_template_markers_remain_literal_in_opentofu_configuration` checks the templated path the setup change wrote. `web_search_cli_export_reapply_and_destroy` and `tool_disclosure_cli_export_reapply_and_drift` are renamed for the drift they check, and `docs/contributing/integration-tests.md` follows. All 24 tests keep their test and ignore attributes, and `Lifecycle` owns the same resources and drops them in the same order. ## Validation - **Each test runs the checks it ran before.** With a marker in each branch of `lifecycle()` on `v1` at 29bb057, `sdk_apply_cli_export…` reached no drift check, `separate_agent_sandboxes…` only tool policies, `tool_disclosure…` only native settings, and `web_search…` only search registrations, with 4, 7, 4, and 6 gateway effects. No test reached the explicit-policy setup or check. The new tests call the same checks and assert the same counts. - **The other assertions moved unchanged.** With `self.` and whitespace removed, the old and new code have the same 39 assertions and 8 fault injections and restores outside the explicit-policy check. The conditional effect count became one assertion per test. - **The deployment suite passes before and after against one bundle.** A single `cargo ci bundle` at 29bb057 served both runs on Linux ARM64: all 24 `deployment::` tests passed before (168 s) and after (174 s). - **`cargo ci` passes on Linux ARM64** (1,377 tests, 127 lifecycle tests). - **CI passes on a fork run.** CI / Bundle passes on Linux ARM64 and AMD64 with both live suites, macOS, and Windows, and every platform's lifecycle shards ran and passed all 24 `deployment::` tests. --- Signed-off-by: Bowen Zhu <[email protected]> Signed-off-by: Bowen Zhu <[email protected]> Co-authored-by: Carlos Villela <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #12880; #12913 is stacked on it.
Failure
#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
openshellprovider's contract tests, which did not exist. Its types were tested only fromnemoclaw-e2e, and the provider crate could not use the fake gateway, becausenemoclaw-e2edepends on the providers.Decision
New fixtures crate:
nemoclaw-test-fixturesholds the fake OpenShell gateway and the owned OpenTofu workspace, so provider crates can use them as development dependencies.nemoclaw-e2ere-exports both, so existing tests are unchanged.Contract binary:
openshell-provider'scontractbinary applies one fixture per example that uses an external gateway (22 fixtures) through pinned OpenTofu, against the fake gateway running the compute driver the fixture requires. For each fixture:Coverage test: every fixture file must have a test, and every
openshelltype must have a fixture.Generated fixtures: the fixtures are the OpenShell resources the SDK compiles for each example. Fabric capability references are replaced with the runtime bindings the fake images declare, and the protection against accidental destroy is dropped for teardown.
nemoclaw-e2e's deterministicopenshell_contract_fixturestest fails when the fixtures differ from what the SDK compiles, andNEMOCLAW_REGENERATE_FIXTURES=1rewrites them. Examples whose credentials are read from a managed service's container are excluded, because that needs Docker.CI: the lifecycle profile selects the contract binary, and the OpenShell provider's provider binary is already in the lifecycle archive.
Docs:
docs/contributing/integration-tests.mddescribes the contract tests and how to regenerate fixtures.Moved tests:
opentofu_openshellandstandalone_openshellmove into the contract binary.tests/contract/standalone.fabricprovider, so it stays innemoclaw-e2easstandalone_piuntil that provider has contract tests.Validation
standalone_pipass locally in 38 s wall. The contract tests are 22 fixtures, the coverage test, 3 capability tests, and 20 standalone tests.openshell_contract_fixturestest passes in 0.1 s.-D warnings, fmt, and thenemoclaw-builddocs tests are clean.