Skip to content

Conversation

@amanda-tarafa
Copy link
Contributor

Wildcard typed resources are accepted in some cases to identify standard methods. This commit also refactors out code for future reuse.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @amanda-tarafa, 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 enhances the Sidekick API model's ability to recognize and process standard AIP methods by introducing support for wildcard typed resources in request fields. This change ensures that methods using flexible resource references are correctly identified, improving the accuracy of sample generation and overall API understanding. The implementation also includes a strategic refactoring of resource field lookup logic into reusable helper functions, accompanied by robust test coverage, to boost code maintainability and reliability.

Highlights

  • Wildcard Resource Type Support: The API model now correctly identifies standard AIP Get and Delete methods even when their request messages use wildcard ("*") resource reference types, enhancing flexibility in method recognition.
  • Code Refactoring for Reusability: Introduced two new helper functions, findBestResourceFieldByType and findBestResourceFieldBySingular, to centralize and improve the logic for identifying resource reference fields within messages.
  • Enhanced Test Coverage: Added a new test fixture and comprehensive unit tests for the newly introduced helper functions, including scenarios involving wildcard resource references and priority rules for field selection.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

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.

amanda-tarafa added a commit to amanda-tarafa/google-cloud-rust that referenced this pull request Jan 21, 2026
Copy link
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 support for wildcard typed resources and refactors the logic for finding resource fields into reusable helper functions. The changes are well-structured, and the addition of a test fixture in model_test.go is a great improvement for test readability and maintenance.

I've found a couple of issues with the prioritization logic in the new helper functions, which don't fully align with the logic described in the comments. This could lead to incorrect field selection depending on the order of fields in a message. I've also noted a couple of minor style guide violations in the new tests.

Please note that the pull request title seems to have a couple of typos: it references sidekick/rust but the changes are in Go files, and generatio is likely a typo for generation.

@codecov
Copy link

codecov bot commented Jan 21, 2026

Codecov Report

❌ Patch coverage is 93.93939% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 82.44%. Comparing base (737e0d3) to head (33d18be).

Files with missing lines Patch % Lines
internal/sidekick/api/model.go 93.93% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3677   +/-   ##
=======================================
  Coverage   82.43%   82.44%           
=======================================
  Files         138      138           
  Lines       12657    12673   +16     
=======================================
+ Hits        10434    10448   +14     
- Misses       1733     1734    +1     
- Partials      490      491    +1     

☔ 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.

@amanda-tarafa amanda-tarafa force-pushed the wildcard-resource-for-samples branch from 67f4eba to ef7f3c4 Compare January 21, 2026 19:33
@amanda-tarafa
Copy link
Contributor Author

/gemini review

Copy link
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 refactors the logic for finding resource fields into new reusable functions and adds support for wildcard typed resources. The refactoring improves code structure and the new test suite uses a fixture to reduce boilerplate, which is a great improvement.

However, I've identified a critical logic bug in the priority implementation within the new findBestResourceFieldByType and findBestResourceFieldBySingular functions. Their correctness currently relies on the order of fields in the input message, which is brittle. The associated tests pass only due to the specific ordering of test data. I've provided detailed comments with suggested fixes for these functions and recommendations for strengthening the tests to prevent similar issues in the future.

Additionally, the pull request title's scope sidekick/rust appears to be a typo, as all changes are within Go files. It would be clearer if this was updated to sidekick/api or a similar relevant scope.

…ation.

- Wildcard typed resources are accepted in some cases to identify standard methods.
- This commit also refactors out code for future reuse.
- Generation results in googleapis/google-cloud-rust#4324
@amanda-tarafa amanda-tarafa force-pushed the wildcard-resource-for-samples branch from ef7f3c4 to 0297661 Compare January 21, 2026 19:45
@amanda-tarafa
Copy link
Contributor Author

/gemini review

Copy link
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 refactors the logic for identifying standard API methods by extracting field-finding logic into reusable helper functions. This change also introduces support for wildcard resource types, which is a good enhancement. The refactoring improves code clarity and the new logic is well-covered by tests.

My review includes a few suggestions to improve documentation and test code quality:

  • The comments for the new helper functions could be more precise about the prioritization logic.
  • The new table-driven tests can be updated to fully align with the project's Go style guide.
  • The test case names in the new tests could be more descriptive to improve clarity.

@amanda-tarafa
Copy link
Contributor Author

/gemini review

Copy link
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 support for wildcard typed resources and refactors the logic for finding resource fields into new helper functions, findBestResourceFieldByType and findBestResourceFieldBySingular. This is a good improvement for code organization and reusability. The test suite has been updated comprehensively with a new test fixture and new tests for the extracted functions, ensuring the changes are well-covered. I have a few minor suggestions regarding code formatting to align with the repository's style guide.

@amanda-tarafa amanda-tarafa marked this pull request as ready for review January 21, 2026 20:30
@amanda-tarafa amanda-tarafa requested a review from a team as a code owner January 21, 2026 20:30
@amanda-tarafa
Copy link
Contributor Author

This is ready for review, generation results can be seen in googleapis/google-cloud-rust#4324. Thanks.

@amanda-tarafa
Copy link
Contributor Author

/gemini review

Copy link
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 support for wildcard typed resources (*) when identifying standard Get and Delete methods, which is a useful enhancement. The refactoring of resource field lookup logic into the new findBestResourceFieldByType and findBestResourceFieldBySingular functions is a great improvement for code clarity and reusability. The test suite has been significantly improved with the addition of a test fixture (aipTestFixture) and comprehensive tests for the new helper functions.

My review includes a few suggestions to remove excessive blank lines to better align with the repository's style guide.

Also, as a minor note, the PR title mentions rust but the changes are in Go files. You might want to correct that for consistency.

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.

3 participants