test: prevent declarative config mirrors - #6718
Conversation
<!-- markdownlint-disable MD041 --> ## Summary E2E support tests now derive manifest, matrix, and dispatch expectations from the production registries and workflow planner instead of copying the current inventory. Focused malformed-selector, secret-bearing-job, artifact, runner, and unsupported-target behavior remains explicit. ## Related Issue Part of #6708. ## Changes - Remove literal manifest count, target-field, and observability snapshots. - Verify every typed target resolves to a validated manifest path. - Replace the hard-coded live matrix with supported-target, uniqueness, runner-resolution, unsupported-selection, and CLI parity behavior. - Collapse hundreds of repeated selector assertions into registry-derived coverage while retaining invalid and mixed selector cases. - Replace exact workflow target-to-job literals with referential-integrity checks against actual workflow jobs. ## Type of Change - [x] Code change (feature, bug fix, or refactor) - [ ] Code change with doc updates - [ ] Doc only (prose changes, no code sample modifications) - [ ] Doc only (includes code sample changes) ## Quality Gates - [x] Tests added or updated for changed behavior - [ ] Existing tests cover changed behavior — justification: - [ ] Tests not applicable — justification: - [ ] Docs updated for user-facing behavior changes - [x] Docs not applicable — justification: Test methodology changes only; E2E targets, workflows, commands, and runtime behavior are unchanged. - [x] Sensitive paths changed (security, policy, credentials, preflight, onboarding, inference, runner, sandbox, or messaging) - [x] Sensitive-path review completed or maintainer-approved waiver recorded — reviewer/approval link/justification: Test-only cleanup preserves malformed selector rejection, secret-bearing job gating, artifact-path rejection, runner resolution, and unsupported-target evidence. - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Verification - [x] PR description includes the DCO sign-off declaration and every commit appears as `Verified` in GitHub - [x] Normal `pre-commit`, `commit-msg`, and `pre-push` hooks passed, or `npm run check:diff` passed when hooks were skipped or unavailable - [x] Targeted behavior tests pass for the current change set, or tests are marked not applicable above — `vitest --project e2e-support`: 3 files and 30 tests passed; `npm run test:titles:check` passed. - [ ] Applicable broad gate passed — `npm test` for broad runtime/test-harness changes; `npm run check` for repo-wide validation/coverage changes — command/result: - [x] Quality Gates section completed with required justifications or waivers - [x] No secrets, API keys, or credentials committed - [ ] `npm run docs` builds without warnings (doc changes only) - [ ] Doc pages follow the [style guide](https://github.com/NVIDIA/NemoClaw/blob/main/docs/CONTRIBUTING.md) (doc changes only) - [ ] New doc pages include SPDX header and frontmatter (new pages only) --- Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThis PR replaces declarative source-shape mirrors with behavioral contracts, expands AST-based scanning and exception enforcement, refocuses workflow and policy tests on observable behavior, and adds installer-ref coverage with fixture-validation helpers. ChangesBehavioral contract migration
Estimated code review effort: 5 (Critical) | ~120 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage remains at 96%, unchanged from the TypeScript / code-coverage/cliThe overall coverage in the Show a code coverage summary of the most impacted files.
Updated |
E2E Advisor RecommendationRequired E2E: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
|
PR Review Advisor — No blocking findingsMerge posture: No blocking advisor findings This is an automated review. Required findings need action before merge. Warnings and optional suggestions do not require a response or follow-up. A human maintainer makes the final merge decision. |
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
test/pr-e2e-gate-workflow.test.ts (1)
166-198: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winDuplicate step-execution scaffolding between
runStartStepandrunCancelStep.Both helpers repeat the same mkdtemp/fake-
node/spawnSync/cleanup pattern, differing only in the target step, env vars, and command args. Consider extracting a sharedrunWorkflowStep(job, stepName, env)helper to avoid future drift between the two.♻️ Sketch of a shared helper
+function runWorkflowStep(job: WorkflowJob, stepName: string, extraEnv: Record<string, string>) { + const target = step(job, stepName); + const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "nemoclaw-pr-e2e-gate-step-")); + const binDir = path.join(tempDir, "bin"); + const argumentsPath = path.join(tempDir, "node-arguments"); + fs.mkdirSync(binDir); + fs.writeFileSync( + path.join(binDir, "node"), + '#!/usr/bin/env bash\nset -euo pipefail\nprintf \'%s\\0\' "$@" > "$FAKE_NODE_ARGUMENTS"\n', + { mode: 0o755 }, + ); + try { + const result = spawnSync("bash", ["-e", "-o", "pipefail", "-c", target.run!], { + encoding: "utf8", + env: { ...process.env, FAKE_NODE_ARGUMENTS: argumentsPath, PATH: `${binDir}:${process.env.PATH ?? ""}`, ...extraEnv }, + timeout: 5_000, + }); + return { arguments: fs.readFileSync(argumentsPath, "utf8").split("\0").slice(0, -1), result }; + } finally { + fs.rmSync(tempDir, { recursive: true, force: true }); + } +}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/pr-e2e-gate-workflow.test.ts` around lines 166 - 198, Extract the duplicated temporary-directory, fake-node setup, spawnSync execution, argument capture, and cleanup from runStartStep and runCancelStep into a shared runWorkflowStep(job, stepName, env) helper. Update both wrappers to select their workflow step and provide only their step-specific environment or arguments, while preserving the existing results and cleanup behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/cloudflared-update-check-workflow.test.ts`:
- Around line 123-131: Extend the test “keeps the update check read-only with a
credential-free checkout” to locate the step named “Compare reviewed pin with
the latest upstream release” and assert its run command remains “bash
scripts/checks/check-cloudflared-update.sh”. Preserve the existing permissions
and checkout assertions.
In `@test/macos-e2e-workflow-boundary.test.ts`:
- Around line 70-81: Extend the “runs final-destroy…” test around
readMacosWorkflow and the macos-docker-final-destroy job to restore behavioral
assertions for final-destroy cleanup wiring and failure-only log uploads. Keep
the existing runner, permissions, action SHA, and Docker version checks, and
verify uploads are conditional on failure and publish the expected log paths.
---
Nitpick comments:
In `@test/pr-e2e-gate-workflow.test.ts`:
- Around line 166-198: Extract the duplicated temporary-directory, fake-node
setup, spawnSync execution, argument capture, and cleanup from runStartStep and
runCancelStep into a shared runWorkflowStep(job, stepName, env) helper. Update
both wrappers to select their workflow step and provide only their step-specific
environment or arguments, while preserving the existing results and cleanup
behavior.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: c6bb852a-fa7c-46de-8114-861205b50081
📒 Files selected for processing (62)
.pre-commit-config.yamlCONTRIBUTING.mdci/source-shape-test-budget.jsonci/test-file-size-budget.jsonscripts/checks/vitest-project-overlap.tsscripts/find-source-shape-tests.tssrc/lib/actions/sandbox/mcp-bridge-input-validation.test.tssrc/lib/actions/sandbox/mcp-bridge-runtime-validation.test.tssrc/lib/agent/base-image-hermes.test.tssrc/lib/onboard/inference-providers/compatible-endpoint-gateway-route.test.tstest/brev-nightly-workflow.test.tstest/cloudflared-update-check-workflow.test.tstest/code-scanning-workflow.test.tstest/dcode-base-image-workflow.test.tstest/dcode-start-keepalive.test.tstest/e2e-advisor.test.tstest/e2e-fixture-dependency-review.test.tstest/e2e-release-gate-workflow.test.tstest/e2e/live/hermes-e2e.test.tstest/e2e/support/e2e-expected-state.test.tstest/e2e/support/e2e-live-project-config.test.tstest/e2e/support/e2e-live-registry-discovery.test.tstest/e2e/support/e2e-live-skip-name-contract.test.tstest/e2e/support/e2e-manifests.test.tstest/e2e/support/e2e-matrix.test.tstest/e2e/support/e2e-registry.test.tstest/e2e/support/e2e-report-to-pr-workflow-boundary.test.tstest/e2e/support/e2e-workflow.test.tstest/e2e/support/mcp-workflow-boundary.test.tstest/e2e/support/mcp-workflow-compatibility.test.tstest/e2e/support/require-fixture.tstest/e2e/support/spark-install-workflow-boundary.test.tstest/e2e/support/tunnel-lifecycle-workflow-boundary.test.tstest/fetch-guard-patch-regression.test.tstest/hermes-mcp-config-transaction.test.tstest/hermes-sandbox-workflow.test.tstest/inference-options-docs.test.tstest/install-clone-ref.test.tstest/install-preflight.test.tstest/label-merged-pr-release-target-workflow.test.tstest/macos-e2e-workflow-boundary.test.tstest/mcp-openshell-workflow.test.tstest/openclaw-dependency-review.test.tstest/openclaw-lifecycle-policy.test.tstest/openclaw-real-patched-dist-harness.test.tstest/plugin-vitest-project.test.tstest/pr-e2e-gate-workflow.test.tstest/pr-review-advisor-workflow-boundary.test.tstest/pr-workflow-contract.test.tstest/regression-e2e-workflow.test.tstest/repro-4538-raw-doctor-perms.test.tstest/repro-5978-policy-denial-hint.test.tstest/runner.test.tstest/source-shape-scanner.test.tstest/test-boundary-guards.test.tstest/validate-blueprint.test.tstest/vitest-coverage-thresholds.test.tstest/vitest-developer-feedback.test.tstest/vitest-state-isolation.test.tstest/vitest-temp-root.test.tstest/vitest-watch-triggers.test.tsvitest.config.ts
💤 Files with no reviewable changes (3)
- test/hermes-sandbox-workflow.test.ts
- src/lib/actions/sandbox/mcp-bridge-runtime-validation.test.ts
- test/install-preflight.test.ts
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
test/cloudflared-update-check-workflow.test.ts (1)
19-27: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winRestore workflow trigger coverage.
The replacement contract no longer models or checks
on.schedule/on.workflow_dispatch. A workflow with valid permissions, checkout, and a working script but no schedule or manual trigger could now pass while never running the update check. Keep this reachability contract in an aggregate or behavioral test.As per path instructions, workflow tests should preserve observable execution behavior, not only remaining metadata checks.
Also applies to: 126-138
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/cloudflared-update-check-workflow.test.ts` around lines 19 - 27, Extend the CloudflaredUpdateWorkflow contract and its aggregate or behavioral assertions to model and validate the workflow’s on.schedule and on.workflow_dispatch triggers. Ensure the test rejects workflows lacking both reachable update-check triggers while preserving existing permission, checkout, and script execution checks.Source: Path instructions
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@test/cloudflared-update-check-workflow.test.ts`:
- Around line 19-27: Extend the CloudflaredUpdateWorkflow contract and its
aggregate or behavioral assertions to model and validate the workflow’s
on.schedule and on.workflow_dispatch triggers. Ensure the test rejects workflows
lacking both reachable update-check triggers while preserving existing
permission, checkout, and script execution checks.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 0b5a97cf-ae27-4457-ad6a-57b005bd1c87
📒 Files selected for processing (2)
test/cloudflared-update-check-workflow.test.tstest/macos-e2e-workflow-boundary.test.ts
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Summary
Replace the remaining raw declarative-config, workflow, registry, and package-shape mirrors with production-consumer, mutation, execution, or narrowly reviewed security and compatibility contracts. Extend the source-shape guard so future co-located tests, declarative imports, setup-hook reads, accessor projections, Node assertions, and aliasing bypasses are rejected.
Related Issue
Closes #6708
Changes
securityorcompatibilityannotations for unavoidable direct contracts and lock all 90 reviewed exceptions by file, test title, and category.source-shape:checkacross co-located tests and cover declarative imports, setup hooks, raw accessors, projections, accumulators, assertion aliases, dynamic execution, and duplicate exception identities.CONTRIBUTING.mdand ratchet the legacy installer test-file budget after splitting its new behavior test.Type of Change
Quality Gates
Verification
Verifiedin GitHubpre-commit,commit-msg, andpre-pushhooks passed, ornpm run check:diffpassed when hooks were skipped or unavailablenpm testfor broad runtime/test-harness changes;npm run checkfor repo-wide validation/coverage changes — command/result:npm testpassed 1,446 files and 16,337 tests with 40 intentional skips; config validation, project membership, title style, CLI/plugin typechecks, formatting, test-size, and source-shape checks also passed.npm run docsbuilds without warnings (doc changes only)Signed-off-by: Carlos Villela cvillela@nvidia.com
Summary by CodeRabbit