Skip to content

feat(zarr-metadata): incremental v3 array builder, extension-point table, TypeIs codec guards - #319

Open
d-v-b wants to merge 2 commits into
zarr-metadata/rules-layerfrom
zarr-metadata/builder-extras
Open

feat(zarr-metadata): incremental v3 array builder, extension-point table, TypeIs codec guards#319
d-v-b wants to merge 2 commits into
zarr-metadata/rules-layerfrom
zarr-metadata/builder-extras

Conversation

@d-v-b

@d-v-b d-v-b commented Sep 4, 2026

Copy link
Copy Markdown
Owner

🤖 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 return T | UNSET, and build() 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 symmetric with_ / without_ pair in place of evolve / without.
  • v3._extension_points table: per identifier, where it was standardized (CORE / REGISTERED / PROPOSED) and the URL of the definition modelled; per extension point, whether must_understand: false is permitted and whether the field holds a sequence. Drift-tested against the type modules.
  • v3.codec.kind TypeIs guards 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 src and examples (0 errors), 837 tests, strict docs build.

🤖 Generated with Claude Code

…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant