Conversation
The rectilinear hypothesis strategy returned one list of edges per dimension, so no property test ever saw a bare-int dimension, a grid mixing bare ints and edge lists, a run-length encoded declaration, or edges overhanging the extent. The first-element-only classifier that zarr 3.2.x shipped (zarr-developers#4374) was invisible to it. The strategies now cover two spaces. `rectilinear_chunks` samples the `chunks=` syntax: bare ints and flat edge lists in any arrangement, at least one list so the grid is rectilinear. `rectilinear_chunk_shape_ declarations` samples the stored metadata: bare-int steps (including larger than the extent), edge lists written in full or run-length encoded in canonical or arbitrary grouping, and overhanging edges. Each draw comes with the chunk_shapes it must parse to. `chunk_grids` and so `array_metadata` draw from the stored space; `arrays` passes grids the list syntax cannot express as the metadata object, and asserts the stored grid equals the declared one. Two property tests pin the properties that would have caught zarr-developers#4374: every stored declaration parses to its expanded edges and re-serializes to an equivalent grid, and every `chunks=` specification is stored in zarr.json as a "rectilinear" grid equal to the specification. test_unified_chunk_grid.py used a private copy of the old strategy; it now draws from the shared one. Assisted-by: ClaudeCode:claude-fable-5-1
d-v-b
added a commit
to d-v-b/zarr-python
that referenced
this pull request
Sep 18, 2026
Assisted-by: ClaudeCode:claude-fable-5-1
Assisted-by: ClaudeCode:claude-fable-5-1
Documentation build overview
7 files changed ·
|
Documentation build overview
26 files changed ·
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4377 +/- ##
==========================================
- Coverage 94.34% 94.24% -0.10%
==========================================
Files 92 92
Lines 12935 13002 +67
==========================================
+ Hits 12203 12254 +51
- Misses 732 748 +16
🚀 New features to boost your workflow:
|
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.
🤖 AI text below 🤖
Follow-up to #4374. The bug shipped in 3.2.x because the rectilinear hypothesis strategy returned one list of edges per dimension, so no property test ever saw a bare-int dimension, a grid mixing bare ints and edge lists, a run-length encoded declaration, or edges overhanging the extent. A first-element-only classifier was invisible to it.
Changes
Two strategies in
zarr.testing.strategies, for the two spaces the spec has:rectilinear_chunkssamples thechunks=syntax: per dimension a bare int (a step; may exceed the extent) or a flat edge list summing to the extent, in any arrangement, with at least one list so the grid is rectilinear. Run-length encoding is deliberately not part of this space; it is a metadata form, not an input form.rectilinear_chunk_shape_declarationssamples the storedchunk_shapes: bare-int steps, edge lists written in full or run-length encoded (canonical, or arbitrary grouping with split runs and[size, 1]pairs), and edges overhanging the extent (trailing edge, or last edge past the end). Each draw returns thechunk_shapesit must parse to.chunk_grids(and soarray_metadata) draws from the stored space viafrom_dict, so the metadata roundtrip properties now see all of it.arrayspasses grids the list syntax cannot express (overhang, all bare ints) as the metadata object, and asserts the stored grid equals the declared one.test_unified_chunk_grid.pyhad a private copy of the old strategy; it now draws from the shared one.Two new properties pin what would have caught #4374: every stored declaration parses to its expanded edges and re-serializes to an equivalent grid (checked inside a full
ArrayV3Metadatadocument), and everychunks=specification lands inzarr.jsonas a"rectilinear"grid whosechunk_shapesequal the specification.Reach
Measured with
--hypothesis-show-statistics(share of examples per test). Intest_basic_indexing: 19% of draws mix bare ints and edge lists, 16% have a bare-int dimension, 4.6% a step larger than the extent. In the metadata roundtrips: canonical RLE 3.9%, arbitrary-grouping RLE 2%, overhang 2%. Every one of these was 0% before. Noassume()in the strategies.Independent of #4375 and #4376; passes on
mainas well.🤖 Generated with Claude Code