fix(zarr-metadata): a v2 array's other members are JSON with string keys - #4424
Merged
d-v-b merged 2 commits intoSep 26, 2026
Merged
Conversation
This was referenced Sep 26, 2026
Documentation build overview
|
d-v-b
force-pushed
the
fix/zarr-metadata-v2-array-other-members
branch
from
September 26, 2026 17:45
57bf497 to
356dbb9
Compare
d-v-b
force-pushed
the
fix/zarr-metadata-v2-array-other-members
branch
from
September 26, 2026 18:41
356dbb9 to
f83d661
Compare
d-v-b
marked this pull request as ready for review
September 26, 2026 18:48
The v2 array validator tolerates members outside the `.zarray` definition, as the spec asks readers to ignore them, but never looked at them: `parse_array_metadata_v2` returned a document with an integer key, or with a set or NaN as a member, typed as `ZarrV2ArrayMetadataJSON`, where `is_array_metadata_v2` said no. The members are now checked as v3 checks its extension fields, by the same helper, renamed for both. Assisted-by: ClaudeCode:claude-opus-5-5
d-v-b
force-pushed
the
fix/zarr-metadata-v2-array-other-members
branch
from
September 26, 2026 18:55
f83d661 to
47cc9b4
Compare
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 🤖
A v2 array document's members outside the
.zarraydefinition are tolerated and dropped, since the spec asks readers to ignore them (#4365). But the validator never looked at them, soparse_array_metadata_v2returned a document with an integer key, or with a set or NaN as a member, typed asZarrV2ArrayMetadataJSON, whereis_array_metadata_v2said no.They are now checked as v3 checks its extension fields: every key a string, every member JSON. Being there is still not a problem. The helper that does this serves both versions now, so it is renamed from
_validate_extension_fields_v3to_validate_other_members, andZarrV2ArrayMetadataJSONdeclaresextra_items=JSONValue, as its pydantic schema already did.This is one of eight independent PRs from a review of the casts in
zarr_metadata.model, each based onmainand each passingjust checkalone, with a test that fails without its fix where there is behaviour to test:#4425, #4426, #4428 and #4430 have merged, as have #4420, #4421 and #4422, and each of the four left is rebased onto them, so its tests are type-checked as #4421 requires. Of those four, only #4423 and #4429 touch the same lines, the
TypeGuardimport, so whichever of them merges second needs a one-line rebase. All eight together, merged with #4421's type-checked tests, passjust check.🤖 Generated with Claude Code