Repository navigation
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the init_aaow function in gcsfs/zb_hns_utils.py to use the Preconditions class from the google-cloud-storage SDK for handling if_generation_match preconditions, rather than passing it directly as a keyword argument to AsyncAppendableObjectWriter. The unit tests have been updated to mock the Preconditions class and cover cases where the SDK does or does not support it. I have no feedback to provide as there are no review comments.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1131 +/- ##
=======================================
Coverage 92.24% 92.24%
=======================================
Files 20 20
Lines 4047 4048 +1
=======================================
+ Hits 3733 3734 +1
Misses 314 314 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Also rewords the comment on the generation check and drops a test for the removed TypeError fallback.
yuxin00j
marked this pull request as ready for review
November 3, 2026 07:49
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Follow-up to #1102. googleapis/google-cloud-python#18641 (merged) exposes write preconditions on
AsyncAppendableObjectWriteraspreconditions=Preconditions(...); theif_generation_match=keyword thatinit_aaowpasses today never shipped. This passesPreconditions(if_generation_match=N)instead, so zonal compare-and-swap writes work once that change is in a google-cloud-storage release. Older releases keep the current behavior:if_generation_match > 0on zonal buckets raisesNotImplementedError.Changes
gcsfs/zb_hns_utils.py:Preconditionsfromgoogle.cloud.storage.asyncio.async_appendable_object_writer, falling back toNoneon older releases.if_generation_match == 0togeneration=0so exclusive create works with everygoogle-cloud-storageversion.if_generation_match > 0, raiseNotImplementedErrorwhenPreconditionsis unavailable and passpreconditions=Preconditions(if_generation_match=...)otherwise.gcsfs/tests/test_zb_hns_utils.py,gcsfs/tests/test_core.py: update theinit_aaowtests and the zonal CAS skip message.Test plan
pytest gcsfs/tests/test_zb_hns_utils.py gcsfs/tests/test_zonal_unit.py gcsfs/tests/test_zonal_file.py gcsfs/tests/test_zonal.py gcsfs/tests/test_retry.py gcsfs/tests/test_core.py(548 passed, 40 skipped)init_aaowsendsWriteObjectSpec(if_generation_match=7)andWriteObjectSpec(if_generation_match=0), and mapsFailedPreconditiontoGenerationMismatchError.