-
Notifications
You must be signed in to change notification settings - Fork 0
Node18/conformance test #25
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: node-18
Are you sure you want to change the base?
Conversation
* refactor: Remove abort-controller dependency * test refactor
Summary of ChangesHello @thiyaguk09, 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 refactors the conformance test suite by shifting many test methods to directly interact with the 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 refactors the conformance tests to interact with the transport layer directly, which is a solid approach for testing retry logic. The changes also include improvements to the default retry function in the main library. The overall direction is good, but I've identified a few issues, primarily concerning error handling, type safety, and a bug in header manipulation within the test suite. Addressing these will improve the robustness and reliability of the tests.
|
/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 conformance tests to use the transport layer directly, allowing for more granular testing of retry logic. The changes are extensive and mostly involve rewriting library methods to make direct REST API calls. I've found a couple of critical issues in the new test setup logic that could lead to runtime errors or incorrect behavior. Additionally, there are a few instances of commented-out code that should be removed for cleanliness. The improvements to the retryable error detection function in src/storage.ts are well-done and increase robustness.
|
/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 significant refactoring to the conformance tests, primarily to align with Node.js 18 and to test retry logic at the transport layer. The changes involve bypassing high-level SDK methods in favor of direct calls to storageTransport.makeRequest, implementing a complex custom retry strategy, and updating various test helper functions. My review focuses on improving type safety, removing leftover debugging code, and enhancing code clarity in these new implementations.
|
/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 conformance tests to use a lower-level transport layer for making requests, which provides better control for retry tests. The changes also include a more sophisticated and specific retry logic in the StorageTransport. The overall direction is good, but I've found a few areas for improvement: some test helper functions are still using the old SDK methods, and there's a potential bug in header handling within the transport layer. Additionally, the new retry logic could be refactored for better readability.
All 720 test cases have been fixed, and the code has been refactored.
- Replace high-level bucket and file calls with storageTransport.makeRequest. - Fix Scenario 1 failures by implementing "create-or-get" logic for buckets. - Resolve metageneration mismatch in lock() by dynamically fetching metadata. - Normalize header keys to lowercase in transport response processing. - Increase unit test coverage for shouldRetry logic and error handling.
- Fixed authentication headers/token exchange in the transport layer. - Reverted to single-shot resumable upload to isolate Scenario 7 failures while debugging mid-stream offset recovery.
19249f4 to
0d23d09
Compare
0d23d09 to
ed49471
Compare
|
/gemini review |
1 similar comment
|
/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 a significant refactoring of the conformance tests to directly target the transport layer, bypassing the high-level client methods. This is a great step for ensuring low-level correctness. The PR also includes a crucial improvement to the retry logic by making it idempotency-aware, which greatly enhances the safety and correctness of request retries. My review focuses on the new test implementations and the updated retry mechanism. I've identified a potential unhandled exception in the test setup and suggested improvements for type safety in the new test methods.
| await options.storageTransport.makeRequest(existsReq); | ||
| bucketExists = true; |
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 check for bucket existence at line 124 will throw an unhandled exception if the bucket does not exist, because makeRequest rejects on non-2xx status codes like 404. This will cause the test to fail instead of proceeding to create the bucket. You should wrap this call in a try...catch block to handle the 404 case gracefully, similar to how it's done in the bucketExists function in this same file.
try {
await options.storageTransport.makeRequest(existsReq);
bucketExists = true;
} catch (e) {
const err = e as GaxiosError;
if (err.response?.status !== 404) {
throw e;
}
}| // eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
| const objects = (listResult as any)?.items || []; |
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 use of as any to access response properties like items and nextPageToken bypasses TypeScript's type safety. This pattern is repeated throughout the file. It would be more robust to define simple interfaces for the expected API responses and use generics with makeRequest.
For example, for this object listing operation, you could do:
interface ObjectList {
items?: { name: string }[];
nextPageToken?: string;
}
// ... in the loop ...
const listResult = await options.storageTransport.makeRequest<ObjectList>(listReq);
const objects = listResult?.items || [];
// ... later ...
pageToken = listResult?.nextPageToken;This would improve code clarity, maintainability, and help catch potential issues at compile time.
Description
Impact
Testing
Additional Information
Checklist
Fixes #issue_number_goes_here 🦕