Skip to content

perf(tests): consolidate lifecycle coverage at faster integration boundaries - #13373

Merged
cv merged 11 commits into
v1from
perf/lifecycle-test-coverage
Oct 18, 2026
Merged

cv merged 11 commits into
v1from
perf/lifecycle-test-coverage

Conversation

@kaofelix

@kaofelix kaofelix commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Why

Several bundle/system scenarios repeated SDK rules, diagnostic variants, or
setup already covered by smaller integration tests. Those repetitions launched
the CLI, OpenTofu and providers even when the additional inputs did not exercise
a different integration mechanism.

This PR changes test placement and fixture reuse, not runtime behavior. It does
not replace the suite with mocks or remove the native recovery cases.

Approach

Workflow:

  1. Map its assertions to the smallest boundary that can establish the promise.
  2. Reuse actual collaborators where practical: SDK operations and persistence,
    subprocess JSON capture, CLI rendering, or OpenTofu/provider contracts.
  3. Add characterization only where a relevant promise lacks coverage.
  4. Use targeted temporary regressions where needed to check sensitivity, then
    restore production code.
  5. Retire the duplicate system variation and run the affected native checks.
  6. Measure the complete affected scenario with matched before/after runs.
    Where timings varied, use one compiled test set and alternating A/B runs.

Coverage helped select candidates; overlapping execution was not treated as
proof that assertions were redundant.

Cases

Case Faster coverage / consolidation Native evidence retained
Repeated completed destroy Public SDK test checks destroy and preview outcomes, retained storage, unchanged files, and no new plan/apply Other Helm teardown and recovery scenarios
Unbound Helm release record Existing SDK HTTP tests cover release-record-only cleanup refusal; provider contracts cover teardown/refusal/retry/retention Helm binding-loss and interrupted-state recovery
Missing ownership receipt OpenTofu/provider contract refuses planning, preserves bindings/lineage/objects, sends no writes, and resumes cleanup after restoration Remaining Helm recovery; malformed-receipt matrix stays in SDK tests
Credentialed inference lifecycle Three setup/teardown cycles become one, keeping no-probe, unchanged-reapply, state-secrecy, credential-free export/destroy and fresh-reference checks The combined flow still runs the bundle and providers
Image-label prechecks Fast host-image matrix explicitly covers missing backend labels; native CLI attempts drop from 12 to 4 One rejection per backend, validation after pull before allocation, incompatible bound-image teardown
Pi failure output formats Fast CLI rendering composes SDK errors, mutation progress, text/JSON output and exit-code handling One native JSON failure checks actual diagnostic production, privacy, retained resources and cleanup
Inert-credential repetition Fabric producer and SDK child-process tests preserve context with an unrelated credential Native short-secret withholding, code collisions, privacy and recovery
Sandbox-change refusal matrix Public SDK test checks remove/image/policy edits through plan/apply, typed errors, state/intent preservation and no mutation Coordinated sandbox/model-runtime refusal, CLI reporting, export preservation and observation-failure checks

Distinct sandbox-startup reasons, native deposed-resource cleanup, Helm binding
restoration and after-pull ordering checks remain.

Sensitivity probes detected skipped completed-state guards, cached-state
success after receipt loss, accepting missing backend labels, omitted text
diagnostics, excessive diagnostic withholding and saving rejected intent.
All temporary production mutations and benchmark instrumentation were removed.

Local measurements

These are local scenario measurements, excluding compilation. They are not
additive estimates of total PR or parallel CI savings
.

Measurement Before After
Credentialed inference: three fixtures vs one 42.2s 22.9–28.3s
Pi full scenario: image-label prechecks change 108.0s 89.9s
Ollama full scenario: image-label prechecks change 142.1s 124.1s
Receipt scenario: bundled vs provider contract, serial samples 12.1–12.4s 1.6–1.7s
Pi full failure scenario: two output-format deployments vs one 12.239s mean 6.000s mean
Full redaction/recovery scenario: three failed applies vs two 22.434s mean 19.035s mean
Full Pi lifecycle: generic refusal matrix moved to SDK 72.946s mean 62.461s mean

For the image-label change, an earlier uncontrolled full run was slower despite
a faster isolated benchmark. We did not dismiss that as noise: we froze the
revision/bundle, timed phases inside the full runs, discarded warm-ups and
ran ABBA comparisons. The measured full-scenario reduction then reconciled with
the precheck reduction; the remaining work was essentially unchanged. The
exact cause of the earlier uncontrolled result is unknown.

Replacement SDK/process/render checks run in milliseconds to under a second in
isolation. Measurements used a busy two-CPU Linux host and small samples;
The CI comparison below measures the updated branch against its matching base.

Validation

  • Linux cargo ci --full passed on 1be97a44e9: formatting, Clippy,
    workspace build, 1,544 ordinary tests, doctests, generated schema checks,
    a fresh bundle build, and 145 contract/system lifecycle tests.
  • CI on the same head
    passed on Linux AMD64/ARM64, macOS ARM64, and Windows AMD64. The Linux
    Docker and kind live suites also passed.
  • Focused characterization, sensitivity probes, native scenarios, and whitespace
    checks passed during the individual optimizations. Temporary production
    mutations and benchmark instrumentation were removed.
  • The scripted SDK fixture is Unix-only; all-platform state rules and native
    coordinated-change coverage remain.
  • Compiler-wrapper variables were cleared only for local validation jobs because
    a stale user-level sccache shim broke nested Cargo metadata commands.
    No global compiler configuration was changed.

CI results and scope

Compared v1 at 7499ec2e40 with this PR at 1be97a44e9. The PR run records that exact base revision. All platform checks and the Linux live suites passed.

Platform Lifecycle wall: base → PR Wall reduction Summed lifecycle time
Linux ARM64 106.5s → 90.5s 15.1% 10.3% less
Linux AMD64 127.2s → 124.4s 2.2% 0.3% more
macOS ARM64 141.1s → 119.1s 15.6% 20.5% less
Windows AMD64 130.2s → 116.2s 10.8% 11.6% less

Wall time is the slowest lifecycle partition from JUnit, excluding compilation and job setup. Summed time adds testcase durations across partitions; it is not CPU time or elapsed CI time.

These are observations from one matched pair, not an isolated estimate of the PR's speedup. An earlier comparison against an older base had mixed platform results. Timings also moved outside the changed scenarios. Linux AMD64 is particularly inconclusive: its summed lifecycle time was flat and ordinary-test wall time rose from 31.2s to 38.8s.

The Rust workflow finished in 11m18s versus 12m20s. Bundle-build duration also changed substantially, so we do not attribute the full 62-second reduction to these test changes.

How much of the suite did this target?

On Linux and macOS, the work touches 10 original bundle E2E scenarios out of 55, representing approximately 19–20% of that binary's baseline summed test time, or 17–18% of all lifecycle test time. On Windows, it touches 7 of 43 E2E scenarios, representing 19% of E2E time and 16% of lifecycle time; the three Helm cases were Unix-only.

This measures the containing scenarios, including work we retained. It is not a code-coverage percentage, nor does it mean all that time was removable. Separate live Docker/kind jobs and build time are outside this footprint.

Moving coverage down versus consolidating E2E setup

Technique Change Effect on E2E entries
Retire whole E2E scenarios with coverage below the bundle boundary Completed destroy goes to public-SDK coverage; receipt loss goes to an OpenTofu/provider contract; unbound-release refusal relies on existing SDK/provider coverage −3 on Unix
Move input/output variants down while retaining native witnesses Image-label variants, Pi output formats, inert-credential context, and individual sandbox-edit refusals use smaller tests No entry-count change
Consolidate setup within E2E Three credentialed apply/export/destroy scenarios become one native lifecycle with the intended assertions retained 3 → 1 on all platforms

Total E2E entries become 55 → 50 on Unix and 43 → 41 on Windows. Thus, five fewer Unix E2E entries does not mean five scenarios moved to lower-level tests: three were retired that way, and two disappeared through fixture consolidation.

Entry counts also understate the variant reductions: image-label CLI checks fall from 12 to 4 across the two backends, sandbox-refusal CLI checks from 8 to 2, inert-credential failed applies from 3 to 2, and the Pi output-format test uses one deployment instead of two.

The narrower tests do not establish all provider/host behavior. Native coordinated-change refusal, mutation ordering, diagnostic production, privacy, state preservation, recovery, and cleanup checks remain where those boundaries matter. About 80% of baseline E2E testcase time lies outside the selected scenarios, but that is remaining work to examine—not an estimate of recoverable savings.

What limits overall PR latency?

E2E count and total PR latency are different measures. In this run,
Docs Validate
was the last required check: its job took 12m07s and finished about
51 seconds after the Rust workflow. The later PR preview was not required.

