Skip to content

feat(validator): validate examples.zarr channel_combos metadata#68

Draft
VBaratham wants to merge 6 commits into
rlim/port-dca-zarr-validator-2from
vyassa/example-images-channel-combos-validator
Draft

feat(validator): validate examples.zarr channel_combos metadata#68
VBaratham wants to merge 6 commits into
rlim/port-dca-zarr-validator-2from
vyassa/example-images-channel-combos-validator

Conversation

@VBaratham

Copy link
Copy Markdown
Collaborator

What

Validates the OPTIONAL channel_combos panel metadata on the examples.zarr root group (the spec side is ops-schema #67).

  • Shape (OPSChannelComboMetadata + validate_ops_examples_channel_combos_metadata): names unique + non-empty, primary_channel non-empty, priority ≥ 0 when present (optional).
  • Cross-leaf (examples.py): primary_channel MUST be present in every leaf of its combo. Sampled one leaf per distinct source_screen (the channel set is uniform within a screen, but a combo can aggregate multiple screens with differing sets). check_primary_channels is a pure, dependency-injected rule; default_sample_leaves does the fsspec walk (local + S3).
  • Routing: any group carrying a top-level channel_combos attribute is dispatched to the examples validator before NGFF/HCS checks — the spec forbids applying HCS checks to this artifact. New ZarrNodeType.EXAMPLES_ROOT + registry entry.

Tests

21 new tests (shape, labels_from_attrs, pure cross-leaf rule, real local-fixture sampler, orchestrator pass/fail, end-to-end validate_zarr_node routing) — all pass. Existing zarr tests (34) unaffected.

Notes

  • Stacked on rlim/port-dca-zarr-validator-2 (per request) — that branch's restructured zarr_validation/ package + multi-screen handling is the right base. Retarget to main after it merges.
  • Pre-existing env quirk surfaced while testing: ops_validator/__init__.py eagerly imports the experimental validator → pronto (only in the [all] extra), so pip install -e ".[dev]" alone can't collect tests; needs [all,dev]. Not addressed here.

🤖 Generated with Claude Code

VBaratham and others added 6 commits June 17, 2026 14:08
Add validation for the OPTIONAL channel_combos panel metadata on the
examples.zarr root group (see ops-schema example-images.md #67):

- OPSChannelComboMetadata model + validate_ops_examples_channel_combos_metadata:
  shape checks (unique non-empty names, non-empty primary_channel,
  priority >= 0 when present).
- examples.py: cross-leaf rule (check_primary_channels) asserting each
  primary_channel is present in every leaf of its combo, sampling one leaf
  per distinct source_screen (default_sample_leaves; local + S3 via fsspec).
- Route any group carrying top-level `channel_combos` to the examples
  validator before NGFF/HCS dispatch — the spec forbids HCS checks on this
  artifact. New ZarrNodeType.EXAMPLES_ROOT + registry entry.

Tests: shape, cross-leaf rule, local-fixture sampler, orchestrator, and
end-to-end validate_zarr_node routing. 21 new tests pass; existing zarr
tests unaffected.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The examples-root routing test round-trips through `zarr.open_group`, and a
hand-written root `zarr.json` didn't read back consistently across
zarr/platform combos (passed on macOS, failed on Linux CI with
node_type=None). Write the root group via the zarr API so its metadata is
exactly what the installed zarr expects. Leaves stay hand-written (read by the
fsspec sampler, not zarr).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The examples-root routing branch (`if "channel_combos" in raw_attrs: ->
validate_examples_root`) plus its import were left out of the original commit,
so CI ran the unmodified dispatcher: examples roots fell through to
open_ome_zarr, failed NGFF validation, and returned node_type=None (local
passed only because the working tree had the change). Commit validator.py and
restore the test to its clean form (the zarr-fixture/debug churn chased the
wrong cause).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Replace the single REQUIRED `primary_channel` with an OPTIONAL ordered
`display_channels` list (omit ⇒ show all channels, the default). The
cross-leaf rule now checks every listed label is present in every leaf of
its combo, rather than a single primary.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

@kyleawayan kyleawayan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

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.

2 participants