Repository navigation
test(e2e): migrate test-openshell-gateway-upgrade.sh to vitest - #5609
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughAdds a new ChangesOpenShell Gateway Upgrade E2E Scenario
Sequence Diagram(s)sequenceDiagram
rect rgba(30, 100, 200, 0.5)
Note over runOpenShellGatewayUpgrade: Old Install Phase
runOpenShellGatewayUpgrade->>installOldNemoclawAndClaw: download old installer from NemoClaw release
installOldNemoclawAndClaw->>patchOldInstallerFixture: inject legacy OpenClaw pin + Dockerfile gate
installOldNemoclawAndClaw->>createOldDockerWrapper: create docker shim (rewrite pull/build-arg)
installOldNemoclawAndClaw->>runInstallerPayload: run patched installer with docker shim env
runInstallerPayload-->>installOldNemoclawAndClaw: old openshell version + nemoclaw list verified
end
rect rgba(30, 180, 80, 0.5)
Note over runOpenShellGatewayUpgrade: Survivor Agent Phase
runOpenShellGatewayUpgrade->>startSurvivorAgentInExistingClaw: write marker file + deploy agent via base64
startSurvivorAgentInExistingClaw->>waitForSurvivorAgentReady: poll agent pid/heartbeat/cmdline
waitForSurvivorAgentReady-->>runOpenShellGatewayUpgrade: agent pid confirmed
end
rect rgba(200, 80, 30, 0.5)
Note over runOpenShellGatewayUpgrade: Upgrade Phase
runOpenShellGatewayUpgrade->>installCurrentNemoclawUpgrade: run scripts/install.sh with upgrade env
installCurrentNemoclawUpgrade->>runInstallerPayload: execute current installer
runInstallerPayload-->>installCurrentNemoclawUpgrade: current openshell version verified
runOpenShellGatewayUpgrade->>assertSurvivorSandboxAfterUpgrade: check marker, registry, agent, nemoclaw list
assertSurvivorSandboxAfterUpgrade-->>runOpenShellGatewayUpgrade: all post-upgrade invariants pass
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in the Show a code coverage summary of the most covered files.
TypeScript / code-coverage/cliThe overall coverage in the Show a code coverage summary of the most covered files.
Updated |
E2E Advisor RecommendationRequired E2E: Dispatch hint: Full advisor summaryE2E Recommendation AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
Dispatch hint
|
Vitest E2E Scenario RecommendationRequired Vitest E2E scenarios: Dispatch required Vitest E2E scenarios:
Full Vitest E2E advisor summaryVitest E2E Scenario AdvisorBase: Required Vitest E2E scenarios
Optional Vitest E2E scenarios
Relevant changed files
|
Vitest E2E Scenario Results — ❌ Some jobs failedRun: 27983114840
|
Vitest E2E Scenario Results — ❌ Some jobs failedRun: 27983295624
|
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/e2e-scenario/live/openshell-gateway-upgrade.test.ts`:
- Around line 150-197: The JavaScript template literals containing embedded
Python code are incorrectly interpreting `\n` as actual newline characters,
which breaks the Python syntax when those strings are written to files. In the
`needle` variable and the `hook` variable containing the nested Python injection
script, escape the backslashes by changing all occurrences of `\n` to `\\n` so
that the literal characters `\n` appear in the Python output rather than actual
newlines. Similarly, verify the `marker` variable string which contains `\\\n`
and adjust its escaping if needed to ensure the substring matching works
correctly against the target Dockerfile.
🪄 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: c8d7b1ee-2bc4-4d39-b64b-449de6ee4a65
📒 Files selected for processing (3)
.github/workflows/e2e-vitest-scenarios.yamltest/e2e-scenario/live/openshell-gateway-upgrade.test.tstest/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts
PR Review Advisor — Changes requestedMerge posture: Do not merge yet Action checklist
Findings index
🚨 Required before mergeAddress these before merging unless a maintainer explicitly overrides the advisor with rationale.
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
test/e2e-scenario/live/openshell-gateway-upgrade.test.ts (1)
284-299:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winTypeScript compilation error:
setTimeoutarity mismatch.The build-typecheck pipeline fails with "Expected 3 arguments, but got 2" at line 297. This occurs because passing
resolvedirectly tosetTimeoutcauses TypeScript to infer the wrong generic parameters from the Promise resolve signature.🐛 Proposed fix: wrap resolve in an arrow function
while (attempt < 60 && !ready) { const result = await bash( host, `openshell sandbox list 2>/dev/null || true`, { artifactName: `${labelPrefix}-sandbox-list-${attempt}`, timeoutMs: 30_000, }, ); ready = new RegExp(`${SURVIVOR_SANDBOX}.*Ready`).test(resultText(result)); attempt += 1; - ready || (await new Promise((resolve) => setTimeout(resolve, 2_000))); + ready || (await new Promise<void>((resolve) => setTimeout(() => resolve(), 2_000))); }🤖 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/e2e-scenario/live/openshell-gateway-upgrade.test.ts` around lines 284 - 299, The TypeScript compilation error occurs because the Promise `resolve` function is being passed directly to `setTimeout`, causing incorrect type inference. In the while loop that waits for the survivor sandbox to become ready, wrap the `resolve` function in an arrow function instead of passing it directly. Change `setTimeout(resolve, 2_000)` to `setTimeout(() => resolve(), 2_000)` in the new Promise call. This ensures `setTimeout` receives a function with the correct signature and matches the expected arity.Source: Linters/SAST tools
🤖 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/e2e-scenario/live/openshell-gateway-upgrade.test.ts`:
- Around line 326-336: The setTimeout call in the while loop condition inside
the probe retry logic is missing a required third argument according to
TypeScript's type definitions. Fix the setTimeout invocation by adding a third
argument (such as undefined or null) after the delay value (1_000) in the line
where setTimeout is called with just the resolve callback and delay, similar to
how it was fixed in the waitForSurvivorReady function mentioned in the previous
issue.
---
Outside diff comments:
In `@test/e2e-scenario/live/openshell-gateway-upgrade.test.ts`:
- Around line 284-299: The TypeScript compilation error occurs because the
Promise `resolve` function is being passed directly to `setTimeout`, causing
incorrect type inference. In the while loop that waits for the survivor sandbox
to become ready, wrap the `resolve` function in an arrow function instead of
passing it directly. Change `setTimeout(resolve, 2_000)` to `setTimeout(() =>
resolve(), 2_000)` in the new Promise call. This ensures `setTimeout` receives a
function with the correct signature and matches the expected arity.
🪄 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: 4eb359ef-e438-45a1-93b8-3950bab4f890
📒 Files selected for processing (1)
test/e2e-scenario/live/openshell-gateway-upgrade.test.ts
Vitest E2E Scenario Results — ❌ Some jobs failedRun: 27983974428
|
Vitest E2E Scenario Results — ❌ Some jobs failedRun: 27984535110
|
Vitest E2E Scenario Results — ❌ Some jobs failedRun: 27985016589
|
Vitest E2E Scenario Results — ✅ All jobs passedRun: 27986573608
|
Vitest E2E Scenario Results — ✅ All jobs passedRun: 27988669078
|
Vitest E2E Scenario Results — ✅ All requested jobs passedRun: 27989273274
|
Vitest E2E Scenario Results — ✅ All requested jobs passedRun: 27993454124
|
Summary
Migrate
test-openshell-gateway-upgrade.shwith equivalent live Vitest coverage.Related Issues
Refs #5098
Refs #3001
Assertion parity
v0.0.36, patched only as an old fixture, and source checkout matches the expected tag head.openshell-gateway-upgrade.test.tsdownloads the old installer, patches it, then compares$HOME/.nemoclaw/sourceHEAD withgit ls-remote refs/tags/v0.0.36.install.sh+ GitHub ref fetchcovered2026.4.24, rewrites sandbox base image/build args, and leaves OpenShell0.0.36.openshell --versionmust include0.0.36.coverednemoclaw list, writesSURVIVOR_MARKER_PATH, starts/tmp/nemoclaw-e2e-agent, and probes/proc/$pid/cmdline/heartbeat viaopenshell sandbox exec./procprocess probecovered0.0.44, and report gateway server version0.0.44.Accepted experimental OpenShell gateway upgradeandPre-upgrade backup: 1 backed up, 0 failed, 0 skipped;openshell --versionandopenshell statusassert0.0.44.scripts/install.sh+ gateway process/statuscoverednemoclaw listshows it.command -v openclaw, nonempty/sandbox/.openclaw/openclaw.json, registry JSON, andnemoclaw list.coveredopenshell-gatewaydetects missing Docker-driver binaries and fetchesopenshell-gateway-aarch64-apple-darwin.tar.gz, not VM driver.scripts/install-openshell.sh; asserts nonzero exit, stdout containsmissing Docker-driver binaries, curl log includes gateway Darwin asset and excludes VM driver asset.coveredopenshell-driver-vmHypervisor entitlement or reinstall an otherwise complete OpenShell install.openshell,openshell-gateway,openshell-driver-vm, and fakecodesign; asserts installer exits zero, no entitlements codesign, no reinstall message.coveredNEMOCLAW_DARWIN_VM_COMPATargs/permission lines plus patch flowconst darwinVmCompat = false.coveredcoveredAll legacy assertions are covered or intentionally stronger in Vitest. No row is
missing,partial, orcandidate only.Contract mapping
test/e2e-scenario/live/openshell-gateway-upgrade.test.ts(A1-A5,A9)/proc, registry/state files.A6-A8)scripts/install-openshell.shunder hermetic fake Darwin PATH.Simplicity check
nightly-e2e.yamljobopenshell-gateway-upgrade-e2e,runs-on: ubuntu-latest, 60 minute timeout, Docker/OpenShell,GITHUB_TOKEN, Docker Hub auth.ubuntu-latestrunner class ine2e-vitest-scenarios.yamljobopenshell-gateway-upgrade-vitest.gh workflow run e2e-vitest-scenarios.yaml --repo NVIDIA/NemoClaw --ref e2e-migrate/test-openshell-gateway-upgrade-vitest -f jobs=openshell-gateway-upgrade-vitest -f pr_number=<PR>.Pre-push parity gate
test/e2e/test-openshell-gateway-upgrade.sh9900yes — nightly-e2e openshell-gateway-upgrade-e2e ubuntu-latest/Docker/OpenShell laneVerification
NEMOCLAW_RUN_E2E_SCENARIOS=1 npx vitest run --project e2e-scenarios-live test/e2e-scenario/live/openshell-gateway-upgrade.test.ts --silent=false --reporter=defaultnpx tsc --noEmit --allowImportingTsExtensions --moduleResolution bundler --module esnext --target es2022 --types node,vitest --skipLibCheck test/e2e-scenario/live/openshell-gateway-upgrade.test.tsnpx tsx -e "import { validateFreeStandingWorkflowInventory, evaluateE2eVitestWorkflowDispatchSelectors } from './tools/e2e-scenarios/workflow-boundary.mts'; const errors=validateFreeStandingWorkflowInventory(); console.log(JSON.stringify({errors, evalScenario:evaluateE2eVitestWorkflowDispatchSelectors({scenarios:'openshell-gateway-upgrade'}), evalJob:evaluateE2eVitestWorkflowDispatchSelectors({jobs:'openshell-gateway-upgrade-vitest'})}, null, 2)); if(errors.length) process.exit(1);"npx vitest run --project e2e-vitest-support test/e2e-scenario/support-tests/e2e-scenarios-workflow.test.ts -t "dispatch selector|derives the free-standing inventory" --silent=false --reporter=defaultgit diff --checkin_progress)Summary by CodeRabbit
Tests
CI/CD