fix: skip object store prefix markers in list_dir by AMBRA7592 · Pull Request #4117 · zarr-developers/zarr-python · GitHub
Skip to content

fix: skip object store prefix markers in list_dir#4117

Open
AMBRA7592 wants to merge 1 commit into
zarr-developers:mainfrom
AMBRA7592:codex/list-dir-prefix-marker
Open

fix: skip object store prefix markers in list_dir#4117
AMBRA7592 wants to merge 1 commit into
zarr-developers:mainfrom
AMBRA7592:codex/list-dir-prefix-marker

Conversation

@AMBRA7592

Copy link
Copy Markdown

Summary

Fixes #4032.

ObjectStore.list_dir can receive a directory-marker entry that matches the requested non-root prefix itself, such as path "g" for prefix "g". That entry represents the prefix, not a child of the prefix, so _transform_list_dir now skips exact prefix-marker entries before relativizing returned paths.

This also avoids yielding empty relative paths and adds regression coverage for both "g" and "g/" prefix inputs.

For reviewers

Please check whether handling the exact-prefix marker in _transform_list_dir is the right level. I kept the change local to ObjectStore because this marker entry is an object-store delimiter-listing artifact.

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.

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)

Validation

  • python3 ci/check_changelog_entries.py
  • git diff --check
  • python3 -m py_compile src/zarr/storage/_obstore.py tests/test_store/test_object.py

I could not run the targeted pytest locally because this Python environment is missing the project test dependency stack (pytest, obstore, numcodecs, donfig).

@AMBRA7592 AMBRA7592 force-pushed the codex/list-dir-prefix-marker branch from 099a1a5 to db8b0cc Compare July 2, 2026 20:48
@codecov

codecov Bot commented Jul 2, 2026

Copy link
Copy Markdown

Signed-off-by: ABrandes <79119643+AMBRA7592@users.noreply.github.com>
@AMBRA7592 AMBRA7592 force-pushed the codex/list-dir-prefix-marker branch from db8b0cc to 9ac29a6 Compare July 2, 2026 20:59
@AMBRA7592 AMBRA7592 marked this pull request as ready for review July 3, 2026 15:47
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.

ObjectStore.list_dir("g") raises ValueError when an object keyed "g/" exists

1 participant