Skip to content

fix: validate consolidated metadata listing keys and hierarchy - #4701

Open
barlowa124 wants to merge 5 commits into
zarr-developers:mainfrom
barlowa124:consolidated-metadata-4453
Open

barlowa124 wants to merge 5 commits into
zarr-developers:mainfrom
barlowa124:consolidated-metadata-4453

Conversation

@barlowa124

Copy link
Copy Markdown
Contributor

Supersedes #4485, which GitHub auto-closed when the branch history was rewritten to remove tooling attribution.

Summary

Second item of #4453. ConsolidatedMetadata.from_dict (and
GroupMetadata.from_dict, which delegates to it) accepted listings
the spec rules out, two of which broke reads.

Listing keys are node paths, so keys with an empty segment ("",
a//b) are now rejected with MetadataValidationError. Keys carrying
a reserved segment emit
a ZarrDeprecationWarning naming the key and advising a rename,
avoiding breakage of stores that work today.

Every non-root key also needs its ancestors present as group entries:
{"a/b": GROUP} used to surface as GroupNotFoundError on open,
making the root unopenable from one entry. It now fails with a clear
MetadataValidationError, as does a listing nested under an array.
v2 listings skip the name checks entirely. The remaining #4453 items
are untouched.

For reviewers

The reserved-name path moved from rejection to deprecation after
review, since stores written today with __-prefixed names still open
on main. It becomes a hard error once #4484 stops those names being
written. The empty-segment rule stays strict because consolidated keys
are node paths and node names cannot be empty. If #4484 lands first,
this can reuse its helper for the reserved-name part.

Author attestation

  • I am a human. These are my changes. I have reviewed and understood every change and can explain why each is correct.

TODO

Done:

  • Add unit tests and/or doctests in docstrings
  • Add docstrings and API docs for any new/modified user-facing classes and functions
  • New/modified features documented in docs/user-guide/*.md

Outstanding:

  • Changes documented as a new file in changes/
  • GitHub Actions have all passed
  • Test coverage is 100% (Codecov passes)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant