feat(zarr-metadata): incremental v3 array builder, extension-point table, TypeIs codec guards - #319
Open
d-v-b wants to merge 2 commits into
Open
feat(zarr-metadata): incremental v3 array builder, extension-point table, TypeIs codec guards#319d-v-b wants to merge 2 commits into
d-v-b wants to merge 2 commits into
Conversation
…ble, TypeIs codec guards `ZarrV3ArrayMetadataBuilder` accumulates a partial v3 array document through `with_fields` / `with_extension` / `without_fields`, firing every composition rule whose dependencies are present after each update and validating completeness at `build()`. `v3._extension_points` records provenance and specification references per identifier and the `must_understand: false` policy per extension point. `v3.codec.kind` gains shape-exact `TypeIs` guards over branded per-kind unions. None of these has a consumer outside the package today; they are split out so the rules layer can merge without them. Split from #296 (part 3 of 3). Assisted-by: ClaudeCode:claude-fable-5-1
Assisted-by: ClaudeCode:claude-fable-5-1
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 🤖
Part 3 of 3, split from #296. Stacked on #318. None of this has a consumer outside the package today; it is separated so the rules layer can merge without it, and this PR can wait for a named caller.
ZarrV3ArrayMetadataBuilder: immutable incremental construction of a v3 array document.with_fields(**kwargs)replaces fields (typed by the partial TypedDict),with_extension(name, value)sets an extension field on checkers without PEP 728,without_fields(*keys)removes keys, properties returnT | UNSET, andbuild()returns a complete validated document. Every rule whose dependencies are present fires after each update, and a conflict between a field set now and one set earlier names both. The names follow the review comment on feat(zarr-metadata): composition rules layer, shape-exact codec guards, typed builders #296 asking for a symmetricwith_/without_pair in place ofevolve/without.v3._extension_pointstable: per identifier, where it was standardized (CORE/REGISTERED/PROPOSED) and the URL of the definition modelled; per extension point, whethermust_understand: falseis permitted and whether the field holds a sequence. Drift-tested against the type modules.v3.codec.kindTypeIsguards over branded per-kind unions (ArrayArrayCodecMetadata,ArrayBytesCodecMetadata,BytesBytesCodecMetadata,KnownCodecMetadata), shape-exact so two-sided narrowing is sound.examples/build_v3_array.py, shipped in the sdist and executed by the test suite.Verified: ruff, pyright 1.1.404 strict on
srcandexamples(0 errors), 837 tests, strict docs build.🤖 Generated with Claude Code