Skip to content

fix(test-utils): resolve circular dependency#16731

Closed
sehoon38 wants to merge 1 commit into
mainfrom
sehoon/resolve_cir_dependency
Closed

fix(test-utils): resolve circular dependency#16731
sehoon38 wants to merge 1 commit into
mainfrom
sehoon/resolve_cir_dependency

Conversation

@sehoon38

@sehoon38 sehoon38 commented Jan 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Resolves a circular dependency between test-utils and core by hardcoding GEMINI_DIR and DEFAULT_GEMINI_MODEL in test-utils instead of importing them from @google/gemini-cli-core.

Details

Previously, packages/test-utils/src/test-rig.ts imported constants from @google/gemini-cli-core. This created a circular dependency chain. This PR breaks that chain by defining the necessary constants locally within the test utility.

Related Issues

Fixes #16732

How to Validate

Run the tests to ensure that the test rig still functions correctly:

npm run test:scripts

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

@sehoon38 sehoon38 requested a review from a team as a code owner January 15, 2026 07:13
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @sehoon38, 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 addresses a critical architectural issue by eliminating a circular dependency that existed between the test-utils and core modules. By internalizing specific constant definitions within the test-utils package, the change ensures a cleaner and more stable module graph, preventing potential issues related to module loading and improving overall project maintainability.

Highlights

  • Circular Dependency Resolution: This pull request resolves a circular dependency between the test-utils and core packages. The constants GEMINI_DIR and DEFAULT_GEMINI_MODEL are now hardcoded directly within test-utils instead of being imported from @google/gemini-cli-core.
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.

@gemini-cli

gemini-cli Bot commented Jan 15, 2026

Copy link
Copy Markdown
Contributor

Hi @sehoon38, thank you so much for your contribution to Gemini CLI! We really appreciate the time and effort you've put into this.

We're making some updates to our contribution process to improve how we track and review changes. Please take a moment to review our recent discussion post: Improving Our Contribution Process & Introducing New Guidelines.

Key Update: Starting January 26, 2026, the Gemini CLI project will require all pull requests to be associated with an existing issue. Any pull requests not linked to an issue by that date will be automatically closed.

Thank you for your understanding and for being a part of our community!

@github-actions

Copy link
Copy Markdown

Size Change: -2 B (0%)

Total Size: 23.1 MB

ℹ️ View Unchanged
Filename Size Change
./bundle/gemini.js 23 MB -2 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

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

Copy link
Copy Markdown
Contributor

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 resolves a circular dependency between test-utils and core by hardcoding two constants, GEMINI_DIR and DEFAULT_GEMINI_MODEL, within test-utils. While this effectively breaks the cycle, it introduces code duplication. This can create maintenance challenges, as changes to these constants in the core package will require manual updates in test-utils to prevent inconsistencies. My review includes a suggestion to consider alternative, more robust solutions like dependency injection or creating a shared constants package to mitigate this risk.

Comment on lines +21 to +22
const GEMINI_DIR = '.gemini';
const DEFAULT_GEMINI_MODEL = 'gemini-2.5-pro';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

While hardcoding these constants breaks the circular dependency, it introduces duplication. If these values change in @google/gemini-cli-core, they will also need to be updated here manually. This could lead to tests becoming out of sync with the application's behavior, especially for DEFAULT_GEMINI_MODEL which might change over time.

To create a more maintainable solution, consider one of the following alternatives:

  1. Dependency Injection: Modify TestRig to accept these values through its constructor or setup method. The test files that use TestRig can then import the constants from @google/gemini-cli-core and pass them in. This keeps test-utils decoupled while avoiding duplication.

  2. Shared Constants Package: For a more robust long-term solution, you could extract these and other shared constants into a new, lower-level package (e.g., @google/gemini-cli-constants). Both core and test-utils could then depend on this new package without creating a circular dependency.

@sehoon38

Copy link
Copy Markdown
Contributor Author

using this to resolve #16730

@sehoon38 sehoon38 closed this Jan 15, 2026
@jacob314 jacob314 deleted the sehoon/resolve_cir_dependency branch February 19, 2026 07:14
@sripasg sripasg added the size/xs An extra small PR label Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/xs An extra small PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Fix circular dependency between test-utils and core

2 participants