test(e2e): migrate state backup restore to vitest#5353
Conversation
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
|
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. |
|
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 (4)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughAdds a live multi-phase state backup-restore E2E test, a selector-gated ChangesState Backup-Restore E2E Test and Workflow Integration
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes 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 docstrings
🧪 Generate unit tests (beta)
Comment |
E2E Advisor RecommendationRequired E2E: None Full advisor summaryE2E Recommendation AdvisorFailed: Could not parse JSON from advisor output; see /home/runner/work/NemoClaw/NemoClaw/artifacts/e2e-advisor/e2e-advisor-raw-output.txt |
Vitest E2E Scenario RecommendationRequired Vitest E2E scenarios: None Full Vitest E2E advisor summaryVitest E2E Scenario AdvisorFailed: Could not parse JSON from advisor output; see /home/runner/work/NemoClaw/NemoClaw/artifacts/e2e-advisor/e2e-scenario-advisor-raw-output.txt |
PR Review AdvisorFindings: 0 needs attention, 1 worth checking, 0 nice ideas Review findings🛠️ Needs attention
🔎 Worth checking
🌱 Nice ideas
Consider writing more tests for
This is an automated advisory review. A human maintainer must make the final merge decision. |
Vitest E2E Scenario Results — ❌ Some jobs failedRun: 27436103496
|
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Vitest E2E Scenario Results — ❌ Some jobs failedRun: 27437481487
|
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Vitest E2E Scenario Results — ✅ All jobs passedRun: 27438030535
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
test/e2e-scenario/live/state-backup-restore.test.ts (1)
130-336: 📐 Maintainability & Code Quality | 🏗️ Heavy liftReduce scenario-function complexity by splitting phase helpers.
The single test body currently bundles preflight, onboarding, write/backup, destroy/re-onboard, restore, and verification logic in one function. Extracting phase helpers will make failures easier to isolate and future changes safer.
As per coding guidelines,
**/*.{js,ts,tsx,jsx}: “Keep function complexity low in JavaScript and TypeScript code.”Also applies to: 341-417
🤖 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/state-backup-restore.test.ts` around lines 130 - 336, The test "state-backup-restore: backup-workspace.sh restores workspace files and memory directory" is too large and should be split into smaller phase helper functions to reduce complexity; extract logical phases into named helpers such as preparePreflightChecks (handles docker check, API key assertions, artifacts.writeJson contract), performOnboard (wraps environment.assertReady + onboard.from and returns NemoClawInstance), writeMarkerFiles (writes markers via stateValidation.writeMarkerFile using WORKSPACE_FILES and MEMORY_FILE), runBackupAndValidate (invokes host.command to run backup-workspace.sh, verifies output, determines createdBackupDir and validates backup contents), performDestroy (wraps destroySandboxUntilAbsent / onboard.destroySandbox / sandbox.openshell delete steps), and restoreAndVerify (runs restore logic and final assertions); replace the large inline blocks in the test body with calls to these helpers so each helper has a single responsibility and the main test reads as a sequence of phases.Source: Coding guidelines
🤖 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/state-backup-restore.test.ts`:
- Around line 337-340: The second onboarding call (onboard.from when creating
restoredInstance) currently hard-fails on endpoint-validation outages; wrap this
call in a try/catch and convert the specific endpoint-validation outage error
into a test skip path instead of failing the test. Detect the outage by checking
the error's unique marker (e.g., error.message or error.code matching the
endpoint-validation outage pattern), call the test-skip handler used in the file
(or return/skip the rest of the test) and avoid rethrowing for that case;
otherwise rethrow the error so real failures still fail. Ensure references
remain to onboard.from, restoredInstance, ready, SANDBOX_NAME, and
ONBOARD_TIMEOUT_MS so the change is localized to this onboarding step.
---
Nitpick comments:
In `@test/e2e-scenario/live/state-backup-restore.test.ts`:
- Around line 130-336: The test "state-backup-restore: backup-workspace.sh
restores workspace files and memory directory" is too large and should be split
into smaller phase helper functions to reduce complexity; extract logical phases
into named helpers such as preparePreflightChecks (handles docker check, API key
assertions, artifacts.writeJson contract), performOnboard (wraps
environment.assertReady + onboard.from and returns NemoClawInstance),
writeMarkerFiles (writes markers via stateValidation.writeMarkerFile using
WORKSPACE_FILES and MEMORY_FILE), runBackupAndValidate (invokes host.command to
run backup-workspace.sh, verifies output, determines createdBackupDir and
validates backup contents), performDestroy (wraps destroySandboxUntilAbsent /
onboard.destroySandbox / sandbox.openshell delete steps), and restoreAndVerify
(runs restore logic and final assertions); replace the large inline blocks in
the test body with calls to these helpers so each helper has a single
responsibility and the main test reads as a sequence of phases.
🪄 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: a7011f51-b1d3-4d2d-a51f-2e1d5e0280d3
📒 Files selected for processing (6)
.github/workflows/e2e-vitest-scenarios.yamltest/e2e-scenario/fixtures/phases/onboarding.tstest/e2e-scenario/live/state-backup-restore.test.tstest/e2e-scenario/support-tests/e2e-scenarios-workflow.test.tstools/e2e-scenarios/free-standing-jobs.envtools/e2e-scenarios/workflow-boundary.mts
Signed-off-by: Carlos Villela <cvillela@nvidia.com>
Vitest E2E Scenario Results — ✅ All jobs passedRun: 27444251616
|
Summary
Migrates the legacy
test/e2e/test-state-backup-restore.shcontract into a live Vitest scenario that exercises the realscripts/backup-workspace.shbackup and restore boundaries. Adds manual E2E Vitest dispatch wiring and workflow contract coverage for the new free-standing scenario.Related Issue
Refs #5098
Changes
test/e2e-scenario/live/state-backup-restore.test.tsfor the real backup -> destroy -> re-onboard -> restore lifecycle.state-backup-restore-vitestto.github/workflows/e2e-vitest-scenarios.yamland the free-standing job inventory.Type of Change
Verification
Targeted checks run: live Vitest registration/skip, workflow support Vitest, Biome formatting/linting, source-shape/test-size checks, and
git diff --check. Full localprek/push hooks were attempted but are not marked passing because unrelated CLI timeout failures occurred insrc/lib/onboard/web-search-flow.test.ts.npx prek run --all-filespassesnpm testpassesnpm run docsbuilds without warnings (doc changes only)Signed-off-by: Carlos Villela cvillela@nvidia.com
Summary by CodeRabbit
Tests
Chores