-
-
Notifications
You must be signed in to change notification settings - Fork 329
don't serialize empty tuples for v2 filters, and warn when reading such metadata #2847
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
Conversation
i don't think the coverage report is accurate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems OK to me.
@@ -113,6 +113,13 @@ async def test_roundtrip_array_metadata( | |||
assert actual == expected | |||
|
|||
|
|||
@given(store=stores, meta=array_metadata()) # type: ignore[misc] | |||
def test_array_metadata_meets_spec(store: Store, meta: ArrayV2Metadata | ArrayV3Metadata) -> None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since this test does nothing for v3 metadata, would it be possible to only run it on ArrayV2Metadata
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here I made it do something ;) . really we should fill it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i was more thinking that it would make sense to test the v2 and v3 specs in separate tests, since they are logically independent, but we can do that refactor later
i will look over this again tomorrow. I think we should definitely try to fix the underlying bug this week, e.g. via this PR |
* main: don't serialize empty tuples for v2 filters, and warn when reading such metadata (zarr-developers#2847)
We were violating the v2 spec by serializing "no filters" as the empty array. We created arrays in the wild with this metadata, so any fix should be backwards compatible.
To fix this bug, this PR changes the filters parsing function so that it no longer returns empty tuples, and instead return
None
when no filters are specified. For backwards compatibility with datasets created with earlier versions of zarr-python 3.x, thefrom_dict
method will replace empty lists / tuples with the valueNone
and emit a warning.After a reasonable amount of time (a few minor releases?) we should remove this special-casing and treat
filters = []
as an error. Happy to chat about the timeline.closes #2842
TODO:
docs/user-guide/*.rst
changes/