Repository navigation
Conversation
d-v-b
added a commit
that referenced
this pull request
Oct 27, 2026
… after #416 Assisted-by: ClaudeCode:claude-opus-5-5
d-v-b
changed the base branch from
claude/zarr-metadata-property-tests-4758bf
to
main
November 3, 2026 20:43
Add Hypothesis strategies for struct, cast_value and sharding_indexed, which draw the fields they hold from the same Strategies mapping, and a `pipelines` strategy that walks a codec pipeline, drawing each codec for the chunk the codec before it hands on via its definition's transition. A shard's inner and index pipelines are drawn for the chunks its definition's `pipelines` gives. Shards and structs nest at most one level deep, and strategies are wrapped in a mapping with a short repr so Hypothesis's error notes stay under its 30,000-character warning. Every strategy record's functions now take the Strategies mapping as their last argument. Assisted-by: ClaudeCode:claude-opus-5-5
`NOT_NUMBERS` predates the zarr-python data types, so `cast_value` and `scale_offset` accepted `fixed_length_utf32`, `null_terminated_bytes`, `raw_bytes` and `variable_length_bytes`, and the strategies drew them. The cast_value spec defines the codec only for floating-point and integral data types. Assisted-by: ClaudeCode:claude-opus-5-5
`_scope` documented this but raised `ScopeConflictError`, so `declarations` failed for any definition named as a default, which worked before this branch. Pipelines and data type names now draw only the definition that claims a name, and `declarations` reads a draw with its own definition claiming the name. Assisted-by: ClaudeCode:claude-opus-5-5
The test compared a draw with the bare name, which depended on the example Hypothesis returned and said nothing of which definition read it. Every spelling is now read by the definition it was drawn for. Assisted-by: ClaudeCode:claude-opus-5-5
…s after zarr-developers#4597 Assisted-by: ClaudeCode:claude-opus-5-5
d-v-b
force-pushed
the
claude/zarr-metadata-nested-strategies
branch
from
November 3, 2026 21:20
c6f10be to
747a4c0
Compare
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.
🤖 AI text below 🤖
Added strategies to
zarr_metadata.testing.strategiesfor the definitions that hold other declarations:struct,cast_valueandsharding_indexed. Their nested declarations are drawn from the sameStrategiesmapping, so a struct's field types, a cast's target data type and a shard's codecs come from every definition the mapping holds. A newpipelinesstrategy draws a whole codec pipeline for aChunk, drawing each codec for the chunk the codec before it hands on, as that codec'stransitiongives it. Shards are drawn at most one inside another, and structs likewise. Every function a strategy record holds now also takes theStrategiesmapping as its last argument, anddeclarationsreads what it draws in the scope of every definition the mapping holds.cast_valueandscale_offsetrejectfixed_length_utf32,null_terminated_bytes,raw_bytesandvariable_length_bytes, whose values are not numbers. The strategies no longer draw them for either codec.How the nested strategies work
Strategiesas their last argument, so a definition that holds fields draws them from the same mapping, including any strategies an extension author added. This changes the record signatures from PR 1, which is fine since zarr-metadata is pre-1.0.pipelinesreturns: inner chunks of the shard's data type, and auint64index whose codecs must be of static size. The inner chunk lengths divide every length the shard takes along each axis, including the mixed lengths a rectilinear grid gives.transitionwhat it hands on. For example, abytescodec after acast_valuetoint16gets anendian.declarationsreads each draw in the scope of every definition the mapping holds, plus the definition being drawn. When two definitions share a name, the later one wins, so a definition named as a default replaces that default instead of raisingScopeConflictError.floats(width=16)rejections, and warns when that repr passes 30,000 characters. Underfilterwarnings = error, the full mapping's repr made the test fail intermittently.Tests
test_pipelines_readreads each drawn pipeline withread_pipeline. The chunks come from a grid over a shape (regular or rectilinear), plus chunks with unknown lengths or an unread data type. It also covers the JSON round trip.test_codecs_take_their_chunknow checks a shard's inner pipelines too.pipelinesreaches every codec;cast_valuereaches every real-number target, and scalars in both directions.test_cast_value_draws_only_real_number_data_typeschecks thatcast_valuedraws stay within the real-number types, a closed-set check the reach tests do not give.tests/v3/test_zarr_python_scope.pychecks that each codec rejects the non-numeric zarr-python data types.gzip. The agent reversed the fix in_scopeand confirmed the suite fails.just checkis green on Python 3.11 and 3.14.Left open
cast_valuedrawswrapto the numpy time types, because the package accepts it (_arithmetic.pytreats them as int64). Thecast_valuespec sayswrapis "only permitted when data_type is an integral type". That is a decision for the package's rules, not this PR._structwith no fixed-size types, and aChunk()blame on shards withoutbytes.pipelineshas nospellingsoption yet. It fits PR 3, which builds whole documents.Stack
PR 2 of 5. PR 1 (#414) landed upstream as zarr-developers#4575, so this PR now targets
maindirectly. The changelog fragments are numbered after this PR; renumber them if it is upstreamed.🤖 Generated with Claude Code