Skip to content

refactor(zarr-metadata): validators type an unread document as what it is - #4425

Merged
d-v-b merged 2 commits into
zarr-developers:mainfrom
d-v-b:refactor/zarr-metadata-unread-document-types
Sep 26, 2026
Merged

d-v-b merged 2 commits into
zarr-developers:mainfrom
d-v-b:refactor/zarr-metadata-unread-document-types

Conversation

@d-v-b

@d-v-b d-v-b commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

🤖 AI text below 🤖

Five validators cast a document to Mapping[str, object] before any key was checked, then cast it again to Mapping[object, object] to check the keys. It is Mapping[object, object] until its keys are read, and _missing_keys, _check_literal and _validate_dim_sequence now take it so, which removes 4 casts. No behaviour changes, so there is no changelog entry.

This is one of eight independent PRs from a review of the casts in zarr_metadata.model, each based on main and each passing just check alone, with a test that fails without its fix where there is behaviour to test:

They and #4422 all change model/_validation.py, as #4420 and #4421 did before they merged, so each one merged after the first needs a rebase. Each is rebased onto both, so its tests are type-checked as #4421 now requires. All eight together, merged with #4421's type-checked tests, pass just check.

🤖 Generated with Claude Code

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 zarr-metadata | 🛠️ Build #34777264 | 📁 Comparing 726860b against latest (d21a5b4)

  🔍 Preview build  

2 files changed
± api/model/index.html
± api/pydantic/index.html

…t is

Five validators cast a document to `Mapping[str, object]` before any key
was checked, then cast it again to `Mapping[object, object]` to check
the keys. It is `Mapping[object, object]` until its keys are read, and
`_missing_keys`, `_check_literal` and `_validate_dim_sequence` take it
so, which removes the second casts.

Assisted-by: ClaudeCode:claude-opus-5-5
@d-v-b
d-v-b force-pushed the refactor/zarr-metadata-unread-document-types branch from 726860b to 948d8fd Compare September 26, 2026 18:41
@d-v-b
d-v-b marked this pull request as ready for review September 26, 2026 18:44
@d-v-b
d-v-b merged commit 6c7b285 into zarr-developers:main Sep 26, 2026
8 of 11 checks passed
@d-v-b
d-v-b deleted the refactor/zarr-metadata-unread-document-types branch September 27, 2026 12:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs release notes Automatically applied to PRs which haven't added release notes zarr-metadata Specific to the zarr-metadata sub-package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant