Skip to content

Remove the unused zarrSchema module - #107

Merged
xinaesthete merged 4 commits into
mainfrom
claude/adoring-poincare-f2e03d
Jul 31, 2026
Merged

Remove the unused zarrSchema module#107
xinaesthete merged 4 commits into
mainfrom
claude/adoring-poincare-f2e03d

Conversation

@xinaesthete

@xinaesthete xinaesthete commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Follows #105. packages/zarrextra/src/zarrSchema.ts had no callers: not exported from index.ts, referenced nowhere outside its own spec.

The choice was to either route the tree builder's array-metadata read through these schemas — so parseStoreContentsreadMetadataJson validates at the boundary instead of storing a bare JSON.parse result under ZARRAY_KEY — or delete the module. This does the latter.

Why not validate on open

#105 already decided this, and wrote the decision down. From ZarrArrayMetadata's docstring:

The third member is deliberate rather than sloppy. This is unvalidated JSON straight from the store, and zarr v3 permits data types we do not model (an extension dtype is written as an object, not a string), so a union of only the two known shapes would either be a lie or would have to fail the whole store open.

A schema that rejects a store at open time is that same failure by another route. The module's own comments already recorded it happening — string is absent from the v3 spec's data-type listing, so the schema failed on the first real object it met, and the v3dtypeSchema literal union still models no extension dtypes at all.

Validation here would also be redundant twice over. zarrita validates array metadata on the real read path (zarr.open), and the tree's ZARRAY_KEY copy is a metadata cache, not the thing chunks are read through.

The one genuinely useful thing the module did — reconciling v2's dtype with v3's data_type — is normalizeDtype/getArrayDtype as of #105, and they do it better: in zarrita's own DataType vocabulary, returning undefined for an unmodelled type rather than throwing. validateAndConvertV2Zarray claimed a ZarrV3ArrayNode return while leaving the raw numpy typestring (<f8) sitting in data_type, so wiring it in would have put a v2 value in a v3-shaped field — exactly the ambiguity getArrayDtype exists to remove.

Conversion was lossy besides: it hardcoded attributes: {}, discarding attrs the tree keeps; forced zarr_format: 3; and synthesised chunk_key_encoding with separator /, where v2's default is ..

Changes

  • Delete zarrSchema.ts (303 lines) and zarrSchema.spec.ts (264 lines)
  • Repoint ZarrV3ArrayNode's docstring, which referenced {@link validateV3Zarray} for the validated/unvalidated contrast, at ZarrArrayMetadata where that rationale now lives
  • Delete ZarrV3GroupNode and ZarrV3Metadata — referenced only by each other, not exported from index.ts, and types.ts is unreachable through the package's exports map. These predate zarrextra: runtime type guards for tree nodes, docs, and build/test packaging fixes #105; they go here only because this pass put the file under the light.
  • Drop zod from zarrextra, which nothing else in the package imports

ZarrV3ArrayNode and ZarrV2ArrayNode stay — both are exported, and are the members of the public ZarrArrayMetadata union.

Net: 12 insertions, 605 deletions. No public API removed: nothing deleted here was reachable from zarrextra's entry point.

Verification

pnpm build, pnpm test:unit (795 passed / 96 files), pnpm lint:biome, and the docs build all pass on the rebased branch. Patch changeset included; zarrextra takes a single patch bump alongside #105's still-pending zarr-tree-node-guards.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Refactor

    • Removed unused metadata validation and normalization components.
    • Metadata is now read directly from storage without validation or normalization.
    • Simplified dtype reconciliation using the supported data type vocabulary.
  • Documentation

    • Updated metadata handling documentation to reflect the new behavior.

xinaesthete and others added 2 commits July 31, 2026 21:24
The v2/v3 `.zarray` zod schemas had no callers and were never exported
from the package. Routing the tree builder through them was the
alternative considered, and it runs against the decision this package
just made: `ZarrArrayMetadata` admits an unrecognised record precisely
so a store carrying a data type we do not model still opens, and
`getArrayDtype` answers `undefined` for such a type rather than
throwing. A schema that rejects the whole store at open time is the
opposite of that — and zarr v3 extension dtypes, written as objects
rather than strings, are exactly the case it would have rejected.
`zarrita` already validates array metadata on the real read path.

