Skip to content

Improved code coverage for cli/src/zed-integration#13570

Merged
megha1188 merged 1 commit intomainfrom
issue13558
Nov 21, 2025
Merged

Improved code coverage for cli/src/zed-integration#13570
megha1188 merged 1 commit intomainfrom
issue13558

Conversation

@megha1188
Copy link
Copy Markdown
Contributor

Summary

This PR significantly improves the test coverage for the zed-integration module in the CLI package. It introduces new unit test files for connections, file system services, and the core integration logic, ensuring better reliability and maintainability.

Details

  1. New Tests:
  • connection.test.ts: Added tests for the Connection class to verify JSON-RPC request/response handling, notifications, and error management.
  • fileSystemService.test.ts: Added tests for AcpFileSystemService, covering file reading/writing and fallback mechanisms when client capabilities are missing.
  • zedIntegration.test.ts: Added extensive tests for GeminiAgent and Session classes. This includes initialization, authentication flows, session management, tool execution (including cancellation and permissions), and prompt handling.
  1. Refactoring:
  • Updated packages/cli/src/zed-integration/zedIntegration.ts to export the GeminiAgent and Session classes, making them accessible for unit testing.

Related Issues

Fixes #13558

How to Validate

  1. Run the tests for the CLI package:
    npm test packages/cli

(or the equivalent vitest command for this project)
2. Verify that all new tests in zed-integration pass.
3. Ensure that the code coverage report reflects the increased coverage in src/zed-integration.

Previous code coverage-
33.4% Statements 461/1380
91.66% Branches 22/24
50% Functions 13/26
33.4% Lines 461/1380

Current code coverage-
82.39% Statements 1137/1380
72.63% Branches 138/190
93.87% Functions 46/49
82.39% Lines 1137/1380

@megha1188 megha1188 requested a review from a team as a code owner November 21, 2025 10:23
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @megha1188, 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 substantially improves the test coverage for the 'zed-integration' module within the CLI package. By introducing new, comprehensive unit tests for critical components like connection handling, file system services, and the core integration logic, the changes aim to bolster the reliability and maintainability of the module. The refactoring to export key classes also enhances the testability of the codebase.

Highlights

  • New Test Files Added: Introduced three new unit test files: 'connection.test.ts', 'fileSystemService.test.ts', and 'zedIntegration.test.ts', significantly expanding test coverage for the 'zed-integration' module.
  • Connection Class Testing: 'connection.test.ts' now includes comprehensive tests for the 'Connection' class, verifying JSON-RPC request/response handling, notifications, and error management.
  • File System Service Testing: 'fileSystemService.test.ts' adds tests for 'AcpFileSystemService', covering file reading/writing operations and ensuring proper fallback mechanisms when client capabilities are absent.
  • Core Integration Logic Testing: 'zedIntegration.test.ts' provides extensive tests for the 'GeminiAgent' and 'Session' classes, encompassing initialization, authentication flows, session management, tool execution (including cancellation and permissions), and prompt handling.
  • Refactoring for Testability: The 'GeminiAgent' and 'Session' classes in 'packages/cli/src/zed-integration/zedIntegration.ts' have been exported, making them accessible for unit testing.
  • Significant Code Coverage Improvement: The pull request dramatically increased the code coverage for the 'cli/src/zed-integration' module, with statements and lines coverage rising from 33.4% to 82.39%.
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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Nov 21, 2025

Size Change: +96 B (0%)

Total Size: 21.1 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 21.1 MB +96 B (0%)
./bundle/sandbox-macos-permissive-closed.sb 1.03 kB 0 B
./bundle/sandbox-macos-permissive-open.sb 890 B 0 B
./bundle/sandbox-macos-permissive-proxied.sb 1.31 kB 0 B
./bundle/sandbox-macos-restrictive-closed.sb 3.29 kB 0 B
./bundle/sandbox-macos-restrictive-open.sb 3.36 kB 0 B
./bundle/sandbox-macos-restrictive-proxied.sb 3.56 kB 0 B

compressed-size-action

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 significantly improves the test coverage for the zed-integration module by adding comprehensive unit tests for Connection, AcpFileSystemService, GeminiAgent, and Session. The new tests are well-structured and cover many important scenarios, including request/response handling, error conditions, and tool execution flows.

I've identified one high-severity issue where a new test correctly reveals a bug in the cancellation logic of Session.prompt. My review includes a detailed comment on this test. Overall, this is a great contribution to improving the reliability of the CLI.

Comment thread packages/cli/src/zed-integration/zedIntegration.test.ts
@megha1188 megha1188 requested a review from scidomino November 21, 2025 10:34
@megha1188 megha1188 added this pull request to the merge queue Nov 21, 2025
Merged via the queue into main with commit 3370644 Nov 21, 2025
22 checks passed
@megha1188 megha1188 deleted the issue13558 branch November 21, 2025 15:50
thacio added a commit to thacio/auditaria that referenced this pull request Nov 23, 2025
werdnum pushed a commit to werdnum/gemini-cli that referenced this pull request Nov 24, 2025
danpalmer pushed a commit to danpalmer/gemini-cli that referenced this pull request Nov 29, 2025
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.

Improve test coverage for src/zed-integration

2 participants