Skip to content

fix/unbreak chunks initialized #2862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 7 commits into from
May 12, 2025

Conversation

d-v-b
Copy link
Contributor

@d-v-b d-v-b commented Feb 25, 2025

fixes #2861 by making extant prefixes relative before comparing them to the list of chunk names.

some odd noise in the commit log here, but these are all commits that landed in main so I don't think it's a problem.

@github-actions github-actions bot added needs release notes Automatically applied to PRs which haven't added release notes and removed needs release notes Automatically applied to PRs which haven't added release notes labels Feb 25, 2025
@d-v-b d-v-b requested review from normanrz and jhamman March 18, 2025 12:20
@d-v-b d-v-b force-pushed the fix/unbreak-chunks-initialized branch from c7eaeb0 to c57e862 Compare April 16, 2025 22:42
@d-v-b d-v-b requested a review from dstansby April 16, 2025 22:49
Copy link
Contributor

@TomAugspurger TomAugspurger left a comment

Choose a reason for hiding this comment

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

Thanks for handling this. A couple small questions, but I think this looks good.

"""
return "/".join(filter(lambda v: v != "", paths))


def _relativize_path(path: str, prefix: str) -> str:
"""
Make a "\"-delimited path relative to some prefix. If the prefix is '', then the path is
Copy link
Contributor

Choose a reason for hiding this comment

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

Is "\"-delimited right here, or should this be "/"-delimited?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, ""-delimited is not correct, and it should be the other one

if prefix == "":
return path
else:
_prefix = prefix + "/"
Copy link
Contributor

Choose a reason for hiding this comment

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

What behavior do we want for prefix="<some-prefix>/", i.e. a prefix ending with a /?

IIUC, this will currently always raise a ValueError, unless path for some reason starts with <some-prefix>//

Maybe we should have _prefix = prefix.rstrip("/") + "/"? Or if you're confident the callers are careful about not providing a prefix with a trailing slash this is fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I was assuming here that paths have already been normalized by normalize_path, in which case prefixes cannot end with "/". I should make this explicit in the docstring for the function here.

@TomAugspurger
Copy link
Contributor

Sounds good, thanks. It looks like the codecov failure might be legitimate, so good to go once that's fixed.

@d-v-b d-v-b merged commit 520bc1f into zarr-developers:main May 12, 2025
30 checks passed
@d-v-b d-v-b deleted the fix/unbreak-chunks-initialized branch May 12, 2025 14:32
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.

Missmatch of Array.store_path.store.list_prefix() and Array._iter_chunk_keys() in chunks_initialized() for an array in a group
2 participants