Skip to content

test(snapshot): cover latest restore flow#5486

Merged
cv merged 1 commit into
mainfrom
test/snapshot-restore-autocreate-coverage
Jun 16, 2026
Merged

test(snapshot): cover latest restore flow#5486
cv merged 1 commit into
mainfrom
test/snapshot-restore-autocreate-coverage

Conversation

@cv

@cv cv commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds focused snapshot restore coverage for restoring the latest snapshot into the source sandbox. This complements the existing snapshot create/list coverage without changing runtime behavior.

Changes

  • Extended src/lib/actions/sandbox/snapshot.test.ts with a latest-snapshot restore path.
  • Asserted the selected backup path is restored and the user-facing latest snapshot/restored-state messages are printed.

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

  • Git hooks passed during commit and push, or npx prek run --from-ref main --to-ref HEAD passes
  • Targeted tests pass for changed behavior
    • npx vitest run src/lib/actions/sandbox/snapshot.test.ts --project cli
    • npm run typecheck:cli
  • Full npm test passes (broad runtime changes only)
  • 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)

Note: commit and push hooks were skipped for this test-only branch because the broad local hook suite has unrelated pre-existing CLI failures in this checkout; targeted tests and CLI typecheck passed.


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

Summary by CodeRabbit

No user-facing changes to report. This release contains internal test improvements to the sandbox snapshot restore functionality, including enhanced test mocks and additional test coverage to ensure reliability of the restore feature.

@cv cv self-assigned this Jun 16, 2026
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 1cbdc0ff-e03e-480a-9601-8175b03dd27d

📥 Commits

Reviewing files that changed from the base of the PR and between b490f8b and f53e504.

📒 Files selected for processing (1)
  • src/lib/actions/sandbox/snapshot.test.ts

📝 Walkthrough

Walkthrough

The test file src/lib/actions/sandbox/snapshot.test.ts gains two new top-level mock variables (getLatestBackupMock, registerSandboxMock), an isSandboxReady helper in the gateway mock, rewired module mocks for state/registry and state/sandbox, updated beforeEach defaults, and a new test case covering the restore-from-latest-snapshot flow.

Changes

Sandbox snapshot restore test coverage

Layer / File(s) Summary
Mock declarations and gateway/module mock wiring
src/lib/actions/sandbox/snapshot.test.ts
Declares getLatestBackupMock and registerSandboxMock at the top level, adds isSandboxReady to the gateway mock, rewires state/registry and state/sandbox module mocks to use the new variables, and sets their beforeEach defaults.
Restore latest snapshot test case
src/lib/actions/sandbox/snapshot.test.ts
Adds a test that configures getLatestBackupMock with a specific snapshot, stubs restoreSandboxState, asserts it is called with the correct backup path, and checks console output for snapshot details and restore counts.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • NVIDIA/NemoClaw#5481: Directly modifies the same snapshot.test.ts file with overlapping mock setup around restoreSandboxState and snapshot restore test coverage.
  • NVIDIA/NemoClaw#5471: Extends Vitest coverage for getLatestBackup/restore-from-latest behavior in the sandbox snapshot/rebuild flow.
  • NVIDIA/NemoClaw#5177: Modifies restoreSandboxState restore logic in sandbox.ts, directly underpinning the behavior this PR's new test verifies.

Suggested labels

v0.0.66

🐇 A snapshot saved, a snapshot restored,
The latest backup path explored!
With mocks in place and stubs aligned,
The restore flow is now defined.
Hop hop hooray, the tests pass true —
This bunny's proud of what you do! 🌟

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'test(snapshot): cover latest restore flow' accurately summarizes the main change: adding test coverage for the latest snapshot restore functionality.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch test/snapshot-restore-autocreate-coverage

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

@github-code-quality

github-code-quality Bot commented Jun 16, 2026

Copy link
Copy Markdown

Code Coverage Overview

Languages: TypeScript

TypeScript / code-coverage/plugin

The 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.
File f53e504 +/-
nemoclaw/src/se...cret-scanner.ts 100%
nemoclaw/src/commands/slash.ts 100%
nemoclaw/src/li...bprocess-env.ts 100%
nemoclaw/src/bl...eprint/state.ts 98%
nemoclaw/src/onboard/config.ts 98%
nemoclaw/src/bl...int/snapshot.ts 97%
nemoclaw/src/bl...print/runner.ts 95%
nemoclaw/src/co...ration-state.ts 94%
nemoclaw/src/bl...ate-networks.ts 94%
nemoclaw/src/index.ts 94%

TypeScript / code-coverage/cli

The overall coverage in the branch is 46%. Coverage data for the branch is not yet available.

Show a code coverage summary of the most covered files.
File f53e504 +/-
src/lib/state/o...oard-session.ts 90%
src/lib/inference/local.ts 76%
src/lib/sandbox/config.ts 72%
src/lib/onboard/preflight.ts 64%
src/lib/actions...dbox/rebuild.ts 62%
src/lib/actions...licy-channel.ts 56%
src/lib/state/sandbox.ts 55%
src/lib/policy/index.ts 49%
src/lib/onboard...er-gpu-patch.ts 44%
src/lib/onboard.ts 17%

Updated June 16, 2026 01:12 UTC
Code Coverage is in Public Preview. Learn more and provide us with your feedback.

@github-actions

Copy link
Copy Markdown
Contributor

E2E Advisor Recommendation

Required E2E: None
Optional E2E: None

Workflow run

Full advisor summary

E2E Recommendation Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required E2E

  • None. No E2E is recommended because the change is limited to unit test coverage for existing sandbox snapshot behavior and cannot affect runtime or real assistant user flows.

Optional E2E

  • None.

New E2E recommendations

  • None.

@github-actions

Copy link
Copy Markdown
Contributor

Vitest E2E Scenario Recommendation

Required Vitest E2E scenarios: None
Optional Vitest E2E scenarios: None

Workflow run

Full Vitest E2E advisor summary

Vitest E2E Scenario Advisor

Base: origin/main
Head: HEAD
Confidence: high

Required Vitest E2E scenarios

  • None. Only a unit test outside test/e2e-scenario/ changed, with no changes to the Vitest scenario workflow, registry, runtime support, live tests, fixtures, or scenario metadata; no Vitest E2E scenario dispatch is required.

Optional Vitest E2E scenarios

  • None.

Relevant changed files

  • None.

@github-actions

Copy link
Copy Markdown
Contributor

PR Review Advisor

Findings: 0 needs attention, 0 worth checking, 0 nice ideas

Workflow run details

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

@cv cv merged commit 4a7b4c8 into main Jun 16, 2026
46 checks passed
@cv cv deleted the test/snapshot-restore-autocreate-coverage branch June 16, 2026 01:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant