Repository navigation
Conversation
Share the extra-field checks between array and group metadata: `parse_extra_fields` takes the reserved keys, and the new `extract_extra_fields` splits and validates extra keys in `from_dict`. `GroupMetadata` now rejects extra fields that collide with its own keys, refuses extra fields on Zarr format 2 groups, and no longer passes a v2 `.zgroup` key named `extra_fields` to its constructor. Rename the changelog fragment to the PR number. Assisted-by: ClaudeCode:claude-opus-5-5
…tructors `parse_extra_fields` now also checks that every extra field is an object with `"must_understand": false`, so `ArrayV3Metadata` and `GroupMetadata` can no longer be constructed with extra fields that their own `from_dict` would reject. `extract_extra_fields` delegates to it, leaving one place that validates extra fields. The Zarr format 2 group refusal is checked first so it keeps its own message. Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4451 +/- ##
=======================================
Coverage 94.43% 94.43%
=======================================
Files 93 93
Lines 13219 13229 +10
=======================================
+ Hits 12483 12493 +10
Misses 736 736
🚀 New features to boost your workflow:
|
`extract_extra_fields` filtered the reserved keys and then called `parse_extra_fields`, whose collision check could never fire from that path. Both `from_dict`s now do the filter inline and call `parse_extra_fields` directly, so one function owns the extra-field contract. Also tighten the changelog fragment, the `GROUP_METADATA_KEYS` docstring, and the stale repr comments. Assisted-by: ClaudeCode:claude-fable-5-1
Documentation build overview
11 files changed ·
|
Documentation build overview
|
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 format 3 group metadata now accepts extra fields that are objects with
"must_understand": false, as the specification requires, and keeps them when the metadata is written back. Other extra fields raiseMetadataValidationErrorinstead of aTypeError.GroupMetadatatakes these fields asextra_fields, which rejects keys reserved by the group metadata document and is not supported for Zarr format 2 groups. TheGroupMetadataandArrayV3Metadataconstructors now reject extra fields that are not objects with"must_understand": false, like reading a metadata document does.Closes #3523
For reviewers
parse_extra_fieldsinzarr/core/metadata/v3.pychecks reserved-key collisions (ValueError) andmust_understandvalues (MetadataValidationError).extract_extra_fieldssplits a document's extra keys off for bothfrom_dicts and delegates to it..zgroupstill drops unknown keys, as before (including a key namedextra_fields, which previously would have reached the constructor).ArrayV3Metadata(extra_fields=...)used to accept values its ownfrom_dictrejects; it now raises. The array'sfrom_dicterror message also changed wording (and gained the missing spaces between sentences).Author attestation
TODO
docs/user-guide/*.mdchanges/Relationship to #4391
This PR builds on #4391 by @anishmehta24 and keeps their commit (e6b6130) as the first commit. The two later commits (array parity, v2 refusal, constructor
must_understandvalidation) were also pushed to #4391's branch; this PR carries the same content from a maintainer fork. Only one of the two should merge.🤖 Generated with Claude Code