test(cli): add unit tests for restore ACP command (#23402)#26053
test(cli): add unit tests for restore ACP command (#23402)#26053cocosheng-g merged 6 commits intomainfrom
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request improves the reliability of the CLI by introducing robust unit testing for the ACP restore functionality. By ensuring all code paths are exercised, including error handling and edge cases, this change helps maintain stability and provides confidence in the checkpoint restoration process. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces unit tests for the RestoreCommand and ListCheckpointsCommand within the CLI package, covering functionality such as checkpoint restoration, listing, and error handling. The review feedback indicates that the mocks for getCheckpointInfoList are inconsistent with the actual CheckpointInfo interface defined in the core package. Specifically, the tests use properties like fileName, toolName, and status which are not present in the real interface, and the use of "as unknown as" type assertions is masking potential logic errors in the CLI implementation.
|
Size Change: -4 B (0%) Total Size: 33.8 MB
ℹ️ View Unchanged
|
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request adds unit tests for the RestoreCommand and ListCheckpointsCommand in the CLI package, covering various edge cases and error conditions. A high-priority issue was noted regarding the getCheckpointInfoList mock, which uses properties that do not exist in the official CheckpointInfo interface. This indicates that the current implementation may be relying on incorrect types or unsafe casting, which could lead to data display issues in production.
Summary
This PR adds missing unit test coverage for the ACP
restoreandrestore listcommands in the CLI.Details
packages/cli/src/acp/commands/restore.test.tspackages/cli/src/acp/commands/restore.ts.jsonextension, missing metadata in checkpoints).packages/cli/src/acp/commands/restore.tsremains unchanged per request. The tests have been adjusted to be compatible with its original implementation.Related Issues
Fixes #23402
How to Validate
Run the unit tests in the CLI workspace:
npm run test --workspace @google/gemini-cli -- src/acp/commands/restore.test.tsExpect all 13 tests to pass with 100% coverage for the target file.
Pre-Merge Checklist