The one useful thing the module did — reconciling v2's `dtype` with v3's
`data_type` — is now `normalizeDtype`, which does it in `zarrita`'s own
`DataType` vocabulary rather than leaving a numpy typestring sitting in
a v3-shaped `data_type` field, as `validateAndConvertV2Zarray` did.

`ZarrV3ArrayNode` stays: it is exported, and describes metadata as it
arrives from a store rather than anything the deleted validator
produced. Its docstring pointed at `validateV3Zarray` for that contrast,
so it now points at `ZarrArrayMetadata`, where the rationale lives.

Drops `zod` from the package, which nothing else in it imports.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
`ZarrV3GroupNode` and `ZarrV3Metadata` describe zarr.json's group and
consolidated-metadata shapes, but nothing reads them: they reference
only each other, are not exported from index.ts, and types.ts is not
reachable through the package's exports map. The tree builder does not
use them either — `parseStoreContents` works from zarrita's
`store.contents()` rather than from a typed view of zarr.json.

They predate the zarrSchema removal rather than being orphaned by it;
they are going now only because that pass put the file under the light.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@xinaesthete, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 50 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 872d7d48-e22c-4783-a09b-5159f78037a1

📥 Commits

Reviewing files that changed from the base of the PR and between de1ade7 and ea48b78.

📒 Files selected for processing (1)
  • .changeset/hungry-donkeys-shave.md
📝 Walkthrough

Walkthrough

The change removes unused Zarr schema validation and its tests, removes the zod dependency, updates metadata parsing documentation, and removes obsolete exported metadata types. Dtype reconciliation remains handled by normalizeDtype.

Changes

Zarr metadata cleanup

Layer / File(s) Summary
Remove schema validation and dependency
.changeset/hungry-donkeys-shave.md, packages/zarrextra/package.json, packages/zarrextra/src/zarrSchema.ts, packages/zarrextra/tests/zarrSchema.spec.ts
The unused schema module and validation tests are deleted. zod is removed from production dependencies. The changeset records the metadata handling and dtype behavior.
Align metadata type declarations
packages/zarrextra/src/types.ts
ZarrV3ArrayNode documentation states that store metadata is parsed without validation or normalization. ZarrV3GroupNode and ZarrV3Metadata are removed.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: removal of the unused zarrSchema module.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/adoring-poincare-f2e03d

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.changeset/hungry-donkeys-shave.md:
- Line 7: Update the changeset wording to identify the metadata filenames
accurately: v2 uses `.zarray`, while v3 uses `zarr.json`; alternatively, refer
generically to v2/v3 array metadata schemas without implying both use `.zarray`.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: bbed198b-f59c-46dc-8b45-ec6a3f955af9

📥 Commits

Reviewing files that changed from the base of the PR and between 2c7e3c3 and de1ade7.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (5)
  • .changeset/hungry-donkeys-shave.md
  • packages/zarrextra/package.json
  • packages/zarrextra/src/types.ts
  • packages/zarrextra/src/zarrSchema.ts
  • packages/zarrextra/tests/zarrSchema.spec.ts
💤 Files with no reviewable changes (2)
  • packages/zarrextra/tests/zarrSchema.spec.ts
  • packages/zarrextra/src/zarrSchema.ts

Comment thread .changeset/hungry-donkeys-shave.md Outdated
xinaesthete and others added 2 commits July 31, 2026 21:34
v2 writes `.zarray` and v3 writes `zarr.json` — `metadataKeysForPath`
reads both, and the `ZarrV2ArrayNode` / `ZarrV3ArrayNode` docstrings in
the same package already say so. The changeset said "v2/v3 `.zarray`",
which implies v3 uses `.zarray` too. Changesets become published
CHANGELOG entries, so the wording is worth getting right.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Nothing here was exported, so the only thing a `zarrextra` consumer can
observe is `zod` leaving the dependency list. The argument for deleting
rather than wiring the schemas into the tree builder is review material,
and already lives in e400aee and the PR — a published CHANGELOG entry is
the wrong place for it.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@xinaesthete
xinaesthete merged commit 423448b into main Jul 31, 2026
6 checks passed
@xinaesthete
xinaesthete deleted the claude/adoring-poincare-f2e03d branch July 31, 2026 20:40
@github-actions github-actions Bot mentioned this pull request Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant