Skip to content

fix(zarr-metadata)!: make entity types assignable to metadata fields; validators return tuples - #317

Open
d-v-b wants to merge 2 commits into
mainfrom
zarr-metadata/types-and-tuples
Open

fix(zarr-metadata)!: make entity types assignable to metadata fields; validators return tuples#317
d-v-b wants to merge 2 commits into
mainfrom
zarr-metadata/types-and-tuples

Conversation

@d-v-b

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

Copy link
Copy Markdown
Owner

🤖 AI text below 🤖

Part 1 of 3, split from #296. Small and independent; the other two parts stack on it.

  • ZarrV3NamedConfigJSON.name / .configuration are ReadOnly (PEP 705) and the envelope is closed (PEP 728), so every concrete codec / chunk-grid / chunk-key-encoding / data-type TypedDict is now assignable to the fields it describes (codecs, chunk_grid, data_type, ...). Previously a type checker rejected putting BloscCodecMetadata into codecs.
  • Every concrete *Object / *Configuration TypedDict is closed, and object forms declare must_understand: NotRequired[bool].
  • Breaking: every validate_* in zarr_metadata.model returns tuple[ValidationProblem, ...] instead of a list, and MetadataValidationError.problems is a tuple.
  • load_store_json returns object rather than Any; ANN401 is enforced package-wide.
  • ZarrV2ConsolidatedMetadataJSON.zarr_consolidated_format is Literal[1].
  • zarr_metadata.pydantic serializers declare their return schema via the pydantic-facing shadow types.

The structural validator is otherwise unchanged; the dimension_names / chunks rank checks stay where they are until part 2.

Verified: ruff, pyright 1.1.404 strict (0 errors), 595 tests.

🤖 Generated with Claude Code

… validators return tuples

`ZarrV3NamedConfigJSON.name` and `.configuration` are `ReadOnly` and the
envelope is `closed`, so the concrete codec / chunk-grid / chunk-key-encoding
/ data-type TypedDicts are assignable to the fields they describe. Every
concrete `*Object` / `*Configuration` is `closed` and object forms declare
`must_understand: NotRequired[bool]`.

Every `validate_*` in `zarr_metadata.model` returns
`tuple[ValidationProblem, ...]`, `MetadataValidationError.problems` is a
tuple, and `load_store_json` returns `object` rather than `Any`. `ANN401`
is enforced package-wide. `ZarrV2ConsolidatedMetadataJSON.zarr_consolidated_format`
is `Literal[1]`.

Split from #296 (part 1 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