Repository navigation
Conversation
`read_openable_node_metadata_v3` reads a v3 `zarr.json` as `read_node_metadata_v3` does and adds a problem of the new kind `unclaimed_declaration` for each declaration a reader must understand that nothing in scope claims: an unknown codec, data type or chunk grid, or an unknown top-level member without `"must_understand": false`. Its reading has no problems exactly when a reader that understands the scope can open the node. The other readers keep accepting unclaimed declarations, so the format stays open; their docstrings and the parsing guide now point to `unclaimed_declarations` and the new reader. Prompted by refkv's report that an unknown v3 member parses without error. 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>
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 🤖
zarr_metadata.model.read_openable_node_metadata_v3reads a v3zarr.jsonasread_node_metadata_v3does, and also reports each declaration a reader must understand to open the node that nothing in scope claims, such as an unknown codec or an unknown top-level member without"must_understand": false, as a problem of the new kindunclaimed_declaration. Its reading has no problems exactly when a reader that understands the scope can open the node, so a validator does not have to checkunclaimed_declarationsitself. The other readers still accept unclaimed declarations, and thefrom_jsonand reader docstrings now point tounclaimed_declarationsand the new reader.Why
A downstream validator (refkv) reported that
ZarrV3GroupMetadata.from_json({..., "extra": 1})parses without error, while the spec requires a reader to refuse it and zarr-python does. The model accepting unclaimed declarations is deliberate (it keeps the format open, andunclaimed_declarations/must_understand_fieldsalready list them), but nothing turned that into problems a validator can report. This adds that reader without changing the existing ones.Changes
read_openable_node_metadata_v3inmodel/_group_v3.py: adds oneunclaimed_declarationproblem per entry ofunclaimed_declarations_of(reading.declarations(), waived), located where the document writes it, with that value asinput; drops the model when any problem exists. Works whether or not the document has other problems. A group'sconsolidated_metadataentries are not read, matchingread_group_metadata_v3.ProblemKindgainsunclaimed_declaration.waived_memberstakes any mapping of values, so the reader can pass the members as written.from_jsonand the v3 array/group readers, thezarr_metadata.modelmodule docstring, anddocs/parsing-validation.md(whose hand-written can-open snippet becomes a tested example of the new reader).tests/model/test_unclaimed_declarations.pyover codecs (including inside a shard), unknown array and group members with and without the waiver, codecs inside a claimed member, a document with other problems, an unknown node type, and a non-object.just checkpassed locally (ruff, pyright, test suite on 3.11 and the newest supported interpreter, docs build).🤖 Generated with Claude Code