-
Notifications
You must be signed in to change notification settings - Fork 0
Restart delete resumable upload v4 test1 #38
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: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Neha Bajaj <bajajneha27@users.noreply.github.com>
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.
Summary of Changes
Hello @shubhangi-google, 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 enhances the Google Cloud Storage Ruby client library by adding direct support for managing resumable uploads. It provides developers with the ability to programmatically restart interrupted uploads and explicitly delete incomplete upload sessions, improving the robustness and control over data transfers.
Highlights
- New Resumable Upload Management: Introduced new methods
restart_resumable_uploadanddelete_resumable_uploadto theBucketclass, allowing for better control over large file transfers in Google Cloud Storage. - API Integration: Implemented corresponding
restart_resumable_uploadanddelete_resumable_uploadmethods within theServicelayer to facilitate interaction with the underlying Google Cloud Storage API. - Dependency Update: Updated the
google-apis-storage_v1gem dependency to version>= 0.56to ensure compatibility and access to the necessary API features for the new resumable upload functionality. - Comprehensive Testing: Added new test cases for both
restart_resumable_uploadanddelete_resumable_uploadmethods, covering functionality and argument validation, along with a new test helper. - Tooling Regex Fix: Corrected a minor regex pattern in batch review tooling scripts (
.toys/batch-review-legacy.rband.toys/batch-review.rb) for snippet metadata file paths.
Using Gemini Code Assist
The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.
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
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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 functionality to restart and delete resumable uploads. The changes are well-structured, including updates to the service and bucket classes, dependency bumps, and new tests. My review includes suggestions to improve the accuracy of the YARD documentation for the new methods and to clean up some unused variables in the tests for better maintainability.
| # @return [Google::Apis::StorageV1::Object, Integer] | ||
| # The object metadata on success, or 0 request is not completed. |
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 return type documentation appears to be inaccurate. It states that the method can return an Integer (specifically 0) if the request is not completed. However, within this library, an incomplete or failed request typically raises an exception rather than returning a special value. On success, the method should return the Google::Apis::StorageV1::Object. Please update the documentation to reflect this expected behavior.
# @return [Google::Apis::StorageV1::Object]
# The object metadata on success.| # Delete resumable upload | ||
| # @param [String] upload_id Unique Id of a resumable upload | ||
| # | ||
| # @return [Boolean,nil] Returns `true` if the resumable upload was deleted, 'nil' if the request is not completed. |
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 return type documentation [Boolean,nil] and the explanation are a bit confusing. The mention of nil for an incomplete request is ambiguous, as failed requests typically raise exceptions. For clarity and consistency, it's better for methods that perform a DELETE operation to return true on success. I'll provide a suggestion on the method implementation to align with this.
# @return [Boolean] Returns `true` if the resumable upload was deleted.| def delete_resumable_upload upload_id | ||
| ensure_service! | ||
| raise ArgumentError, "Upload Id missing" unless upload_id | ||
| service.delete_resumable_upload name, upload_id | ||
| end |
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.
To provide a clear success signal to the caller, this method should explicitly return true after the service call completes successfully. The underlying service call for a successful delete might return nil (on an HTTP 204 response), so returning true makes the method's contract more robust and aligns with both the test expectation and the recommended documentation change.
def delete_resumable_upload upload_id
ensure_service!
raise ArgumentError, "Upload Id missing" unless upload_id
service.delete_resumable_upload name, upload_id
true
end| end | ||
|
|
||
| it "raises ArgumentError if anyone or both arguments are not provided to restart_resumable_upload" do | ||
| new_file_name = random_file_path |
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.
| end | ||
|
|
||
| it "raises ArgumentError if upload_id as nil is provided to restart_resumable_upload" do | ||
| new_file_name = random_file_path |
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.
| new_file_name = random_file_path | ||
| upload_id = "TEST_ID" |
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.
| end | ||
|
|
||
| it "raises ArgumentError if upload_id as nil is provided to delete_resumable_upload" do | ||
| new_file_name = random_file_path |
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.
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly:
bundle exec rake ciin the gem subdirectory.closes: #<issue_number_goes_here>