fix(zarr-metadata)!: make entity types assignable to metadata fields; validators return tuples - #4378
Merged
d-v-b merged 4 commits intoSep 20, 2026
Conversation
… validators return tuples `ZarrV3NamedConfigJSON.name` and `.configuration` are `ReadOnly` and the envelope is `closed`, so the concrete codec / chunk-grid / chunk-key-encoding / data-type TypedDicts are assignable to the fields they describe. Every concrete `*Object` / `*Configuration` is `closed` and object forms declare `must_understand: NotRequired[bool]`. Every `validate_*` in `zarr_metadata.model` returns `tuple[ValidationProblem, ...]`, `MetadataValidationError.problems` is a tuple, and `load_store_json` returns `object` rather than `Any`. `ANN401` is enforced package-wide. `ZarrV2ConsolidatedMetadataJSON.zarr_consolidated_format` is `Literal[1]`. Split from #296 (part 1 of 3). Assisted-by: ClaudeCode:claude-fable-5-1
Assisted-by: ClaudeCode:claude-fable-5-1
…arr-developers#4365's tests Assisted-by: ClaudeCode:claude-opus-5 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…4378 Assisted-by: ClaudeCode:claude-opus-5 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Documentation build overview
|
d-v-b
marked this pull request as ready for review
September 20, 2026 08:44
Contributor
Author
|
this is a zarr-metadata PR that makes a variety of improvements as described in the AI-written PR description. I'm self-merging it. |
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 🤖
Part 1 of a split of d-v-b#296 (reviewed on the fork as d-v-b#317). Small and independent; a follow-up PR adding a composition rules layer builds on it.
ZarrV3NamedConfigJSON.name/.configurationareReadOnly(PEP 705) and the envelope isclosed(PEP 728), so every concrete codec / chunk-grid / chunk-key-encoding / data-type TypedDict is now assignable to the fields it describes (codecs,chunk_grid,data_type, ...). Previously a type checker rejected puttingBloscCodecMetadataintocodecs.*Object/*ConfigurationTypedDict isclosed, and object forms declaremust_understand: NotRequired[bool].validate_*inzarr_metadata.modelreturnstuple[ValidationProblem, ...]instead of a list, andMetadataValidationError.problemsis a tuple.load_store_jsonreturnsobjectrather thanAny;ANN401is enforced package-wide.ZarrV2ConsolidatedMetadataJSON.zarr_consolidated_formatisLiteral[1].zarr_metadata.pydanticserializers declare their return schema via the pydantic-facing shadow types.The structural validator is otherwise unchanged; the
dimension_names/chunksrank checks stay where they are until part 2.Rebased onto main. The only conflict was with #4365 (v2 array document is open): its semantics are kept, and its two new tests now expect
()fromvalidate_array_metadata_v2.Verified after rebase: ruff check/format, pyright 1.1.404 (0 errors), 595 package tests.
🤖 Generated with Claude Code