Skip to content

test(acp): added restore command coverage#23400

Closed
samar-703 wants to merge 5 commits intogoogle-gemini:mainfrom
samar-703:test/acp-restore-command-tests
Closed

test(acp): added restore command coverage#23400
samar-703 wants to merge 5 commits intogoogle-gemini:mainfrom
samar-703:test/acp-restore-command-tests

Conversation

@samar-703
Copy link
Copy Markdown

@samar-703 samar-703 commented Mar 21, 2026

Summary

Added unit test coverage for ACP restore commands by introducing a new test suite for:

  • RestoreCommand
  • ListCheckpointsCommand

This improves confidence around checkpoint restore/list behavior and error handling.

Details

Added packages/cli/src/acp/commands/restore.test.ts with coverage for:

  • RestoreCommand

  • Delegation to list behavior when no args are provided

  • Checkpointing-disabled response

  • Missing checkpoint file (ENOENT) response

  • Schema validation failure response for checkpoint payload

  • Restore stream formatting (message, load_history, fallback object)

  • Unexpected error handling path

  • ListCheckpointsCommand

  • Checkpointing-disabled response

  • Empty/no-json checkpoint directory response

  • Formatted checkpoint summary output

  • Unexpected error handling path

Related Issues

How to Validate

  1. Checkout this branch.
  2. Run:
    • npm run build --workspace @google/gemini-cli-core
    • npm run test --workspace @google/gemini-cli -- src/acp/commands/restore.test.ts
  3. Expected result:
    • Test file passes (10/10).

Closes #23402

Pre-Merge Checklist

  • Updated relevant documentation and README (if needed)
  • Added/updated tests (if needed)
  • Noted breaking changes (if any)
  • Validated on required platforms/methods:
    • MacOS
      • npm run
      • npx
      • Docker
      • Podman
      • Seatbelt
    • Windows
      • npm run
      • npx
      • Docker
    • Linux
      • npm run
      • npx
      • Docker

@samar-703 samar-703 requested a review from a team as a code owner March 21, 2026 19:58
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, 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 significantly improves the test coverage for the ACP CLI's checkpoint management features. By introducing dedicated unit tests for both the restore and list checkpoint commands, it ensures that these critical functionalities behave as expected across various operational and error conditions, thereby bolstering the overall stability and robustness of the CLI.

Highlights

  • New Test Suite for RestoreCommand: Added comprehensive unit test coverage for the RestoreCommand, including scenarios for delegation to list, disabled checkpointing, missing checkpoint files, schema validation failures, restore stream formatting, and unexpected error handling.
  • New Test Suite for ListCheckpointsCommand: Introduced unit tests for the ListCheckpointsCommand, covering cases such as disabled checkpointing, empty or non-JSON checkpoint directories, formatted summary output, and unexpected error handling during listing.
  • Improved Confidence: The new tests enhance confidence in the reliability of checkpoint restore and listing functionalities, as well as their error handling mechanisms.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds comprehensive unit test coverage for the RestoreCommand and ListCheckpointsCommand in the ACP module. The tests cover various success paths, error conditions, and edge cases. However, I've found a critical issue in one of the tests for ListCheckpointsCommand where an incorrect mock is hiding a bug in the production code. This needs to be addressed to ensure the feature works as expected and the tests provide true confidence.

Comment thread packages/cli/src/acp/commands/restore.test.ts
@gemini-cli gemini-cli bot added the area/core Issues related to User Interface, OS Support, Core Functionality label Mar 21, 2026
@samar-703
Copy link
Copy Markdown
Author

/gemini review

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces new unit tests for the RestoreCommand and ListCheckpointsCommand in packages/cli/src/acp/commands/restore.test.ts, covering various scenarios including disabled checkpointing, file not found errors, invalid checkpoint schemas, and proper output formatting. Additionally, the ListCheckpointsCommand in packages/cli/src/acp/commands/restore.ts was updated to explicitly return a 'No checkpoints found.' message when the list is empty and to simplify the displayed checkpoint summary format to show only the checkpoint name and message ID.

@gemini-cli
Copy link
Copy Markdown
Contributor

gemini-cli bot commented Apr 5, 2026

Hi there! Thank you for your interest in contributing to Gemini CLI.

To ensure we maintain high code quality and focus on our prioritized roadmap, we have updated our contribution policy (see Discussion #17383).

We only guarantee review and consideration of pull requests for issues that are explicitly labeled as 'help wanted'. All other community pull requests are subject to closure after 14 days if they do not align with our current focus areas. For this reason, we strongly recommend that contributors only submit pull requests against issues explicitly labeled as 'help-wanted'.

This pull request is being closed as it has been open for 14 days without a 'help wanted' designation. We encourage you to find and contribute to existing 'help wanted' issues in our backlog! Thank you for your understanding and for being part of our community!

@gemini-cli gemini-cli bot closed this Apr 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/core Issues related to User Interface, OS Support, Core Functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test(ACP): Add missing unit coverage for restore command flows

1 participant