Docs validation spent 4m11s in tool setup, then 7m25s compiling the Rust
documentation tool
before about 24s running the checks. Its dedicated
Rust dependency cache reported a miss. The matched base had a similar 12m10s
validation job, so this was not introduced by the E2E changes.

Within Rust CI, the observed critical path ran through the
Windows bundle job
(7m31s) and its slowest lifecycle job (2m38s, including setup and artifact
handling). The bundle job included 4m58s of release compilation and about
49s of additional dev-profile compilation, despite a release dependency-cache
hit. Build/test and bundle jobs run in parallel; their durations cannot be added.

With Docs unchanged, making only the bundle E2Es faster would not have advanced
the last required check in this run. Docs tool/cache reuse and Windows release
code generation are therefore stronger next investigations for merge-ready
latency. Linux live-suite preparation is another nearby parallel path.

Lifecycle jobs still account for about 25% of summed Rust runner-job time.
Reducing their work can improve runner usage and test maintenance even when
another job limits latency. No cache, build-profile, or workflow changes are
included in this PR.

Exercise completed destroy and preview through the public SDK with scripted OpenTofu. Assert retained storage, unchanged state, and no new plan or apply. Remove the dedicated Helm E2E and its unused event recorder; keep native recovery and retention scenarios.

Mutation checks detected regressions in both completed-state guard paths. On ed72ab9, 15 focused SDK tests and formatting passed. Before that update, 1531 ordinary tests, 11 remaining native Helm cases, and workspace Clippy passed. Full CI was not rerun after the update.
Replace the bundled receipt scenario with an OpenTofu/provider contract that checks refusal, unchanged bindings and objects, and cleanup after restoration. Keep malformed-receipt variants in the SDK suite. Remove the release-record E2E already protected by SDK and provider integration tests, along with unused fixture support.

Mutation probes detected unsafe cached-state fallback and premature issuer cleanup. Serialized receipt-case execution fell from 12.1-12.4s to 1.6-1.7s; parallel measurements did not establish a CI wall-time gain.

Validation: 1541 ordinary tests, 9 remaining Helm E2Es, and 3 Kubernetes provider contracts passed, plus workspace Clippy with warnings denied, formatting, and whitespace checks. Full cargo ci --full remains pending before push.
Combine apply/reapply, export and credential-free teardown checks in one native deployment. Preserve probe, state, credential-reference, initialization-count and cleanup assertions while removing two repeated setup/teardown fixtures.

Observed serialized execution fell from 42.2s across three cases to 22.9-28.3s for the combined case; this is not a full-CI wall-time measurement.

Validation: all four native export tests and 1530 ordinary workspace tests passed, plus workspace Clippy with warnings denied, formatting and whitespace checks. Full cargo ci --full remains pending before push.
Add explicit missing-backend coverage to the read-only image matrix for both model types. Keep one native private-value rejection per backend through plan and apply, reducing pre-allocation CLI invocations from twelve to four. Preserve after-pull and bound-image teardown checks.

A mutation accepting missing backend labels was detected. Frozen full-scenario ABBA measurements (two samples per variant and scenario) showed Pi mean 108.0s to 89.9s and Ollama 142.1s to 124.1s, with the reduction accounted for inside pre-allocation. This does not establish a full-CI parallel speedup.

Validation: all measured native runs and 1530 ordinary tests passed, plus the image contract, after-pull cases, workspace Clippy with warnings denied, formatting and whitespace checks. Temporary timing instrumentation was removed and the pending patch restored exactly. Full cargo ci --full remains pending before push.
Keep one native JSON failure and cleanup scenario. Check safe diagnostic context and mutation facts in both output formats at the CLI rendering boundary, retaining native privacy and resource-state assertions.

A controlled omission of the text diagnostic was detected by the fast test and restored. Isolated ABBA measurements showed the native case falling from a 12.239s mean to 6.000s, plus a roughly 15ms rendering check; no full-CI speedup is claimed.

Validation: 28 CLI formatting/output-mode checks, 1531 ordinary workspace tests, and isolated neighboring native failure scenarios passed, plus workspace Clippy with warnings denied, formatting and whitespace checks. Full cargo ci --full remains pending before push.
Cover named lifecycle diagnostics in the Fabric producer and preserve them through SDK JSON capture with an unrelated credential. Remove the repeated inert-credential apply from the native CLI scenario while retaining short-secret withholding, code collisions, privacy, state preservation, and recovery.

