test(images): harden legacy Docker copy contracts - #7626
Conversation
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
📝 WalkthroughWalkthroughThe Hermes and OpenClaw final-image layout tests now detect Dockerfile ChangesFinal image layout validation
Estimated code review effort: 2 (Simple) | ~10 minutes 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 in commit 354e7de in the TypeScript / code-coverage/cliThe overall coverage in commit 354e7de in the Show a code coverage summary of the most impacted files.
Updated |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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/hermes-final-image-layout.test.ts`:
- Around line 106-110: The hasBuildKitRunMount helper in
test/hermes-final-image-layout.test.ts (lines 106-110) and its counterpart in
test/openclaw-final-image-layout.test.ts (lines 17-21) must detect --mount
anywhere in the RUN option prefix, including after flags such as --network=none;
update the matching logic to parse or accept preceding RUN flags, and add
regression coverage for this layout in both test files.
🪄 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: aec4e65a-451a-478b-9978-aba1d8e6f567
📒 Files selected for processing (2)
test/hermes-final-image-layout.test.tstest/openclaw-final-image-layout.test.ts
PR Review Advisor — No blocking findings reportedAdvisor assessment: No blocking advisor findings reported Model lanes
Nemotron output stays in workflow artifacts and does not change the assessment above. E2E guidanceAdvisory only. E2E / PR Gate selects and runs jobs independently. Recommended E2E: None This automated review informs maintainers. Warnings and suggestions do not require a response. A maintainer decides whether to merge. |
prekshivyas
left a comment
There was a problem hiding this comment.
Blocking review at exact head 6017803eee1341edbe29890d79432e078a14abca:
hasBuildKitRunMount only recognizes --mount when it is the first option after RUN. Docker permits other RUN options first, so RUN --network=none --mount=type=cache ... and a continued RUN --security=sandbox \ --mount=type=secret ... both return false. That lets the legacy-Docker compatibility contract pass while BuildKit-only syntax is present. Update the helper in both test/hermes-final-image-layout.test.ts:106 and test/openclaw-final-image-layout.test.ts:17 to parse the RUN option prefix (or otherwise detect --mount after preceding RUN flags), and add regression coverage for same-line and line-continuation forms with a preceding flag.
The existing targeted suite passes 22/22, but it does not exercise these forms; I reproduced both false negatives directly. Contributor compliance passes (DCO present; commit Verified), E2E evidence is green, and no runtime/security surface changed. The branch is also behind current main and must be refreshed before approval. The Terra advisor failure is an incomplete automated analysis with zero published findings, not a product-test failure.
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
<!-- markdownlint-disable MD041 --> ## Summary <!-- 1-3 plain sentences: what changes and why. Describe before-and-after behavior when it applies. Follow the NemoClaw Writing Guide: https://github.com/NVIDIA/NemoClaw/blob/main/WRITING.md. Do not add unrelated prose cleanup. --> Replace the mutable NodeSource bootstrap in both WSL workflows with checksum-verified official Node.js 22.23.1 archives. This removes the shared installer failure affecting current PR lanes while keeping the runtime on the supported, security-current Node 22 LTS line. ## Changes <!-- List concrete changes. If this adds an abstraction, configuration, fallback, migration, or compatibility path, name its current requirement and consumer, explain why a direct change is insufficient, and identify the test that protects it. --> - Install official Node.js 22.23.1 archives for `x64` and `arm64`, with exact SHA-256 pins, HTTPS-only bounded downloads, temporary-directory cleanup, and fail-closed architecture handling. - Verify each archive before extraction and assert the installed runtime version. - Protect both workflow consumers with `test/platform-vitest-main-workflow.test.ts`, including architecture-to-digest bindings and the repository's approved security source-shape contract. - Address the same WSL bootstrap failure observed on [#7590](https://github.com/NVIDIA/NemoClaw/actions/runs/30312091098/job/90131121904), [#7629](https://github.com/NVIDIA/NemoClaw/actions/runs/30311922489/job/90131122471), [#7603](https://github.com/NVIDIA/NemoClaw/actions/runs/30311696352/job/90131123359), and [#7626](https://github.com/NVIDIA/NemoClaw/actions/runs/30312801807/job/90132378380). ## 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 <!-- Check one tests line and one docs line. Check other lines when applicable. Add every requested justification or approval reference. --> - [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: This changes internal CI bootstrap behavior only; public installation requirements remain 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: Codex security review PASS across all nine categories on exact diff fingerprint `2981cff1a79a0c0acfaf5b0a8e55353809ec472c0565fa1f168996f92107b7ae`. - [ ] Non-success, skipped, or missing CI check accepted by maintainer — check name, approval link, and follow-up issue: ## Documentation Writer Review <!-- Required for code and documentation changes after the changes and applicable validation are complete. Keep one review checkbox and one instance of each visible or hidden field. For Evidence, list changed documentation paths. For documentation-only changes, also state that the writing rules and documentation style were reviewed. For other results, explain why no documentation change is needed or why the review is blocked. For Agent, use a consistent product and surface name, such as Codex Desktop, Codex CLI, Claude Code, or Cursor. After committing all review changes, put `git rev-parse --short HEAD` and `git rev-parse --short HEAD:AGENTS.md` in the hidden metadata below. Rerun the review and refresh that metadata after any new commit. This receipt is advisory during the data-collection pilot. --> - [x] Documentation writer subagent reviewed the completed changes - Result: `no-docs-needed` - Evidence: Exact-head review confirmed the change is limited to CI bootstrap workflows and their executable contract; public Node.js requirements do not change. - Agent: Codex Desktop <!-- docs-review-head-sha: 062779c --> <!-- docs-review-agents-blob-sha: be20a09 --> ## DGX Station Hardware Evidence <!-- Required only when scripts/prepare-dgx-station-host.sh changes. Maintainers must review the linked evidence before approving or merging. This is human-reviewed evidence, not authenticated hardware provenance. Exceptional bypasses use existing repository governance and must be documented on the PR. --> - [ ] Tested on DGX Station - Tested commit: - Station profile/scenario: - Result: - Supporting evidence: ## Verification <!-- Check each applicable item only when supported by the requested evidence. Run targeted tests once per relevant change set and rerun after later edits or hook autofixes that can affect the tested behavior. Do not rerun hook-covered checks. --> - [x] PR description includes a `Signed-off-by:` line 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 — command/result or justification: `npx vitest run --project integration test/platform-vitest-main-workflow.test.ts` (3 passed); both embedded WSL installers pass `bash -n`. - [ ] 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) --- <!-- DCO sign-off is required in this PR description, and every commit must appear as Verified in GitHub. Run: git config user.name && git config user.email --> Signed-off-by: Apurv Kumaria <akumaria@nvidia.com> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **CI Improvements** * Standardized Node.js 22 installation across WSL workflows with a pinned version and architecture-specific downloads. * Added archive checksum verification, version validation, cleanup, and explicit failure handling. * **Tests** * Added coverage to verify secure, deterministic Node.js installation behavior in both WSL workflows. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
Signed-off-by: Apurv Kumaria <akumaria@nvidia.com>
prekshivyas
left a comment
There was a problem hiding this comment.
Re-review at exact head 354e7de457f249cf82a2ff6a1317420b07b64fae:
The prior code blocker is resolved. hasBuildKitRunMount now scans the full RUN option prefix, catches --mount after preceding flags on same-line and continued instructions, and does not treat a shell-command argument as a BuildKit option. The exact ordered COPY assertions also match the reviewed scratch payload stages. I found no remaining code findings.
Security review: PASS across all nine categories (secrets, input validation, authentication/authorization, dependencies, error handling/logging, cryptography, configuration, security testing, and system security). This is test-only hardening; it adds no dependency, runtime, credential, policy, or image-byte change.
Verification:
- focused integration tests: 2 files, 15/15 tests passed
- source-shape contract check: passed with zero invalid exceptions
git diff --check: passed- current required CI and exact-head E2E: green; the cancelled E2E run was superseded by the successful current run
- DCO is present and all eight commits are GitHub Verified
One repository-process blocker remains: the PR body records the documentation-writer review and hidden docs-review-head-sha at cad0523c3, but the current head is 354e7de4. AGENTS.md requires rerunning the documentation-writer review and refreshing its evidence/hidden head SHA after any commit changes the PR head. Please refresh that exact-head receipt. The PR body's sensitive-path receipt is also stale, but this review supplies the current exact-head nine-category security PASS.
Once the documentation-writer receipt is refreshed, this is approval-ready; no code changes are requested.
prekshivyas
left a comment
There was a problem hiding this comment.
Approved at exact head 354e7de457f249cf82a2ff6a1317420b07b64fae.
The prior RUN --mount detection blocker is resolved, the thread-aware review check shows no unresolved threads, and the exact-head documentation-writer receipt is now refreshed and passing. Focused integration tests pass 15/15, the source-shape and diff checks pass, all current required CI/E2E checks are green, DCO and commit verification are complete, and the exact-head nine-category security review is PASS with no findings.
Summary
Hardens the Docker Engine compatibility regression tests added in #7622. The tests now reject BuildKit-only
RUN --mountinstructions across case, whitespace, line-continuation, and preceding RUN-flag variants, and pin every approved scratch-payload COPY source and destination for both OpenClaw and Hermes.Related Issue
Follow-up to #7622.
Relates to #7611.
Changes
--mountwhen it follows valid preceding RUN flags such as--networkor--security.Type of Change
Quality Gates
fcc6d7ec877ec1402b4397e2100cc80d647e883bdc621cb0b14ca647e3795606. The diff changes only regression tests and does not change runtime or final-image bytes.Documentation Writer Review
no-docs-neededRUN --mountsyntax after preceding RUN flags and pins approved scratch-payload COPY boundaries. Existing Docker Engine compatibility documentation remains accurate; production Dockerfiles, runtime behavior, configuration, supported platforms, and final-image contents do not change.DGX Station Hardware Evidence
Verification
Signed-off-by:line and every commit appears asVerifiedin GitHubpre-commit,commit-msg, andpre-pushhooks passed, ornpm run check:diffpassed when hooks were skipped or unavailablenpx vitest run --project integration test/hermes-final-image-layout.test.ts test/openclaw-final-image-layout.test.ts— 15/15 passed at exact head354e7de4.npm testfor broad runtime/test-harness changes;npm run checkfor repo-wide validation/coverage changes — command/result: Not applicable to this narrow test-only contract hardening; repository checks, source-shape budget, test-size budget, Biome, secret scan, CLI typecheck, and CLI build passed.npm run docsbuilds without warnings (doc changes only)Signed-off-by: Apurv Kumaria akumaria@nvidia.com
Summary by CodeRabbit
RUN --mountusage, including handling line continuations.COPYinstruction lines and their order (not just counts).