GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(experimental): add write resumption strategy by Pulkit0110 · Pull Request #1663 · googleapis/python-storage

This repository was archived by the owner on Mar 31, 2026. It is now read-only.

Conversation

@Pulkit0110

@Pulkit0110 Pulkit0110 commented Dec 15, 2025

Copy link
Copy Markdown
Contributor

Adding writes resumption strategy which will be used for error handling of bidi writes operation.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@Pulkit0110
Pulkit0110 requested review from a team December 15, 2025 07:17
@Pulkit0110
Pulkit0110 requested a review from a team as a code owner December 15, 2025 07:17
@product-auto-label product-auto-label Bot added the size: xl Pull request size is extra large. label Dec 15, 2025
@blunderbuss-gcf blunderbuss-gcf Bot assigned chandra-siri Dec 15, 2025
@product-auto-label product-auto-label Bot added the api: storage Issues related to the googleapis/python-storage API. label Dec 15, 2025
@gemini-code-assist

gemini-code-assist Bot commented Dec 15, 2025

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @Pulkit0110, 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 enhances the reliability of asynchronous bidirectional streaming operations by introducing a comprehensive write resumption strategy and a generic retry manager. This refactoring centralizes error handling and retry logic, making both read and write operations more resilient to transient failures and network interruptions. The changes ensure that data transfers can seamlessly resume from the last known good state, improving the overall robustness of the system.

Highlights

  • Write Resumption Strategy: Introduced a new _WriteResumptionStrategy to provide robust error handling and resumption capabilities for bidirectional streaming write operations.
  • Generic Bidi Stream Retry Manager: Implemented a generic _BidiStreamRetryManager to centralize retry logic for all bidirectional streaming operations, making it reusable for both reads and writes.
  • Refactored Read Resumption: The AsyncMultiRangeDownloader was refactored to utilize the new _BidiStreamRetryManager and an updated _ReadResumptionStrategy, moving checksum and offset validation into the strategy.
  • Retry Policy Integration: The open and download_ranges methods in AsyncMultiRangeDownloader now accept an AsyncRetry policy, allowing callers to customize retry behavior.
  • Improved Data Integrity Checks: Checksum and offset validation logic for read operations has been enhanced and moved into the _ReadResumptionStrategy, ensuring data integrity during stream resumption.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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

  1. 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. ↩

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gemini-code-assist[bot]
gemini-code-assist Bot reviewed Dec 15, 2025
View reviewed changes

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 generic retry manager for bidi streams and applies it to read operations, which is a great improvement for resiliency. It also adds a resumption strategy for write operations. The overall structure is well-designed and the new tests are comprehensive. I've found one critical issue that will cause a TypeError at runtime due to a method being called with an unexpected argument. I've also included a couple of medium-severity comments to improve documentation clarity and maintainability in the new strategy classes.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google/cloud/storage/_experimental/asyncio/async_multi_range_downloader.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/storage/_experimental/asyncio/retry/reads_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/storage/_experimental/asyncio/retry/writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@Pulkit0110
Pulkit0110 force-pushed the bidi-writes-retry branch from 7d63612 to 8c2a143 Compare December 26, 2025 10:10
@product-auto-label product-auto-label Bot added size: l Pull request size is large. and removed size: xl Pull request size is extra large. labels Dec 26, 2025
@Pulkit0110

Pulkit0110 commented Dec 26, 2025

Copy link
Copy Markdown
Contributor Author

/gemini review

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gemini-code-assist[bot]
gemini-code-assist Bot reviewed Dec 26, 2025
View reviewed changes

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

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 write resumption strategy for handling bidi write operations, which is a valuable addition for improving error handling in experimental async features. The implementation is well-structured and accompanied by a comprehensive set of unit tests that cover various scenarios, including initial uploads, resumption, and failure recovery. My feedback focuses on enhancing type safety, improving code clarity by addressing a potentially unused flag, and increasing the robustness of the tests by using mocks instead of None.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread google/cloud/storage/_experimental/asyncio/retry/writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/storage/_experimental/asyncio/retry/writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/unit/asyncio/retry/test_writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@chandra-siri

chandra-siri commented Dec 29, 2025

Copy link
Copy Markdown
Collaborator

/gemini summary

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@gemini-code-assist

gemini-code-assist Bot commented Dec 29, 2025

Copy link
Copy Markdown
Contributor

Summary of Changes

This pull request introduces an experimental write resumption strategy for asynchronous bidirectional write operations within the Google Cloud Storage client library. This new strategy significantly enhances the reliability of data uploads by providing robust mechanisms to handle errors, track the state of ongoing writes, and seamlessly resume operations from the last successfully persisted byte, thereby improving data integrity and resilience against transient network issues or server redirects.

Highlights

  • New Write Resumption Strategy: Introduced _WriteResumptionStrategy and _WriteState to provide robust error handling and resumption capabilities for asynchronous bidirectional write operations. This strategy manages the state of an upload, including write_handle, routing_token, persisted_size, and bytes_sent.
  • Request Generation and Checksumming: The strategy generates BidiWriteObjectRequests, incorporating AppendObjectSpec, state_lookup for resumption, and data chunks with CRC32C checksums for data integrity. It also handles the finish_write signal for completing uploads.
  • Error Recovery Mechanism: Includes logic to update the write state based on server responses and to recover from failures, specifically BidiWriteObjectRedirectedError. Upon failure, the user buffer is rewound to the last known persisted_size to facilitate seamless resumption.
  • Comprehensive Unit Tests: Added a new test file (test_writes_resumption_strategy.py) with extensive unit tests to validate the functionality of the _WriteResumptionStrategy, covering initial uploads, resumption scenarios, error recovery, and checksumming.
  • Minor Formatting Adjustments: Minor formatting changes were applied to an existing test file (test_reads_resumption_strategy.py) to align with code style guidelines.

🧠 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.

Changelog
  • google/cloud/storage/_experimental/asyncio/retry/writes_resumption_strategy.py
    • Added a new module defining _WriteState to track the progress and state of an upload operation.
    • Implemented _WriteResumptionStrategy to manage the generation of write requests, processing of server responses, and recovery from failures for bidirectional writes.
  • tests/unit/asyncio/retry/test_reads_resumption_strategy.py
    • Applied minor formatting changes to improve code readability and consistency.
  • tests/unit/asyncio/retry/test_writes_resumption_strategy.py
    • Added a new test suite to thoroughly validate the functionality of the _WriteResumptionStrategy, including tests for initial uploads, empty files, resumption, error handling, and checksum verification.
Activity
  • gemini-code-assist[bot] provided an initial summary of the changes and several review comments, highlighting critical and medium priority suggestions.
  • Pulkit0110 (the author) addressed multiple review comments, including updating type hints, removing an unused first_request flag, and improving test robustness by using mock objects for _WriteState initialization.
  • chandra-siri requested a summary of the pull request.
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chandra-siri
chandra-siri suggested changes Dec 29, 2025
View reviewed changes
Comment thread google/cloud/storage/_experimental/asyncio/retry/writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/storage/_experimental/asyncio/retry/writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/storage/_experimental/asyncio/retry/writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/storage/_experimental/asyncio/retry/writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/unit/asyncio/retry/test_writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/unit/asyncio/retry/test_writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/storage/_experimental/asyncio/retry/writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread tests/unit/asyncio/retry/test_writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/storage/_experimental/asyncio/retry/writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

@Pulkit0110
Pulkit0110 requested a review from chandra-siri December 30, 2025 10:16
chandra-siri
chandra-siri suggested changes Dec 31, 2025
View reviewed changes
Comment thread google/cloud/storage/_experimental/asyncio/retry/writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/storage/_experimental/asyncio/retry/writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/storage/_experimental/asyncio/retry/writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/storage/_experimental/asyncio/retry/writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/storage/_experimental/asyncio/retry/writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/storage/_experimental/asyncio/retry/writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/storage/_experimental/asyncio/retry/writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/storage/_experimental/asyncio/retry/writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/storage/_experimental/asyncio/retry/writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread google/cloud/storage/_experimental/asyncio/retry/writes_resumption_strategy.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Pulkit0110 added 5 commits January 2, 2026 09:04
@Pulkit0110
integrate retry logic with the MRD
cc7fb6f
@Pulkit0110
feat(experimental): add write resumption strategy
f1f8d65
@Pulkit0110
address gemini bot comments
9a086e4
@Pulkit0110
addressing comments:
7abfae0
@Pulkit0110
resolve comments
a3f6254
@Pulkit0110
Pulkit0110 force-pushed the bidi-writes-retry branch from 8aba092 to a3f6254 Compare January 2, 2026 09:05
@Pulkit0110
Pulkit0110 requested a review from chandra-siri January 2, 2026 09:28
chandra-siri
chandra-siri approved these changes Jan 2, 2026
View reviewed changes
@Pulkit0110
Pulkit0110 merged commit a57ea0e into googleapis:main Jan 2, 2026
@release-please release-please Bot mentioned this pull request Jan 2, 2026
chore(main): release 3.8.0 #1669
Closed
@vchudnov-g vchudnov-g mentioned this pull request Jan 12, 2026
chore: librarian release pull request: 20260112T135255Z #1701
Closed
@parthea parthea mentioned this pull request Jan 13, 2026
chore: librarian release pull request: 20260113T144551Z #1704
Merged
vchudnov-g added a commit that referenced this pull request Jan 13, 2026
@parthea @vchudnov-g
chore: librarian release pull request: 20260113T144551Z (#1704)
16cf512
PR created by the Librarian CLI to initialize a release. Merging this PR
will auto trigger a release.

Librarian Version: v0.7.0
Language Image:
us-central1-docker.pkg.dev/cloud-sdk-librarian-prod/images-prod/python-librarian-generator@sha256:8e2c32496077054105bd06c54a59d6a6694287bc053588e24debe6da6920ad91
<details><summary>google-cloud-storage: 3.8.0</summary>

##
[3.8.0](v3.7.0...v3.8.0)
(2026-01-13)

### Features

* expose persisted size in mrd (#1671)
([0e2961b](0e2961be))

* implement &#34;append_from_file&#34; (#1686)
([1333c95](1333c956))

* compute chunk wise checksum for bidi_writes (#1675)
([139390c](139390cb))

* flush the last chunk in append method (#1699)
([89bfe7a](89bfe7a5))

* add write resumption strategy (#1663)
([a57ea0e](a57ea0ec))

* add bidi stream retry manager. (#1632)
([d90f0ee](d90f0ee0))

* make flush size configurable (#1677)
([f7095fa](f7095faf))

### Bug Fixes

* no state lookup while opening bidi-write stream
([2d5a7b1](2d5a7b16))

* no state lookup while opening bidi-write stream (#1636)
([2d5a7b1](2d5a7b16))

* close write object stream always (#1661)
([4a609a4](4a609a4b))

* add system test for opening with read_handle (#1672)
([6dc711d](6dc711da))

</details>

---------

Co-authored-by: Victor Chudnovsky <[email protected]>
@release-please release-please Bot mentioned this pull request Jan 13, 2026
chore(main): release 3.8.0 #1706
Closed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

2 more reviewers
@gemini-code-assist gemini-code-assist[bot] gemini-code-assist[bot] left review comments
@chandra-siri chandra-siri chandra-siri approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@chandra-siri chandra-siri

Labels

api: storage Issues related to the googleapis/python-storage API. size: l Pull request size is large.

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@Pulkit0110 @chandra-siri
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.