-
Notifications
You must be signed in to change notification settings - Fork 37
feat(sidekick/rust): Accept wildcard typed resources for sample generatio #3677
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat(sidekick/rust): Accept wildcard typed resources for sample generatio #3677
Conversation
Summary of ChangesHello @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
🧠 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 AssistThe 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
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 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
|
There was a problem hiding this 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 Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
67f4eba to
ef7f3c4
Compare
|
/gemini review |
There was a problem hiding this 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
ef7f3c4 to
0297661
Compare
|
/gemini review |
There was a problem hiding this 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.
|
/gemini review |
There was a problem hiding this 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.
|
This is ready for review, generation results can be seen in googleapis/google-cloud-rust#4324. Thanks. |
|
/gemini review |
There was a problem hiding this 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.
Wildcard typed resources are accepted in some cases to identify standard methods. This commit also refactors out code for future reuse.