Skip to content

test(e2e): migrate VM driver privileged exec to Vitest#5144

Closed
cv wants to merge 18 commits into
mainfrom
codex/e2e-migrate-vm-driver-privexec
Closed

test(e2e): migrate VM driver privileged exec to Vitest#5144
cv wants to merge 18 commits into
mainfrom
codex/e2e-migrate-vm-driver-privexec

Conversation

@cv

@cv cv commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Migrates the VM driver privileged-exec routing regression from the legacy shell script into a Vitest live scenario. The nightly job now runs the targeted Vitest scenario directly and uploads shared E2E fixture artifacts.

Related Issue

Refs #4941
Refs #4245

Changes

  • Add test/e2e-scenario/live/vm-driver-privileged-exec-routing.test.ts with fake registry and fake Docker coverage for direct sandbox container routing.
  • Replace test/e2e/test-vm-driver-privileged-exec-routing.sh in nightly-e2e.yaml with direct e2e-scenarios-live execution.
  • Extend test/e2e-script-workflow.test.ts and test/helpers/e2e-workflow-contract.ts to lock the new workflow contract.

Type of Change

  • 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)

Verification

  • npx prek run --all-files passes
  • npm test passes
  • Tests added or updated for new or changed behavior
  • No secrets, API keys, or credentials committed
  • Docs updated for user-facing behavior changes
  • npm run docs builds without warnings (doc changes only)
  • Doc pages follow the style guide (doc changes only)
  • New doc pages include SPDX header and frontmatter (new pages only)

Signed-off-by: Carlos Villela cvillela@nvidia.com

@cv cv self-assigned this Jun 10, 2026
@copy-pr-bot

copy-pr-bot Bot commented Jun 10, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: e1f024cb-3fef-489a-9417-f1eea9bc8889

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/e2e-migrate-vm-driver-privexec

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: vm-driver-privileged-exec-routing-e2e
Optional E2E: None

Dispatch hint: vm-driver-privileged-exec-routing-e2e

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/codex/e2e-simplify-migration-tracking
Head: HEAD
Confidence: high

Required E2E

  • vm-driver-privileged-exec-routing-e2e (low): This is the directly modified E2E job. It should run to validate that the workflow migration from the deleted shell script to the new live Vitest scenario still dispatches correctly, builds the CLI, executes the privileged-exec routing probe, and uploads artifacts.

Optional E2E

  • None.

New E2E recommendations

  • None.

Dispatch hint

  • Workflow: .github/workflows/nightly-e2e.yaml
  • jobs input: vm-driver-privileged-exec-routing-e2e

@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

E2E Scenario Advisor Recommendation

Required scenario E2E: e2e-scenarios-all
Optional scenario E2E: None

Dispatch required scenario E2E:

  • gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref>

Workflow run

Full scenario advisor summary

E2E Scenario Advisor

Base: origin/codex/e2e-simplify-migration-tracking
Head: HEAD
Confidence: medium

Required scenario E2E

  • e2e-scenarios-all: The PR adds a new live Vitest scenario-side test under test/e2e-scenario/live and wires nightly execution toward that Vitest surface. This free-standing live test is not a trusted-main live-supported typed registry scenario ID that can be targeted with the scenarios input, so run the e2e-vitest-scenarios fan-out rather than inventing a targeted ID.
    • Dispatch: gh workflow run e2e-vitest-scenarios.yaml --ref <pr-head-ref>

Optional scenario E2E

  • None.

Relevant changed files

  • .github/workflows/nightly-e2e.yaml
  • test/e2e-scenario/live/vm-driver-privileged-exec-routing.test.ts

@github-actions

github-actions Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

PR Review Advisor

Findings: 0 needs attention, 0 worth checking, 0 nice ideas
Since last review: 0 prior items resolved, 0 still apply, 0 new items found

Consider writing more tests for
  • **Runtime validation** — Exercise vm-driver-privileged-exec-routing-e2e and confirm it invokes only test/e2e-scenario/live/vm-driver-privileged-exec-routing.test.ts through the e2e-scenarios-live Vitest project.. The code-level migration is covered by a workflow contract test and a migrated live scenario, but .github/workflows/nightly-e2e.yaml is an infrastructure/runtime path where targeted runtime validation improves confidence.
  • **Runtime validation** — Exercise vm-driver-privileged-exec-routing-e2e and confirm the Vitest fixture writes and uploads artifacts under e2e-artifacts/vitest/vm-driver-privileged-exec-routing/.. The code-level migration is covered by a workflow contract test and a migrated live scenario, but .github/workflows/nightly-e2e.yaml is an infrastructure/runtime path where targeted runtime validation improves confidence.
  • **Runtime validation** — Exercise the migrated scenario and confirm the direct-container routing assertions cover VM prefix collision, exact VM container selection, Docker-driver selection, unknown-driver selection, and missing direct container failure.. The code-level migration is covered by a workflow contract test and a migrated live scenario, but .github/workflows/nightly-e2e.yaml is an infrastructure/runtime path where targeted runtime validation improves confidence.
  • **Acceptance clause:** Refs Adopt Vitest fixtures as the E2E scenario execution model #4941 / Refs [macOS][Security] nemoclaw shields up/down fails with "No such container: openshell-cluster-nemoclaw" on Docker Desktop VM driver #4245 — add test evidence or identify existing coverage. No trusted linked issue bodies or issue comments were provided in deterministic context, so issue-specific acceptance clauses could not be extracted.

