Repository navigation
fix(zarr-metadata): compare the declarations a configuration holds whatever order it writes them in - #451
Closed
d-v-b wants to merge 2 commits into
Closed
fix(zarr-metadata): compare the declarations a configuration holds whatever order it writes them in#451d-v-b wants to merge 2 commits into
d-v-b wants to merge 2 commits into
Conversation
…atever order it writes them in `declaration_key` paired each nested declaration's key with its location, in the order the configuration wrote them. So two `sharding_indexed` codecs that differed only in whether `codecs` or `index_codecs` came first had different keys, and were not equal, although the order of the members of a JSON object means nothing and the rest of a configuration is already compared as sorted JSON text. The array models that held them were not equal either. The nested keys are now sorted by location. An index of an array sorts by its number, so the items of an array, such as the codecs of a pipeline, are still compared in order. Assisted-by: ClaudeCode:claude-fable-5-2
This was referenced Nov 16, 2026
Closed
Assisted-by: ClaudeCode:claude-fable-5-2
Owner
Author
|
🤖 AI text below 🤖 Closed by the agent in favour of zarr-developers#4641, which is the same branch opened upstream. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
Two declarations that hold other declarations, such as two
sharding_indexedcodecs, are now equal when they differ only in the order their configurations write their members in. The declarations a configuration holds were compared in the order it writes them, so a shard that writesindex_codecsbeforecodecswas not equal to one that writes them the other way round, and neither were the array models that hold them, although the order of the members of a JSON object means nothing. The items of an array, such as the codecs of a pipeline, are still compared in order.How it was found, and the change
The agent found this while testing canonical documents: a v3 array document and the same document with the members of every object reversed read as two unequal models when it held a shard. Attributes, extra fields, unclaimed configurations and a configuration's own members are compared as sorted JSON text, so their order never mattered. Only
_nested_keyindefinition/_definition.pykept written order, because it iterated thenestedmapping. It now sorts by location, with a sort key that never compares an object key with an array index.refinesalready compared nested declarations by location, so it is unchanged.hashfollows==, since both use the key.Tests and checks
tests/v3/test_definitions.py: three cases added to the table oftest_two_declarations_are_equal_when_they_read_the_same. A shard with its members reversed is equal (this case fails without the fix), a shard with its index codecs in another order is not, and a codec with no nested declarations and its members reversed is equal, as before.ruff0.17.3 andpyright.Stack bookkeeping
main, which matches upstreammainat 95ec04a (zarr-metadata 0.9.0). Independent of feat(zarr-metadata): compare each codec in its simplest spelling for the chunk it receives #450.🤖 Generated with Claude Code