-
Notifications
You must be signed in to change notification settings - Fork 1
Update http client and content caching #146
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
Conversation
thelovekesh
commented
Jan 15, 2026
- Update http client to use cache round tripper
- Add content caching for manifests and tarballs
- Update installer to remove caching layer from it
- Update registry API client
Summary of ChangesHello @thelovekesh, 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 introduces a significant architectural improvement by centralizing content caching within the HTTP client. This change streamlines the package installation process by allowing the installer to rely on a unified and efficient caching layer for registry manifests and tarballs, rather than managing its own. The refactoring enhances performance, reduces redundant network requests, and improves the overall reliability of file operations, especially on platforms like Windows. 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 significantly refactors the caching mechanism for API requests, moving from a simple time-to-live file-based cache to a more robust, atomic, and concurrent-safe HTTP cache implemented via a new api.Transport struct. This new cache supports explicit cache control headers like X-Save-Cache and X-Cache-Revalidate, and includes advanced features like single-flight request deduplication, file locking with retries, and atomic file operations with Windows compatibility considerations. Consequently, the cli/command/auth/login.go and cli/command/whoami/whoami.go commands are updated to leverage a centralized wpmCli.RegistryClient() for token validation and API interactions, and now utilize new output.Text for colored CLI messages. The pkg/pm/installer/installer.go is also refactored to remove the otiai10/copy dependency, streamline package installation by directly processing downloaded tarballs into a temporary directory (.tmp) within the content directory, and implement more resilient file operations (rename, remove) with retry logic for Windows. Several WriteString calls across the codebase are updated to explicitly ignore return values, and cache-related configuration fields are consolidated or removed from api.ClientOptions and pkg/config/config.go.
|
|
||
| return g.Wait() | ||
| err := g.Wait() | ||
| os.RemoveAll(i.tmpDir) |
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.
The os.RemoveAll(i.tmpDir) call is made unconditionally after g.Wait(). If g.Wait() returns an error, it might be useful to inspect the contents of i.tmpDir for debugging purposes before it's removed. Consider adding a flag or logging mechanism to preserve tmpDir in case of errors, especially during development or in verbose modes.