Workflow run details

This is an automated advisory review. A human maintainer must make the final merge decision.

@wscurran wscurran added area: ci CI workflows, checks, release automation, or GitHub Actions area: e2e End-to-end tests, nightly failures, or validation infrastructure chore Build, CI, dependency, or tooling maintenance labels Jun 10, 2026
@wscurran

Copy link
Copy Markdown
Contributor

Base automatically changed from codex/e2e-simplify-migration-tracking to main June 10, 2026 20:53
cv pushed a commit that referenced this pull request Jun 11, 2026
## Summary
Migrate the `test/e2e/test-vm-driver-privileged-exec-routing.sh`
contract into focused Vitest coverage while keeping the legacy shell
file present for now.

Seeded from Carlos's PR #5144, but rebuilt on current `main` with only
the one-script migration changes and no #5126-era framework diff.

## Related Issues
Refs #5098
Refs #4245

## Contract mapping
- Legacy assertion: VM-driver privileged exec routes to the direct
sandbox container, not `openshell-gateway-nemoclaw`.
- Replacement: `test/vm-driver-privileged-exec-routing.test.ts` asserts
`alpha` selects `openshell-alpha-abc123` while ignoring
`openshell-alpha-child` and gateway containers.
- Boundary preserved: real built `dist/lib/sandbox/privileged-exec.js`
helper plus fake registry and fake `docker ps` subprocess boundary.
- Legacy assertion: exact direct container wins when present.
  - Replacement: `alpha-child` selects `openshell-alpha-child`.
- Boundary preserved: fake Docker output exercises the same
direct-container selection path.
- Legacy assertion: Docker-driver and older registry entries without
recorded driver still route to direct sandbox containers.
- Replacement: `dockerbox` and `unknown-driver` cases assert direct
container argv.
- Boundary preserved: built helper reads a temp
`~/.nemoclaw/sandboxes.json`.
- Legacy assertion: missing direct VM container fails clearly instead of
falling back to gateway routing.
- Replacement: missing-container case asserts the `No running direct
OpenShell sandbox container...driver: vm` error.
- Boundary preserved: fake `docker ps` contains only gateway/unrelated
containers.

## Simplicity check
- Test shape: focused process/unit-shaped Vitest test in `test/`.
- New shared helpers: none; fake registry/Docker setup is local to the
test.
- New framework/registry/ledger: **none**.
- Workflow changes: retired/unwired the nightly shell-script lane from
selective dispatch and nightly shell-script wiring. The legacy shell
file remains in `test/e2e/` and in the top-level frozen shell allowlist;
replacement coverage runs in normal CLI Vitest.

## Verification
- `npm run build:cli`
- `npx vitest run --project cli
test/vm-driver-privileged-exec-routing.test.ts --silent=false
--reporter=default`
- `npx vitest run --project cli test/e2e-script-workflow.test.ts
--silent=false --reporter=default`
- includes a contract assertion that the unwired
`vm-driver-privileged-exec-routing-e2e` lane is absent from nightly
dispatch/wiring, the legacy shell file remains present, the replacement
test is in the CLI Vitest include path, and the CLI coverage shard
rebuilds `dist` before Vitest
- `npm run test-size:check --
test/vm-driver-privileged-exec-routing.test.ts
test/e2e-script-workflow.test.ts`
- `git diff --check`

## CI follow-up
The first selective E2E auto-dispatch still used the trusted `main`
nightly workflow, which attempted to run the shell-script lane. This PR
now removes `vm-driver-privileged-exec-routing-e2e` from the nightly
dispatch input/list/job definitions so the unwired lane is not
auto-dispatched. The legacy shell file has been restored per maintainer
preference; this PR no longer deletes any file under `test/e2e/`.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Tests**
* Added a regression test for privileged-exec routing to validate
correct OpenShell sandbox selection across VM, Docker, and other
drivers.
* Added a contract test to ensure the retired nightly job is absent and
that the CLI coverage shard runs the build step before executing CLI
tests.

* **Chores**
* Retired a nightly E2E job and updated CI guidance to reference the new
CLI test shard and narrowed nightly run targets.
  * Test helper updated to include CLI coverage shard metadata.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@cv cv added the v0.0.64 Release target label Jun 11, 2026
@cv

cv commented Jun 12, 2026

Copy link
Copy Markdown
Collaborator Author

Closing as superseded by #5189. That merged PR carries the VM-driver privileged-exec routing contract forward on current main, explicitly notes it was seeded from this branch, and narrows the change to the one-script migration without the older #5126-era framework/ledger churn. #5098 now records test/e2e/test-vm-driver-privileged-exec-routing.sh as converted by #5189. Any remaining idea should come back as a fresh, focused follow-up against current main.

@cv cv closed this Jun 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: ci CI workflows, checks, release automation, or GitHub Actions area: e2e End-to-end tests, nightly failures, or validation infrastructure chore Build, CI, dependency, or tooling maintenance v0.0.64 Release target

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants