Merge the rename PR to epic/issue-285-api-client-v2 - #291
Conversation
Summary of ChangesHello @kyasbal, 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 primarily focuses on a refactoring effort to improve code clarity by renaming a core caching data structure. The change involves updating the type name Highlights
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 primarily renames PreviousTaskResult to CachableTaskResult. I've identified a typo in the new name (Cachable should be Cacheable) and suggested a fix at the type definition. This correction should be applied to all usages of the type for consistency. Additionally, I've found and suggested fixes for two instances where errors from the GCP client factory were being ignored, which could lead to silent failures.
| client, err := googlecloudapi.DefaultGCPClientFactory.NewClient() | ||
| if err != nil { | ||
| return inspectiontaskbase.PreviousTaskResult[*googlecloudk8scommon_contract.AutocompleteClusterNameList]{}, nil | ||
| return inspectiontaskbase.CachableTaskResult[*googlecloudk8scommon_contract.AutocompleteClusterNameList]{}, nil |
There was a problem hiding this comment.
The error from googlecloudapi.DefaultGCPClientFactory.NewClient() is not being propagated. It should be returned instead of nil to ensure proper error handling.
| return inspectiontaskbase.CachableTaskResult[*googlecloudk8scommon_contract.AutocompleteClusterNameList]{}, nil | |
| return inspectiontaskbase.CachableTaskResult[*googlecloudk8scommon_contract.AutocompleteClusterNameList]{}, err |
| client, err := googlecloudapi.DefaultGCPClientFactory.NewClient() | ||
| if err != nil { | ||
| return inspectiontaskbase.PreviousTaskResult[*googlecloudk8scommon_contract.AutocompleteClusterNameList]{}, nil | ||
| return inspectiontaskbase.CachableTaskResult[*googlecloudk8scommon_contract.AutocompleteClusterNameList]{}, nil |
There was a problem hiding this comment.
The error from googlecloudapi.DefaultGCPClientFactory.NewClient() is not being propagated. It should be returned instead of nil to ensure proper error handling.
| return inspectiontaskbase.CachableTaskResult[*googlecloudk8scommon_contract.AutocompleteClusterNameList]{}, nil | |
| return inspectiontaskbase.CachableTaskResult[*googlecloudk8scommon_contract.AutocompleteClusterNameList]{}, err |
| // CachableTaskResult is the combination of the cached value and a digest of its dependency. | ||
| type CachableTaskResult[T any] struct { |
There was a problem hiding this comment.
There's a typo in the struct name and its comment. Cachable should be Cacheable. This name is used across multiple files in this PR, so the fix should be applied to all its usages.
| // CachableTaskResult is the combination of the cached value and a digest of its dependency. | |
| type CachableTaskResult[T any] struct { | |
| // CacheableTaskResult is the combination of the cached value and a digest of its dependency. | |
| type CacheableTaskResult[T any] struct { |
This is already reviewed on main branch. Review is not required.