Skip to content

fix(group): list member names without resolving array codecs - #4693

Draft
grifftatarsky wants to merge 1 commit into
zarr-developers:mainfrom
grifftatarsky:fix/group-key-listing-without-codecs
Draft

grifftatarsky wants to merge 1 commit into
zarr-developers:mainfrom
grifftatarsky:fix/group-key-listing-without-codecs

Conversation

@grifftatarsky

@grifftatarsky grifftatarsky commented Dec 3, 2026 •

Copy link
Copy Markdown

Summary

Fixes #4692. keys(), array_keys(), and group_keys() currently construct every child array, so one unavailable codec prevents even listing subgroup names. The equivalent format 2 fixture lists names successfully with Zarr-Python 2.18.7, but fails with 3.4.2 and current main.

Name-only traversal now reads node metadata without resolving codecs or constructing arrays. The sync methods use the async implementation. Immediate member counts use the same path so list(group) also works through its length hint. Array retrieval and value iterators still raise UnknownCodecError.

For reviewers

The change is limited to immediate name enumeration and counts. Consolidated metadata remains authoritative and listing it performs no storage I/O. Opening consolidated metadata can still require codecs; the user guide documents use_consolidated=False for inspection when a codec is unavailable. Recursive member traversal and array loading are unchanged.

The metadata-only path validates JSON, format, and node type; it does not fully validate array configurations. It preserves warnings for non-Zarr objects and propagates storage errors. PR #4471 proposes removing those warnings; this keeps current main's behavior and can follow that change if it lands first.

Validation

  • Reproduced the failure in Zarr-Python 3.4.2 and main at 13f4bf58181110d709692d9e35fde59d7776387d; checked the working format 2 behavior in 2.18.7.
  • Initial regression suite: 54 failures on the original implementation, all 72 cases pass with the fix. Expanded suite: 80 pass, including unavailable codecs, sync/async APIs, format 2/3, nested paths, memory/local stores, malformed metadata, consolidation, storage failures, and concurrency limits. Unaffected stored array data remains readable; opening the unsupported array still fails.
  • Group and consolidated-metadata suites: 1,090 passed, 209 skipped on Python 3.12.15 and 3.13.16.
  • Full suite on Python 3.12.15 (pytest tests src --ignore=tests/benchmarks -n 4 -q): 14,510 passed, 1,250 skipped, 44 xfailed, no unexpected failures.
  • All 44 changed executable lines covered; existing group tests also cover recursive count behavior.
  • Ruff, formatting, mypy, applicable pre-commit hooks, documentation-source checks, and public-export documentation checks pass.

Author attestation

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

Draft pending the author's personal review and attestation.

TODO

  • 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
  • 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.

Group name listing fails when a sibling array uses an unavailable codec

1 participant