Skip to content

fix(internal/librarian): test logic should look for service and message/enums separately#2809

Merged
zhumin8 merged 4 commits intomainfrom
test-find
Nov 6, 2025
Merged

fix(internal/librarian): test logic should look for service and message/enums separately#2809
zhumin8 merged 4 commits intomainfrom
test-find

Conversation

@zhumin8
Copy link
Copy Markdown
Contributor

@zhumin8 zhumin8 commented Nov 6, 2025

With this change, the test now tracks services separately from messages/enums in proto files and provides more coverage.
Instead of only tracking a comment change for the first found message/enum/service, it now tracks a first service and first message/enum if both are present in the proto file.

Fix #2623

@zhumin8 zhumin8 requested a review from a team as a code owner November 6, 2025 16:28
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @zhumin8, 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 refines the testing framework for proto file generation by introducing a more sophisticated mechanism for detecting and validating changes. Previously, the test might have missed certain modifications within a proto file if it only registered a single change. The updated logic now independently identifies and tracks changes to both services and messages/enums, ensuring that the generated code accurately reflects all relevant modifications in the source proto files. This enhancement directly addresses issue #2623, leading to more robust and reliable generation tests.

Highlights

  • Enhanced Test Coverage: The test logic for proto file generation now tracks services separately from messages and enums, providing more granular and comprehensive coverage.
  • Multiple GUID Injection: Instead of injecting a single GUID per proto file, the system can now inject multiple GUIDs, one for the first found service and another for the first found message/enum, if both are present.
  • Refactored GUID Injection Logic: The functions responsible for injecting GUIDs into proto files have been refactored to support the new multiple-GUID injection strategy, improving the simulation of changes for testing purposes.
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.

@zhumin8
Copy link
Copy Markdown
Contributor Author

zhumin8 commented Nov 6, 2025

/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 effectively improves the test coverage for proto file generation by separately tracking changes for services and messages/enums. The logic is sound, and the changes are well-implemented across both the main logic and the test files. The introduction of new test cases for service-only and message-only protos is a great addition. I have one suggestion to make the code slightly more idiomatic, but overall this is a solid improvement.

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 correctly implements the logic to inject separate test GUIDs for services and messages/enums in proto files, which improves test coverage. The changes are logical and the tests have been updated accordingly to cover the new functionality. I have one suggestion to refactor a new helper function to improve code clarity and maintainability by reducing side effects.

@codecov
Copy link
Copy Markdown

codecov bot commented Nov 6, 2025

Codecov Report

❌ Patch coverage is 95.65217% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.80%. Comparing base (f042d0b) to head (644ba14).
⚠️ Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
internal/librarian/test_container_generate.go 95.65% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2809      +/-   ##
==========================================
+ Coverage   86.50%   86.80%   +0.30%     
==========================================
  Files         120      120              
  Lines       10232    10574     +342     
==========================================
+ Hits         8851     9179     +328     
- Misses        977      989      +12     
- Partials      404      406       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zhumin8 zhumin8 merged commit fb8c557 into main Nov 6, 2025
8 checks passed
@zhumin8 zhumin8 deleted the test-find branch November 6, 2025 18:56
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.

librarian: container testing - implement test logic

2 participants