Repository navigation
fix: preserve AuthError type in oauth_http_client cache - #1152
Conversation
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 refactors the Highlights
Changelog
Activity
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 refactors the oauth_http_client function to cache the AuthError type directly, instead of just a string representation of the error. This is a good improvement as it preserves the typed error information in the cache path and avoids unnecessary string conversions. The changes are correct and well-implemented, including deriving Clone on the AuthError enum to support this caching strategy. The suggestion to improve error semantics further by introducing a more specific AuthError variant for the client build failure, instead of reusing AuthError::Http, aligns with best practices for clear error handling and has been retained.
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
henrypark133
left a comment
There was a problem hiding this comment.
Review: typed cache error is cleaner and the scope stays tight
This is a small improvement, but it moves the cache path in the right direction: the static client cache now keeps AuthError instead of immediately erasing it to String and re-wrapping later.
Positives:
- The change is narrowly scoped to the cache path.
- Deriving
CloneonAuthErroris reasonable for the current enum shape. - Meaningful CI is green.
No blocking issues from my side.
* fix(mcp): cache oauth client init error as AuthError * Update src/tools/mcp/auth.rs Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * fix(mcp): use AuthError::Http in oauth client cache and add regression test * test(mcp): annotate test assert for no-panics CI matcher --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
* fix(mcp): cache oauth client init error as AuthError * Update src/tools/mcp/auth.rs Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> * fix(mcp): use AuthError::Http in oauth client cache and add regression test * test(mcp): annotate test assert for no-panics CI matcher --------- Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Summary
oauth_http_client()static cache type fromResult<Client, String>toResult<Client, AuthError>AuthError::HttpWhy
Issue #1141 reported that we were storing stringified errors in the static cache and only re-wrapping at read time. This loses typed error context in the cache path and adds unnecessary conversion.
Fixes #1141
Validation
cargo test -p ironclaw tools::mcp::auth::tests::test_auth_error_display_strings -- --nocapturecargo clippy -p ironclaw --all-targets -- -D warnings