Skip to content

chore: add test for ZarrParser on bucket without list permissions#919

Merged
TomNicholas merged 1 commit intozarr-developers:mainfrom
maxrjones:zarr-parser-nolist
Mar 11, 2026
Merged

chore: add test for ZarrParser on bucket without list permissions#919
TomNicholas merged 1 commit intozarr-developers:mainfrom
maxrjones:zarr-parser-nolist

Conversation

@maxrjones
Copy link
Copy Markdown
Member

@maxrjones maxrjones commented Mar 10, 2026

What I did

@TomNicholas mentioned some recent Zarr parser changes at a call today (#892), and I was curious about the implications for buckets without list permissions (e.g., HTTPS stores). This PR just adds a test that xfails.

As an aside, this is where #859 would come in handy because parsers could define their own required methods.

Acceptance criteria:

  • Closes #xxxx
  • Tests added
  • Tests passing
  • No test coverage regression
  • Full type hint coverage
  • Changes are documented in docs/releases.md
  • New functions/methods are listed in an appropriate *.md file under docs/api
  • New functionality has documentation

@TomNicholas
Copy link
Copy Markdown
Member

Yeah I was thinking about this.

For now I think we want some fallback approach (i.e. the old approach), that is opt-in via a kwarg like allow_list: bool = True.

The main is question is whether we can auto-detect whether or not a store is listable. Zarr stores have a property for this, but we don't have Zarr stores, we have obstore stores, and I don't see a .listable property on obstore stores...

@maxrjones maxrjones mentioned this pull request Mar 11, 2026
@maxrjones
Copy link
Copy Markdown
Member Author

Yeah I was thinking about this.

For now I think we want some fallback approach (i.e. the old approach), that is opt-in via a kwarg like allow_list: bool = True.

The main is question is whether we can auto-detect whether or not a store is listable. Zarr stores have a property for this, but we don't have Zarr stores, we have obstore stores, and I don't see a .listable property on obstore stores...

where is there a .listable check on zarr stores?

Probably a try; except or a parser configuration option is the way to go so that you don't waste a request for the listable path just checking if it's listable.

@TomNicholas
Copy link
Copy Markdown
Member

where is there a .listable check on zarr stores?

https://zarr.readthedocs.io/en/stable/api/zarr/abc/store/#zarr.abc.store.Store.supports_listing

I'm fine with a parser kwarg, I just want it to default to not use listing, despite that choice being a breaking change, because for listable stores using list is such a massive performance improvement.

@maxrjones
Copy link
Copy Markdown
Member Author

where is there a .listable check on zarr stores?

zarr.readthedocs.io/en/stable/api/zarr/abc/store#zarr.abc.store.Store.supports_listing

ah, thanks. that is about the store implementation rather than the permissions of the backend, so it wouldn't help here even if we made a Zarr store from the obstore Store.

default to not use listing

do you mean default to use listing? I'd be fine with that. I think this should be well documented - the changelog entry from #892 should be also listed under breaking changes and should go under the unreleased section rather than 2.4.0.

reason="ZarrParser does not yet support buckets without list permissions"
)
def test_zarr_parser_nolist_bucket(minio_nolist_bucket):
"""Test that ZarrParser works with a bucket that does not allow list operations."""
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine to merge this as-is, but I wonder if there is a simpler test that doesn't require minio.

The simplest example of a zarr url that we can't list is surely a http store? I was imagining there would be a class like that in zarr-python, but apparently there isn't.

Obstore does have a HTTP store, but I'm confused why it says it supports list?

https://developmentseed.org/obstore/latest/api/store/http/#obstore.store.HTTPStore.head_async

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

obstore's HTTPStore is designed around webdav (xref developmentseed/obspec-utils#63).

It's a trade-off between code complexity with minio and relying on the network. For this version, you only need docker locally. I prefer local-first testing but am not planning to implement the fix so you could close this and build what works for you.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see. Sounds harder than I had anticipated, so minio seems fine.

@norlandrhagen
Copy link
Copy Markdown
Collaborator

Thanks for the fix @maxrjones

@TomNicholas
Copy link
Copy Markdown
Member

This doesn't actually fix the problem (which I just raised #921 to track), it only adds the test that we need to make pass.

@TomNicholas TomNicholas merged commit 364ba2d into zarr-developers:main Mar 11, 2026
15 checks passed
@maxrjones maxrjones self-assigned this Mar 16, 2026
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.

3 participants