fix(auth): prioritize local project configuration over global ADC for quota attribution#295
Conversation
… quota attribution
🦋 Changeset detectedLatest commit: 0af9670 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Summary of ChangesHello, 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 issue where Google API requests were failing due to an incorrect project ID being used for quota attribution. It introduces a robust prioritization mechanism to ensure that the project ID explicitly configured by the user, either through environment variables or local setup, is honored over globally detected Application Default Credentials. This change prevents unexpected 403 errors and improves the reliability of API interactions. Highlights
Changelog
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.
Code Review
This pull request correctly updates the project ID prioritization for quota attribution, ensuring that local or environment-specific configurations take precedence over global Application Default Credentials (ADC). The new logic is sound, follows a sensible priority order, and is accompanied by thorough unit tests that validate each level of the priority system. The associated documentation changes in README.md, AGENTS.md, and the command-line help text are accurate and clearly reflect the new behavior. Overall, this is a well-implemented fix that directly addresses the reported issue.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request updates the project ID prioritization for quota attribution. The new logic in src/auth.rs checks for a project ID from the GOOGLE_WORKSPACE_PROJECT_ID environment variable, then from the local client configuration file, before falling back to the Application Default Credentials (ADC). This change is accompanied by new unit tests to verify the new priority order and updates to documentation files to reflect the new behavior. I have reviewed the changes and found no high or critical severity issues.
This PR updates the project ID prioritization to ensure that the project configured during setup (or via environment variables) takes precedence over global Application Default Credentials (ADC) for quota attribution. This fixes the issue where requests were failing with 403 errors when the Drive API was not enabled in a project picked up from global gcloud settings.\n\nFixes #273