Conversation
A chunk grid's definition says which arrays it fits, and the v3 array validators judge a document's grid against its shape once both are read: a regular grid has a chunk length for each dimension, and 0 only for a dimension of length 0; a rectilinear grid has chunk lengths for each dimension that cover it. Assisted-by: ClaudeCode:claude-opus-5-5
…ength of 1 The grid `create_default` derives from an overridden `shape` had a chunk length of 0 for a dimension of length 0. The regular grid asks for chunk lengths greater than zero, and `zarr` refuses to open such a grid, so the derived grid now has a chunk length of 1 there. It still fits the shape. Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5
This was referenced Sep 27, 2026
Owner
Author
|
🤖 AI text below 🤖 Merged upstream: all of layer 4 landed as zarr-developers#4443. This fork review copy is closed. |
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 🤖
Upstream: zarr-developers#4441, a draft on
mainnow that layer 3 (zarr-developers#4436) has merged. This fork PR stays as the stacked review copy.Layer 4b of the stack, on top of #366 (4a, fill values): a v3 array's
chunk_gridis judged against itsshape, by the grid's definition. It is the second of the four pieces of layer 4 (4a fill values, 4b grid against shape, 4c the codec pipeline, 4d sharding).What a grid knows.
ChunkGridDefinitiongainsshape_rules(configuration, nested, shape): what the spec disallows in a grid of that configuration over an array of a given shape, located in the configuration. It takes the same arguments as 4a'sfill_value_rules: the configuration, the fields it holds as the scope read them, and the thing judged. A grid that says nothing of the shape fits every one, so a third-party grid is unaffected. The two package grids:chunk_shapesentry per dimension, with chunk lengths that sum to at least the dimension's length (extension). A bare integer repeats until it covers, so it always does. A run-length entry counts as length times count and is never expanded.[]covers a dimension of length 0.Where it is judged.
validate_array_metadata_v3judges the grid once both the grid and the shape are read. A grid the scope did not read, being out of scope or invalid, is left unjudged. So is a grid beside a shape that fails its own check, so no problem is reported twice. The check reachesfrom_json,from_key_value,to_key_value, the pydantic types and each array in an inlineconsolidated_metadata. Reading the shape now has one owner, which returns the lengths orNonewith its problems. The v3 grid anddimension_nameschecks use it, and so does the v2 rank check betweenshapeandchunks.chunk_grid_problemsstays private, inv3._definition. 4c's door returns each axis's chunk lengths along with the problems, and replaces it.Breaking. A document whose grid does not fit its shape now has a problem in
chunk_grid.configuration, where the package accepted it before.create_default(chunk_grid=...)withoutshapekeeps the scalar defaultshape=(), which a grid of another rank does not fit, so that model now fails atto_key_value. The docstring says to pass the two together.A fix on the way.
create_default(shape=...)setchunk_shapeequal toshape, so an empty dimension got a chunk length of 0.zarrrefuses to open that grid: "integer chunk edge length must be >= 1". The default grid now has a chunk length of 1 there, which still fits the shape. This is its own commit, with a bugfix fragment.Choices worth a look
[]for a dimension of length 0 ("has no chunk edges"). This PR accepts it, since there is nothing to cover.create_defaulthas the same derivation:chunksequalsshape, with 0 for an empty dimension.zarropens that document, so this PR leaves it alone.shape_rulesreturns only problems. In 4c the lengths come from a separate function, which is only called on a grid itsshape_rulesaccepted. The design review considered a singlechunks -> (lengths, problems)hook and kept the split, for the same reasonrulesandcanonicalare split: the rules report problems, and derivation works from what they accepted.Reviews. Two, with separate lenses. The correctness review found no bug in the rules. A Hypothesis differential against a reference written from the spec text agreed on 8,000 examples, and its reach was measured: rank mismatches, 0 on an empty dimension, uncovered dimensions, run-length entries, exact cover and
[]for length 0 all came up. Canonical and written rectilinear spellings agreed on 3,000 examples. zarr-python agrees everywhere except[], noted above. The review's one finding was the chunk length of 0 fromcreate_default. The design review's changes are in too:chunk_grid_problemsstays private.no_rules(*_)default serves every hook, instead of one per arity.The stack: 0 and 1 merged upstream (zarr-developers#4420, zarr-developers#4421, zarr-developers#4422, zarr-developers#4432), 2 merged with 1b as zarr-developers#4434, 3 is #355 (upstream zarr-developers#4436), 4a is #366, 4b is this PR, then 4c the codec pipeline and 4d sharding.
🤖 Generated with Claude Code