Matched full-scenario runs averaged 22.434s before and 19.035s after. The process check takes about 15ms. A blanket-withholding mutation was detected and restored.

Validation: 1,532 ordinary tests, 27 focused checks, native scenarios, Clippy with warnings denied, formatting, and whitespace checks passed. The ordinary rerun disabled a broken compiler wrapper for that job only. Windows execution and cargo ci --full remain pending before push.
Cover removal, image changes, and policy changes through the public SDK over scripted OpenTofu. Preserve typed refusal, saved intent/state, and no-mutation assertions; keep the native combined sandbox/runtime refusal, export, and observation-failure checks.

A save-rejected-intent mutation was detected. Matched full Pi lifecycle means fell from 72.946s to 62.461s; the SDK matrix takes 0.34-0.84s. No runtime code changed.

Validation: 1,533 ordinary tests, focused SDK tests, native A/B scenarios, Clippy with warnings denied, formatting and whitespace checks passed. Full cargo ci --full remains required before push.
@copy-pr-bot

copy-pr-bot Bot commented Oct 16, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@github-actions

Copy link
Copy Markdown
Contributor

@kaofelix kaofelix added the v1 NemoClaw v1 branch label Oct 17, 2026
Preserve consolidated lifecycle cases while adopting Fabric control diagnostics, sandbox replacement on agent changes, the additional configuration teardown target, and unlabeled policy grants. Keep short-secret and diagnostic-code collision coverage using start_failed.
Fabric no longer supplies the agent readiness data source. Stop fabricating that observation in the scripted initial apply; keep the successful public apply, generation-bound state, refusal matrix, preservation checks and permitted-edit control.

The stale fixture failed plan validation after merging v1. The updated public SDK admission test passes.
@kaofelix
kaofelix marked this pull request as ready for review October 18, 2026 13:28
kaofelix and others added 2 commits October 18, 2026 13:33
Preserve the consolidated credentialed lifecycle instead of restoring its retired E2E fixtures. Carry upstream workspace deletion into its destroy preview and cleanup assertions, while retaining the newer configuration, Kubernetes and authentication coverage from v1.
@cv

cv commented Oct 18, 2026 •

Copy link
Copy Markdown
Collaborator

Merged current v1 into this branch (a clean merge; the three new v1 commits don't touch these files) and revalidated: cargo ci passes locally, with 1,593 unit tests and 149 lifecycle tests. Auto-merge is on.

Sorry for the noise: this was briefly closed by mistake while I tried to recreate it on another branch, before I noticed this branch is in the main repository and could be updated directly.

@cv cv closed this Oct 18, 2026
@cv cv reopened this Oct 18, 2026
@cv
cv enabled auto-merge (squash) October 18, 2026 14:39
@cv
cv merged commit cc02a45 into v1 Oct 18, 2026
@cv
cv deleted the perf/lifecycle-test-coverage branch October 18, 2026 14:54
gaveezy added a commit that referenced this pull request Oct 19, 2026
Bring the branch up to date with 108 v1 commits, including the provider
reorganization (#13131), the key-authenticated HTTP API integration
(#13403), and the web search sandbox variable (#13401).

Resolutions:

- config/integrations.rs: keep v1's API integration and web search
  sandboxEnv. The API key, the web search key, and the resolved web
  search key are SecretRef, because each holds the credential itself.
- config/validation.rs: validate the API integration key as a SecretRef;
  the credential() helper it called no longer exists.
- config/schema/validation.rs: keep v1's sandboxEnv rule for webSearch
  variants beside the SecretRef and FileRef env rules.
- kubernetes/mod.rs: keep v1's boxed ManagedKubernetes; its kubeconfig
  is a FileRef.
- nemoclaw-e2e deployment.rs: take v1's removal of the two inference
  credential tests. #13373 folded them into the export_observations.rs
  test, which now builds its reference as a SecretRef.
- config_kubernetes.rs: keep the new tests from both sides, and add the
  API integration key to the reference-kind test as a secret.
- Regenerate the JSON Schema and the configuration reference.

No other v1 field used Credential; the Fabric model provider and driver
configuration changes add none.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@wscurran wscurran added area: e2e End-to-end tests, nightly failures, or validation infrastructure chore Build, CI, dependency, or tooling maintenance 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: e2e End-to-end tests, nightly failures, or validation infrastructure area: security Security controls, permissions, secrets, or hardening chore Build, CI, dependency, or tooling maintenance v1 NemoClaw v1 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants