fix: resolve chunks=-1 to chunk size 1 on zero-length axes - #4307
Merged
d-v-b merged 2 commits intoSep 2, 2026
Conversation
The -1 chunk sentinel resolved to chunk size 0 on zero-length axes, which broke every downstream sharding path differently: a ValueError with shards=None, a ZeroDivisionError with shards="auto", and an infinite loop with shards="auto" plus array.target_shard_size_bytes. Clamp it to 1, matching the auto-chunking clamp in _guess_regular_chunks. Also guard _guess_num_chunks_per_axis_shard against zero-size chunk shapes directly (same non-terminating-loop cause as the 0-d case fixed in zarr-developers#4305), and fix the arithmetic in its docstring example. Follow-up to zarr-developers#4305 / issue zarr-developers#4304. Assisted-by: ClaudeCode:claude-fable-5-1
Assisted-by: ClaudeCode:claude-fable-5-1
d-v-b
force-pushed
the
fix/shard-guess-zero-size-chunks
branch
from
September 2, 2026 12:01
873e1df to
f850df5
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4307 +/- ##
=======================================
Coverage 94.21% 94.21%
=======================================
Files 92 92
Lines 12863 12863
=======================================
Hits 12119 12119
Misses 744 744
🚀 New features to boost your workflow:
|
d-v-b
marked this pull request as ready for review
September 2, 2026 13:25
Contributor
Author
|
I'm self-merging, because this is a bugfix that doesn't affect public API. |
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 for #4304, ensures that we handle 0-length axes correctly in auto chunk size logic. written by claude, claude's PR is here
Author attestation
TODO
docs/user-guide/*.mdchanges/