Repository navigation
Conversation
`_codec` drew from `st.sampled_from` over `(definition, configurations)` pairs whose configurations are strategies built during the draw. Hypothesis labels such a `sampled_from` by hashing its elements, and a strategy hashes by address, so these spans were labeled by memory layout. Hypothesis's mutator copies choices between spans that share a label, so which spans it grouped, and so which examples a derandomized run drew, changed with whatever moved the allocator: another process, machine load. `_codec` now samples an index into the options, labeled by a `range`. The share tests measured this drift. `examples_of` now draws twice and fails if the runs differ, which catches an address-labeled strategy in the same process; the array-document targets share one draw. Bounds are reset from the shares of 100 seeds: the "no axes" ceiling (0.25) sat under the seed maximum (0.303), and the "axis past 32 bits" floor (0.1) over the seed minimum (0.06). Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
zarr-extensions#78 (cadd1dab6) made the array form of a dimension's chunk edge lengths non-empty, even for an axis of length 0, which writes a bare integer to have no chunks. The rectilinear chunk grid's rules now report `chunk_shapes: [[]]`, its JSON Schema says `minItems: 1` for the list, and `chunk_grid_configurations` always draws at least one edge. Spec links are re-pinned to cadd1dab6. Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t checker The checker, the JSON Schema writer and the pydantic schema now read annotated-types' `MinLen`, `MaxLen` and `Len` on an array, as pydantic does. One table of constraints now drives parsing, the shape check and the schema keywords, in place of five parallel tables. An array outside its bounds is an `invalid_value` problem whose `ctx` holds `min_length` or `max_length`. A length bound on anything but an array raises `TypeError`. `codecs` and each rectilinear dimension's edge list now declare `MinLen(1)` on their types. This removes the two hand-patched `minItems: 1` schema fragments and the rectilinear `_rules` function. `chunk_shapes: [[]]` and `codecs: []` are still refused at the same `loc`. `check` now also refuses `codecs: []`. Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The `sharding_indexed` codec's `codecs` and `index_codecs` each hold
exactly one array -> bytes codec, so neither is ever empty. Both now
declare `MinLen(1)` on their types, as the array document's `codecs`
does. An empty one is reported by the type check at the same `loc` as
before, with `ctx={"min_length": 1}`. Before, the pipeline's order check
reported it as "expected an array -> bytes codec, got none".
Assisted-by: ClaudeCode:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`null_terminated_bytes` and zarr-python's `raw_bytes` checked `length_bytes >= 1` in a rule, and v3 `struct` checked that it has a field. The types now declare `Ge(1)` and `MinLen(1)`, the two rules that did only this are gone, and the struct rule keeps its name and field-type checks. The problems keep their `loc` and kind. The JSON Schema of each type now says so too: it accepted `length_bytes: 0` and `fields: []`, which the reader refuses. Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…cker The checker, the JSON Schema writer and the pydantic schema now read annotated-types' `MultipleOf` on an integer, as pydantic does under `multiple_of`. JSON Schema's keyword is `multipleOf`. The step must be a positive integer, and a type takes one. Two steps on a NewType and its annotation merge to their least common multiple. A float is refused, because validators compare floats inexactly. Each constraint in the table now names the shapes it applies to, with the JSON Schema keyword for each, and a slot (below, above or step) in place of a side. `fixed_length_utf32`'s `length_bytes` and raw `r<N>` `bits` now declare `Gt(0), MultipleOf(8 or 4)` on their types. The two rules that checked only this are gone. A test whose own `r*` definition accepts any size now uses its own configuration type. Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ct checker `MinLen`, `MaxLen` and `Len` now also bound a string, as pydantic's `min_length` does. The JSON Schema writes `minLength` and `maxLength`. Python and JSON Schema both count code points, so the checker and the schema agree on what a string's length is. Messages count characters: "expected a string with at least 1 character, got \"\"". A length bound on an object still raises `TypeError`. The v3 `struct` field name now declares `MinLen(1)` on its type, and the struct rule no longer checks for an empty name. The problem keeps its `loc` and kind. Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Documentation build overview
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4636 +/- ##
=======================================
Coverage 94.90% 94.90%
=======================================
Files 96 96
Lines 14051 14051
=======================================
Hits 13335 13335
Misses 716 716 🚀 New features to boost your workflow:
|
…32 bits The derandomized share stream changes with any change to what the strategies draw, and with machine load: base main measures 0.103 against a floor of 0.1 under load, and the rectilinear fix measures 0.047 to 0.133 across runs. Over seeds 0-5 at 500 examples both trees average about 0.17, from 0.07 to 0.29. A floor of 0.03 still asks that a few hundred examples meet several such axes. Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
`constrained` skipped a type's constraints whenever the inner parse reported any problem. An `unknown_key` problem leaves the value readable, because the key is dropped and the value is still returned. So `check` returned an array of closed TypedDicts longer than its `MaxLen`, and a definition's rules ran on it, although the rules run only on a configuration within its bounds. The constraints are now skipped only for a problem other than an unknown key. Number bounds were never affected, because a number holds no keys. The docs now list `multiple_of`, `min_length` and `max_length` among the `ctx` keys, and `constraints_of` says a type takes one step too. Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A raw `r<N>` name's size is now checked by its type. For `"data_type": "r12"` that gave "expected an integer > 0 that is a multiple of 8, got 12", about a string the document wrote, with no mention of bits. A type-check problem with a configuration that a name encodes now names the member and the name: `bits in "r12": ...`. A rule's message is left as written, because such rules already describe the name, as the v2 typestr rules do. Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ge lists
The sharding tests for an empty `codecs` or `index_codecs` checked only
the `loc` and kind, which the pipeline's order check also reports. They
now also assert `ctx={"min_length": 1}`, which only the type check gives.
The rectilinear strategy test checked the grid's rules, which no longer
look at empty lists. It now reads the configuration with the definition,
which checks the type. The changelog no longer says the JSON Schema of a
raw `r<N>` name carries its multiple of 8: that schema is the name
pattern.
Assisted-by: ClaudeCode:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The share tests in `tests/testing` flaked on this branch: "an axis past 32 bits" below its floor, and "no axes" above its ceiling on Python 3.14. zarr-developers#4635 fixes the cause, a `sampled_from` that Hypothesis labeled by memory address. It also resets the bounds from 100 seeds. The conflict in `_DOCUMENT_SHARES` takes zarr-developers#4635's bounds. Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d-v-b
marked this pull request as ready for review
November 14, 2026 21:05
d-v-b
added a commit
to d-v-b/zarr-python
that referenced
this pull request
Nov 14, 2026
zarr-developers#4636 was stacked on this PR's first two commits and squash-merged, so main holds their index-sampling version; each conflict keeps this branch's newer version. zarr-developers#4636's rectilinear change (always at least one edge) moves the array-document shares, so their bounds are re-measured with `bounds(across_seeds(...))`: `bool`'s seed maximum over 1000 examples rose to 0.108, and its ceiling to 0.13. Assisted-by: ClaudeCode:claude-opus-5-5 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This was referenced Nov 14, 2026
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 🤖
zarr_metadata.typed_json.checkand definitions' configurations now read more annotated-types constraints, as pydantic does:MinLen,MaxLenandLenon an array or a string, andMultipleOfon an integer. A value outside them is aninvalid_valueproblem whosectxuses pydantic's names (min_length,multiple_of), and the JSON Schema writes the matching keyword, such asminItems,minLengthormultipleOf. A constraint on a type it does not apply to raisesTypeError. Constant rules now live on the types, so the JSON Schemas say them too: non-emptycodecs, shardingcodecsandindex_codecs, rectilinear edge lists,structfields and v3structfield names;length_bytesof at least 1 fornull_terminated_bytesand zarr-pythonraw_bytes, and a positive multiple of 4 forfixed_length_utf32. Rawr<N>declares its bits a positive multiple of 8 on its type, and a refused name's message now names them:bits in "r12": ....checknow also refuses"codecs": [].The
rectilinearchunk grid now refuses an empty list of chunk edge lengths, such as"chunk_shapes": [[]], even along a dimension of length 0. zarr-extensions#78 made the list form non-empty; a dimension with no chunks writes a bare integer instead. The JSON Schema saysminItems: 1for the list, andchunk_grid_configurationsno longer draws an empty list.What changed, commit by commit
fix(zarr-metadata): refuse an empty rectilinear edge list: brings the rectilinear grid in line with zarr-extensions#78 (pinned atcadd1dab6). This first version used a hand-written rule and a hand-patched JSON Schema fragment, because the checker could not yet bound a length.feat(zarr-metadata): read MinLen and MaxLen on arrays in the TypedDict checker: the checker, the JSON Schema writer and the pydantic schema readMinLen/MaxLen/Lenon arrays. The array document'scodecsand each rectilinear edge list declareMinLen(1). This removes both hand-patchedminItems: 1fragments fromv3/_json_schema.pyand the rectilinear_rulesfrom commit 1.feat(zarr-metadata): declare sharding's codec pipelines non-empty:codecsandindex_codecsofsharding_indexeddeclareMinLen(1).refactor(zarr-metadata): move constant data type rules onto their types:Ge(1)onlength_bytesofnull_terminated_bytesand zarr-pythonraw_bytes, andMinLen(1)on v3structfields. Two rules are deleted.feat(zarr-metadata): read MultipleOf on integers in the TypedDict checker:fixed_length_utf32.length_bytesand rawr<N>bitsdeclareGt(0), MultipleOf(4 or 8). Two more rules are deleted.feat(zarr-metadata): read MinLen and MaxLen on strings in the TypedDict checker: the v3structfield name declaresMinLen(1), and the struct rule's empty-name check is deleted.Every problem a deleted rule reported is still reported, at the same
locand with the same kind. The message is now the checker's generic one, for example "expected an integer > 0 that is a multiple of 4, got 6".Design notes
_CONSTRAINTSin_typed_json.py, now drives parsing, the "constraint on the wrong shape" check and the JSON Schema keywords. It replaces seven parallel tables. Each entry names its annotated-types marker, the shapes it applies to with the JSON Schema keyword for each (MinLenwritesminItemson an array andminLengthon a string), what it measures, and a slot (below, above or step). A type takes one constraint per slot.ctxkeys aremin_length,max_lengthandmultiple_of, and the problem kind staysinvalid_value.MultipleOfis accepted on integers only. JSON Schema validators compare floats inexactly, and no zarr type needs a float step. A step must be a positive integer, asmultipleOfrequires. When a type alias and the annotation on it each carry a step, the schema writes their least common multiple.lenand JSON Schema'sminLengthdo, so the checker and the schema agree.Predicate, and pydantic'sField/StringConstraints. None of them is in annotated-types, has a JSON Schema keyword, or is needed today.get_origin(annotation) is tuple, which anAnnotatedwrapper hides. It now strips the annotation first.RawBytesConfigurationto accept any raw size can no longer do so, because the type now says the spec's rule. The test that showed a reader definingr*its own way now uses its own configuration type.Testing
The agent ran
just checkinpackages/zarr-metadata: ruff, pyright, and the suite on Python 3.11 (3920 passed, 3 skipped) and 3.14 (3923 passed), plus the docs build. The tests follow one table test for the expected results plus one test per error case: a length bound on a non-array or non-string, a step on a float, a step or length that is not a valid integer, and a second constraint in one slot.Review
The agent ran two reviews of this PR: roborev on every commit, and a separate agent that saw only the PR. These findings held up and are fixed in this PR:
unknown_key. That problem leaves the value readable, socheckcould return an array of closed TypedDicts longer than itsMaxLen, and a definition's rules ran on it. No type in the package could trigger it. Fixed infix(zarr-metadata): hold a length bound beside an unknown key, with a table case."data_type": "r12"reported "expected an integer > 0 that is a multiple of 8, got 12", about a string the document wrote. A type-check problem with a configuration that a name encodes now names the member and the name:bits in "r12": .... A rule's message is left as written: v2 typestr rules already describe the typestr, and prefixing them would show internal keys such asbyteorder.MinLen(1). They now assertctx={"min_length": 1}.r<N>name carries its multiple of 8. It does not, because that schema is the name pattern. The text now says only what is true.ValidationProblemctxkeys, and the first line ofconstraints_of.Noted and left as is:
codecs: []read through the model still reports the pipeline's "expected an array -> bytes codec, got none".checkand a shard's pipelines report themin_lengthproblem. Thelocand kind are the same.Branch notes
mainat 011d68a.fix/zarr-metadata-derandomized-codec-draws). Without it the share tests intests/testing/test_documents.pyfailed in CI: "an axis past 32 bits" fell below its floor on 3.11–3.13, and "no axes" rose above its ceiling on 3.14. This branch changes what the strategies draw, and fix(zarr-metadata): draw the same codecs on every derandomized run #4635 fixes the cause (asampled_fromlabeled by memory address) and resets the bounds from 100 seeds. The earlier one-line stopgap that lowered the 32-bit floor is identical to fix(zarr-metadata): draw the same codecs on every derandomized run #4635's line. Once fix(zarr-metadata): draw the same codecs on every derandomized run #4635 merges, mergingmainhere is clean.🤖 Generated with Claude Code