Summary
ACP restore commands currently lack direct unit tests for key success and failure paths in:
packages/cli/src/acp/commands/restore.ts
This creates risk for regressions in checkpoint restore/list behavior and user-facing error messages.
Problem
RestoreCommand and ListCheckpointsCommand include multiple branches that are easy to break without explicit
tests, including:
- checkpointing disabled handling
- missing checkpoint file handling (
ENOENT)
- invalid/corrupt checkpoint data handling
- restore stream result formatting
- fallback/unexpected error handling
- checkpoint listing and formatting behavior
Proposed Solution
Add a dedicated test suite:
packages/cli/src/acp/commands/restore.test.ts
Cover these scenarios:
RestoreCommand
- Delegates to list behavior when invoked without args
- Returns checkpointing-disabled message
- Returns file-not-found message for missing checkpoint
- Returns invalid/corrupt checkpoint message when schema parse fails
- Formats streamed restore results (
message, load_history, fallback object)
- Returns generic unexpected error message for non-ENOENT failures
ListCheckpointsCommand
- Returns checkpointing-disabled message
- Returns
No checkpoints found. when no .json checkpoints exist
- Formats checkpoint summary output from checkpoint metadata
- Returns generic unexpected error message on failures
Acceptance Criteria
- New restore ACP test file exists and runs successfully.
- All branches above are explicitly asserted.
- Command output strings remain stable and verified by tests.
- No production/runtime code changes are required for this issue.
Validation
Run:
npm run build --workspace @google/gemini-cli-core
npm run test --workspace @google/gemini-cli -- src/acp/commands/restore.test.ts
Expected: restore ACP tests pass.
Related PR
Related to #23400
Summary
ACP restore commands currently lack direct unit tests for key success and failure paths in:
packages/cli/src/acp/commands/restore.tsThis creates risk for regressions in checkpoint restore/list behavior and user-facing error messages.
Problem
RestoreCommandandListCheckpointsCommandinclude multiple branches that are easy to break without explicittests, including:
ENOENT)Proposed Solution
Add a dedicated test suite:
packages/cli/src/acp/commands/restore.test.tsCover these scenarios:
RestoreCommand
message,load_history, fallback object)ListCheckpointsCommand
No checkpoints found.when no.jsoncheckpoints existAcceptance Criteria
Validation
Run:
npm run build --workspace @google/gemini-cli-corenpm run test --workspace @google/gemini-cli -- src/acp/commands/restore.test.tsExpected: restore ACP tests pass.
Related PR
Related to #23400