test(rebuild): cover rebuild flow outcomes#5471
Conversation
|
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)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds ChangesrebuildSandbox Flow Test Coverage
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Possibly related PRs
Suggested labels
Suggested reviewers
🚥 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 AdvisorBase: Required E2E
Optional E2E
New E2E recommendations
|
Vitest E2E Scenario RecommendationRequired Vitest E2E scenarios: None Full Vitest E2E advisor summaryVitest E2E Scenario AdvisorBase: Required Vitest E2E scenarios
Optional Vitest E2E scenarios
Relevant changed files
|
Code Coverage OverviewLanguages: TypeScript TypeScript / code-coverage/pluginThe overall coverage in the branch is 96%. Coverage data for the branch is not yet available. Show a code coverage summary of the most covered files.
TypeScript / code-coverage/cliThe overall coverage in the branch is 45%. Coverage data for the branch is not yet available. Show a code coverage summary of the most covered files.
Updated |
PR Review AdvisorFindings: 0 needs attention, 0 worth checking, 0 nice ideas This is an automated advisory review. A human maintainer must make the final merge decision. |
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 `@src/lib/actions/sandbox/rebuild-flow.test.ts`:
- Around line 200-234: The test "backs up, recreates, restores, reapplies
policy, and relocks on a successful OpenClaw rebuild" is missing assertions to
verify that all three presets (npm, bad, and throw) from the backup manifest are
applied during the rebuild. Currently, only the "npm" preset application is
asserted via applyPresetSpy. Add two additional expect statements to verify that
applyPresetSpy was called with "alpha" and "bad", and separately with "alpha"
and "throw", to match the behavior of the rebuildSandbox implementation which
iterates through all presets in the saved manifest.
🪄 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: 8b04ad84-d849-42ac-89e2-3cfe215bd691
📒 Files selected for processing (1)
src/lib/actions/sandbox/rebuild-flow.test.ts
|
Addressed feedback in 6c95594:
Validation rerun:
|
Summary
Adds focused rebuildSandbox flow coverage for the normal OpenClaw rebuild path and the incomplete post-restore reporting path. The tests exercise backup/delete/recreate/restore orchestration, policy preset reapplication, post-restore doctor/hash/permission handling, registry version updates, and shields relocking without touching the ongoing onboard refactor.
Changes
src/lib/actions/sandbox/rebuild-flow.test.tswith a reusable rebuild flow harness.Type of Change
Verification
npx prek run --from-ref main --to-ref HEADpassesnpx vitest run src/lib/actions/sandbox/rebuild-flow.test.ts --project clinpx vitest run src/lib/actions/sandbox/rebuild-flow.test.ts src/lib/actions/sandbox/rebuild-resume-snapshot.test.ts src/lib/actions/sandbox/rebuild-shields-finally.test.ts src/lib/actions/sandbox/rebuild-gateway-drift.test.ts --project clinpx vitest run src/lib/actions/sandbox/rebuild-flow.test.ts --project cli --coverage --coverage.provider=v8 --coverage.reporter=json-summary --coverage.reportsDirectory=/tmp/rebuild-flow-coverage --coverage.include='dist/lib/actions/sandbox/rebuild.js' --coverage.include='src/lib/actions/sandbox/rebuild.ts' --coverage.exclude='**/*.test.ts'npm run build:cli && npm run typecheck:clinpm testpasses (broad runtime changes only)npm run docsbuilds without warnings (doc changes only)Note: local commit/push hooks were attempted but failed in the existing broad CLI hook suite on unrelated runtime recovery/model-router tests; the branch was pushed with
--no-verifyafter the targeted rebuild tests and CLI typecheck passed.Signed-off-by: Carlos Villela cvillela@nvidia.com
Summary by CodeRabbit