Skip to content

fix(metadata): validate codecs after a transpose against the transposed chunk grid - #449

Draft
d-v-b wants to merge 25 commits into
mainfrom
fix/transpose-chunk-grid-validation
Draft

d-v-b wants to merge 25 commits into
mainfrom
fix/transpose-chunk-grid-validation

Conversation

@d-v-b

@d-v-b d-v-b commented Nov 16, 2026 •

Copy link
Copy Markdown
Owner

🤖 AI text below 🤖

Fix array metadata validating each codec against the stored chunk grid even after a TransposeCodec filter had permuted the chunk shape. A sharding serializer whose inner chunk shape divided only the stored grid was accepted, then read back wrong data. A valid one was rejected. Codecs gain a resolve_chunk_grid method, the chunk-grid counterpart of resolve_metadata, which TransposeCodec uses to permute the grid.

Summary

Repro on upstream main (95ec04a): shape (12, 40), chunks (6, 20), filters=[TransposeCodec(order=(1, 0))].

  • ShardingCodec(chunk_shape=(3, 10)) was accepted. The sharding codec receives (20, 6) chunks, and writing then reading back returned different data (np.array_equal was False).
  • ShardingCodec(chunk_shape=(10, 3)), which is valid, was rejected with "Chunk edge length 6 in dimension 0 is not divisible by the shard's inner chunk size 10."

Fix:

  • BaseCodec.resolve_chunk_grid(chunk_grid) -> ChunkGridMetadata is a new hook, the grid counterpart of resolve_metadata. By default it returns the grid unchanged, which is correct for any codec that keeps a chunk's shape. The public Codec.validate signature does not change, so third-party codecs are unaffected.
  • TransposeCodec.resolve_chunk_grid permutes the grid's dimensions by order, as resolve_metadata permutes the shape.
  • ArrayV3Metadata.__init__ passes the grid through the codecs alongside the spec, so each codec is validated against the grid that the codecs before it leave.
  • _validate_metadata no longer runs its second codec validate loop, which ignored the earlier codecs. It also now runs before the codec loop, so an ndim mismatch between the grid and the shape is reported as such instead of surfacing inside a codec.
  • docs/user-guide/extending.md lists the new hook.
Design: why a hook, and how rectilinear grids work

For a regular grid, the grid could be derived generically by passing the chunk shape through resolve_metadata. Rectilinear grids rule that out. A transpose moves each dimension's edge list, and for a square array with different edge lists per dimension, nothing in resolve_metadata's output shows which dimension moved where. Only the codec knows its permutation, so the codec owns the mapping. Under a transpose, rectilinear edge lists (and bare-int dimensions) move with their dimensions.

A third-party codec that changes chunk shape but does not override the hook keeps the behavior from before this PR, so it is no worse off.

The pipeline-level CodecPipeline.validate methods in codec_pipeline.py still loop without passing the grid through, but nothing in the codebase calls them. They are out of scope here.

Tests
  • test_sharding_after_transpose is one parametrized success test. It covers a regular grid, a regular grid transposed twice (a control), a 3-D non-self-inverse order, a rectilinear grid on a square array, and a rectilinear grid with a bare-int dimension. Each case writes and reads data back.
  • test_sharding_after_transpose_indivisible covers the single error case, an inner chunk shape that divides the stored grid but not the transposed one, for regular and rectilinear grids.
  • Every new case except the twice-transposed control fails against upstream main's source. The full suite passes: 13258 passed, 1251 skipped, 9 xfailed. pre-commit passes, including mypy.
Stack notes

🤖 Generated with Claude Code

d-v-b and others added 7 commits November 13, 2026 21:55
…l value

Creating a sharded array failed when the inner codec chain could not
encode the data type's default scalar, e.g. a `scale_offset` filter that
maps only a subrange of the data type, even when the array's own fill
value encodes fine (zarr-developers#4511). `ShardingCodec.validate` probed the inner
chain with `dtype.default_scalar()`, since `validate` never receives the
fill value.

Run the inner-chain check from `ShardingCodec.evolve_from_array_spec`
instead, which receives the threaded spec: each inner codec is evolved,
validated and resolved against the spec the codecs before it leave,
including the fill value as those codecs encode it. An array whose fill
value the inner chain cannot encode is still rejected, because an
unwritten chunk holds the fill value.

Also drop the per-codec `validate` loop from
`ArrayV3Metadata._validate_metadata`. `__init__` has already validated
each codec against the threaded spec; the loop re-validated them against
the array's own data type, which rejected valid chains such as int16 ->
`cast_value` float32 -> `scale_offset` with a scale of 0.5.

Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5
Draw array documents from zarr-metadata's hypothesis strategies and hand
each to `ArrayV3Metadata.from_dict`. zarr-python may refuse a valid
document only for a fill value its codecs cannot encode, and must then
refuse it too with each shard's codecs moved out of the shard. Two slices
run: every definition, and the integer/float data types with the
value-transforming codecs, where fill value refusals are common.

Before this branch's fix the property fails for both bugs it fixes: the
unthreaded re-validation in `_validate_metadata`, and the sharding probe
with the data type's default scalar.

Known divergences are left out of the draw where possible and each is
pinned by a strict xfail test: object-spelled data types, `r*` raw bits,
integer-array `bytes` fill values, sharding behind `transpose`, hex
`cast_value` scalar map values, and zarr-metadata accepting empty
rectilinear edge lists (barred since zarr-extensions#78).

Adds `zarr-metadata[testing]==0.8.0` to the test dependency group.

Assisted-by: ClaudeCode:claude-opus-5-5
…deps

The conformance test exhausted memory on CI: zarr-python expands each
run-length pair of rectilinear edges into a list, and zarr-metadata draws
runs of up to millions of chunks. Draw no grid listing more than 10,000
chunks along an axis, and pin the divergence with a strict xfail test.

The min_deps env could not resolve: zarr-metadata 0.8.0 needs
typing-extensions>=4.16, and min_deps pins 4.14. Move zarr-metadata into
its own `conformance` dependency group, which the test envs include and
min_deps does not, and skip the module where it is not installed.

Assisted-by: ClaudeCode:claude-opus-5-5
…ed chunk grid

`ArrayV3Metadata` validated every codec against the stored chunk grid, even
after a `TransposeCodec` filter had permuted the chunk shape. A sharding
serializer whose inner chunk shape divided only the stored grid was accepted
and then wrote data that read back wrong; one that divided the chunks it
actually receives was rejected.

Codecs gain a `resolve_chunk_grid` hook, the grid counterpart of
`resolve_metadata`, which defaults to the identity. `TransposeCodec` permutes
the grid's dimensions with it, moving a rectilinear grid's edge lists with
their dimensions. Array metadata threads the grid through the codecs alongside
the spec, and drops the second, unthreaded validate loop.

Assisted-by: ClaudeCode:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-by: ClaudeCode:claude-opus-5-5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
d-v-b and others added 9 commits November 30, 2026 16:07
…-value' into claude/compassionate-bun-956ef7

# Conflicts:
#	src/zarr/core/metadata/v3.py
…does not divide

Validation runs when a stored array is opened, so checking that a sharding
codec's inner chunk shape divides its shards in `ShardingCodec.validate`
made such arrays, and every group holding one, unopenable. Older versions
stored them: a transposed shard that the inner chunk shape divides only
untransposed, or a nested sharding codec. The check moves to
`ShardingCodec.check_chunk_grid`, which `ArrayV3Metadata.to_buffer_dict`
runs (via `check_shard_chunk_grids`) on the grid each sharding codec
receives, so such metadata is still never stored. Reading or writing such
a shard now raises in `_get_chunks_per_shard` instead of returning data
from the wrong place or dropping data.

The zarr-metadata conformance test no longer excludes sharding behind a
transpose, which the merged transpose fix reads correctly.

Assisted-by: ClaudeCode:claude-opus-5.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The divisibility check left `ShardingCodec.validate`, so the rectilinear
grid tests call `check_chunk_grid`. Creating an array after a transpose now
warns about partial reads before its metadata is refused, as the round-trip
test already expects.

Assisted-by: ClaudeCode:claude-opus-5.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…lity

Review fixes for the stored-array opening change:

- `_check_chunk_grid` no longer compares an inner chunk shape with a grid of
  another number of dimensions (a filter such as `PackBits` that flattens
  chunks without declaring its grid). It compared dimension 0 only, which
  refused `PackBits` followed by a sharding codec whose inner chunk shape
  divides the flattened shard. Reading or writing checks the shard itself.
- `TransposeCodec.resolve_chunk_grid` returns such a grid unchanged instead
  of raising `IndexError` when the array is opened.
- The shard checks are private (`_check_chunk_grid`,
  `_check_shard_chunk_grids`) rather than new public API.
- Docstrings no longer claim checks that moved, and say that a group's
  consolidated metadata is not checked.
- Tests: a codec after a transpose is validated against the transposed grid;
  `PackBits` followed by sharding round-trips; the conformance test for
  sharding behind a transpose stores the metadata, so it fails without the
  transpose fix.
- The changelog splits the new `resolve_chunk_grid` hook into a feature
  fragment.

Assisted-by: ClaudeCode:claude-opus-5.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The store-time shard check read shard shapes from `resolve_chunk_grid`,
whose default leaves the grid unchanged even for a codec whose
`resolve_metadata` changes the chunk shape. Behind `PackBits` it refused
valid shards (a nested sharding codec that `main` accepts) and stored
metadata whose shards it could tell were indivisible.

`_check_shards` now passes a chunk spec through `resolve_metadata`, as
reading and writing do. A regular grid's shards and every shard's inner
chunks are checked against that spec, exactly for any codec. Only the
shards of a rectilinear grid, whose shapes differ, are checked against
the grid. The zarr-metadata conformance property now also stores each
document it reads, so it covers the store-time check.

Assisted-by: ClaudeCode:claude-opus-5.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A codec that changes the shape of a chunk without declaring its grid
(`PackBits`) leaves the rectilinear grid describing unpacked chunks. The
store-time check compared those edges with the inner chunk shape and
refused a valid 1-D array whose packed shards the inner chunks divide.
`_check_shards` now checks the grid only while its first chunk matches the
threaded chunk spec, which also replaces the dimension-count guard in
`_check_chunk_grid`; reading or writing checks a stale grid's shards.

Assisted-by: ClaudeCode:claude-opus-5.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A codec whose output's number of dimensions depends on the chunk shape
(such as one that drops axes of length 1) can leave the shards with
another number of dimensions than the inner chunk shape, which validation
against the array's shape does not see. Storing such metadata raised a
bare `zip()` error. `_check_shards` now refuses it with an explanation,
and reading or writing such a shard raises the shard error. A stale
rectilinear grid now checks the first shard, whose shape the spec gives
exactly, instead of nothing.

Assisted-by: ClaudeCode:claude-opus-5.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Reading or writing a shard whose shape has another number of dimensions
than the inner chunk shape now says so, instead of calling the shapes
indivisible. A test covers the first-shard check of a rectilinear grid
that `PackBits` left stale.

Assisted-by: ClaudeCode:claude-opus-5.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An inner chunk size of 12 divides the stale grid's edge of 96 but not the
13-byte first shard, so the test fails if the stale grid is checked.

Assisted-by: ClaudeCode:claude-opus-5.5
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@d-v-b
d-v-b marked this pull request as draft November 30, 2026 16:41
@d-v-b

d-v-b commented Nov 30, 2026

Copy link
Copy Markdown
Owner Author

🤖 AI text below 🤖

The agent merged #446 into this branch and changed how a sharding codec's inner chunk shape is checked, so that arrays already stored with an indivisible inner chunk shape open again. The check that the inner chunk shape divides each shard moved out of ShardingCodec.validate, which also runs when an array is opened or a group lists its members, into ArrayV3Metadata.to_buffer_dict, which runs before any array metadata is stored. Reading or writing such a shard now raises instead of returning wrong data or dropping data.

Stack: this PR now contains #446 (upstream zarr-developers#4633) and should merge after it. It stays a draft until #446 merges and main is merged in here.

What changed since the previous head (4528fc7)
  • Merged fix/sharding-probe-threaded-fill-value (fix(sharding): validate the inner codec chain against the array's fill value #446). The v3.py conflict kept this PR's threaded loop in __init__. fix(sharding): validate the inner codec chain against the array's fill value #446's conformance test no longer excludes sharding behind a transpose.
  • ShardingCodec.validate checks only the dimension count and the grid type. Divisibility is checked by zarr.codecs.sharding._check_shards from ArrayV3Metadata.to_buffer_dict.
    • Regular grids and nested shards: checked against a chunk spec threaded through resolve_metadata, as reads and writes do. This is exact for any codec, including PackBits.
    • Rectilinear grids: checked against the grid threaded through resolve_chunk_grid. If the grid's first chunk no longer matches the spec (a codec changed the chunk shape without declaring its grid), only the first shard is checked.
    • Dimension mismatch: refused with an explanation.
  • ShardingCodec._get_chunks_per_shard raises for a shard that the inner chunk shape does not divide, or that has another number of dimensions. It used to floor-divide.
  • Consolidated metadata does not run the shard check, so a group holding such an array can still be consolidated.
  • TransposeCodec.resolve_chunk_grid returns a grid with another number of dimensions unchanged, rather than raising IndexError.
  • Changelog: 449.bugfix.md rewritten, plus a new 449.feature.md for resolve_chunk_grid.

Behavior on a store that main wrote (shape (8, 12), transpose, ShardingCodec((4, 6))):

main this PR
open_group(...).members() lists lists
open the array opens opens
read 24 of 96 cells wrong, silently raises
write drops data, silently raises, store unchanged
update_attributes / resize succeeds raises, store unchanged
Tests
  • test_open_stored_indivisible_sharding: arrays stored with an indivisible inner chunk shape (top-level, after a transpose, nested) open, and their group lists them. The other tests are one per error case:
    • test_read_stored_indivisible_sharding
    • test_write_stored_indivisible_sharding
    • test_store_metadata_of_stored_indivisible_sharding
  • test_sharding_after_flattening_filter, with one error test per case in test_sharding_after_flattening_filter_indivisible: PackBits before sharding (1-D, 2-D, rectilinear, nested).
  • test_sharding_inner_chunk_ndim_mismatch: refused with an explanation.
  • test_validate_after_transpose: a codec after a transpose is validated against the transposed grid.
  • The conformance property now also stores each document it reads.
  • Each new test was checked to fail with the code it guards reverted.
  • Full suite: 13403 passed, 1322 skipped, 16 xfailed. pre-commit (ruff, mypy) passes.
Adversarial review record (6 rounds, fresh reviewer agents)

Round 1 (3 reviewers: correctness, compatibility, design/tests)

  • Fixed in 24ab145:
    • PackBits before sharding was compared on dimension 0 only.
    • TransposeCodec.resolve_chunk_grid raised IndexError after an undeclared dimension-changing codec.
    • The shard checks were public names.
    • Docstrings claimed checks that had moved.
    • The grid threading and the conformance transpose test guarded nothing.
  • Fixed in f27f64c: 4 suite failures from the moved check.
  • Not fixed, documented: user-built consolidated metadata can hold an indivisible array. Checking it would block consolidating any group that holds an old one.
  • Not fixed, already on main:
    • the in-memory attributes stay changed after a refused update_attributes;
    • nchunks_initialized floor-divides on broken arrays;
    • the zero-chunk repair uses untransposed units;
    • rectilinear resize growth.

Round 2 (2 reviewers)

  • Fixed in 1051fc0, which checks shards against a spec threaded through resolve_metadata:
    • a valid nested PackBits → sharding was refused (a regression vs main);
    • provably indivisible PackBits shards were stored;
    • the conformance property did not exercise the store check.

Round 3: no serious finding. Minor: a rectilinear grid left stale by PackBits was checked as is. Fixed in db7d0b8.

Round 4

  • Fixed in bbd2212: a third-party codec whose output dimensions depend on the chunk shape made storing raise a bare zip() error. The array is unusable at run time on the parent too.
  • Fixed in bbd2212: a stale rectilinear grid now checks its first shard.
  • Not fixed, documented in _check_shards: the staleness heuristic can be fooled when the first chunk's shape survives the codec.

Round 5: no serious finding. Minor:

  • the dimension-mismatch message: fixed in e3d4255;
  • the stale-grid branch had no test: fixed in e3d4255 and eccbae5;
  • the run-time dimension-mismatch raise has no test: not added, because it needs a globally registered test codec, and the parent failed those reads anyway.

Round 6: no serious finding. The rectilinear test did not pin which shard is checked: fixed in eccbae5.

Follow-ups not in this PR
  • CodecPipeline.validate, in both pipelines, still does not thread spec or grid. Nothing in src calls it.
  • resolve_chunk_grid is still needed for rectilinear grids and for the grid that validate receives. Its identity default is wrong for any codec that changes chunk shape without overriding it (PackBits does not).
  • zarr-metadata refuses indivisible shards on read; zarr-python now reads them and refuses only to store them. This is not yet listed in the conformance test's divergences.

d-v-b and others added 8 commits December 1, 2026 12:01
main now accepts a `bytes` fill value written as an array of integers
(zarr-developers#4493), so its strict xfail passed. Remove the test and the base64-only
fill value strategy, so the property draws both spellings again.

Assisted-by: ClaudeCode:claude-opus-5-5
…developers#4690)

Bumps the python-dependencies group with 9 updates:

| Package | From | To |
| --- | --- | --- |
| [packaging](https://github.com/pypa/packaging) | `26.3` | `26.4` |
| [universal-pathlib](https://github.com/fsspec/universal_pathlib) | `0.3.10` | `0.3.11` |
| [coverage](https://github.com/coveragepy/coveragepy) | `7.17.3` | `7.17.5` |
| [hypothesis](https://github.com/HypothesisWorks/hypothesis) | `6.170.15` | `6.170.17` |
| [uv](https://github.com/astral-sh/uv) | `0.13.9` | `0.13.10` |
| [moto[s3,server]](https://github.com/getmoto/moto) | `5.2.5` | `5.2.6` |
| [mkdocs-material[imaging]](https://github.com/squidfunk/mkdocs-material) | `9.8.1` | `9.8.2` |
| [markdown-exec[ansi]](https://github.com/pawamoy/markdown-exec) | `1.13.0` | `1.14.0` |
| [ruff](https://github.com/astral-sh/ruff) | `0.17.5` | `0.17.6` |


Updates `packaging` from 26.3 to 26.4
- [Release notes](https://github.com/pypa/packaging/releases)
- [Changelog](https://github.com/pypa/packaging/blob/main/CHANGELOG.rst)
- [Commits](pypa/packaging@26.3...26.4)

Updates `universal-pathlib` from 0.3.10 to 0.3.11
- [Release notes](https://github.com/fsspec/universal_pathlib/releases)
- [Changelog](https://github.com/fsspec/universal_pathlib/blob/main/CHANGELOG.md)
- [Commits](fsspec/universal_pathlib@v0.3.10...v0.3.11)

Updates `coverage` from 7.17.3 to 7.17.5
- [Release notes](https://github.com/coveragepy/coveragepy/releases)
- [Changelog](https://github.com/coveragepy/coveragepy/blob/main/CHANGES.rst)
- [Commits](coveragepy/coveragepy@7.17.3...7.17.5)

Updates `hypothesis` from 6.170.15 to 6.170.17
- [Release notes](https://github.com/HypothesisWorks/hypothesis/releases)
- [Commits](HypothesisWorks/hypothesis@v6.170.15...v6.170.17)

Updates `uv` from 0.13.9 to 0.13.10
- [Release notes](https://github.com/astral-sh/uv/releases)
- [Changelog](https://github.com/astral-sh/uv/blob/main/CHANGELOG.md)
- [Commits](astral-sh/uv@0.13.9...0.13.10)

Updates `moto[s3,server]` from 5.2.5 to 5.2.6
- [Release notes](https://github.com/getmoto/moto/releases)
- [Changelog](https://github.com/getmoto/moto/blob/master/CHANGELOG.md)
- [Commits](getmoto/moto@5.2.5...5.2.6)

Updates `mkdocs-material[imaging]` from 9.8.1 to 9.8.2
- [Release notes](https://github.com/squidfunk/mkdocs-material/releases)
- [Changelog](https://github.com/squidfunk/mkdocs-material/blob/master/CHANGELOG)
- [Commits](squidfunk/mkdocs-material@9.8.1...9.8.2)

Updates `markdown-exec[ansi]` from 1.13.0 to 1.14.0
- [Release notes](https://github.com/pawamoy/markdown-exec/releases)
- [Changelog](https://github.com/pawamoy/markdown-exec/blob/main/CHANGELOG.md)
- [Commits](pawamoy/markdown-exec@1.13.0...1.14.0)

Updates `ruff` from 0.17.5 to 0.17.6
- [Release notes](https://github.com/astral-sh/ruff/releases)
- [Changelog](https://github.com/astral-sh/ruff/blob/main/CHANGELOG.md)
- [Commits](astral-sh/ruff@0.17.5...0.17.6)

---
updated-dependencies:
- dependency-name: packaging
  dependency-version: '26.4'
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: python-dependencies
- dependency-name: universal-pathlib
  dependency-version: 0.3.11
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: python-dependencies
- dependency-name: coverage
  dependency-version: 7.17.5
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: python-dependencies
- dependency-name: hypothesis
  dependency-version: 6.170.17
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: python-dependencies
- dependency-name: uv
  dependency-version: 0.13.10
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: python-dependencies
- dependency-name: moto[s3,server]
  dependency-version: 5.2.6
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: python-dependencies
- dependency-name: mkdocs-material[imaging]
  dependency-version: 9.8.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: python-dependencies
- dependency-name: markdown-exec[ansi]
  dependency-version: 1.14.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: python-dependencies
- dependency-name: ruff
  dependency-version: 0.17.6
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: python-dependencies
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Davis Bennett <davis.v.bennett@gmail.com>
)

Bumps the actions group with 2 updates: [CodSpeedHQ/action](https://github.com/codspeedhq/action) and [zizmorcore/zizmor-action](https://github.com/zizmorcore/zizmor-action).


Updates `CodSpeedHQ/action` from 5.6.3 to 5.8.0
- [Release notes](https://github.com/codspeedhq/action/releases)
- [Changelog](https://github.com/CodSpeedHQ/action/blob/main/CHANGELOG.md)
- [Commits](CodSpeedHQ/action@af75f77...b1f28b5)

Updates `zizmorcore/zizmor-action` from 0.8.1 to 0.9.2
- [Release notes](https://github.com/zizmorcore/zizmor-action/releases)
- [Commits](zizmorcore/zizmor-action@45d7276...1b4550e)

---
updated-dependencies:
- dependency-name: CodSpeedHQ/action
  dependency-version: 5.8.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
- dependency-name: zizmorcore/zizmor-action
  dependency-version: 0.9.2
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Davis Bennett <davis.v.bennett@gmail.com>
zarr-metadata 0.9.0 refuses an empty list of rectilinear edge lengths
(zarr-developers#4636), so the strict xfail that pinned the difference passed. Remove it
and the exclusion.

Assisted-by: ClaudeCode:claude-opus-5-5
A filter that flattens each chunk (numcodecs.packbits) hands a 1-d shard
to the sharding codec, which checks its inner chunk shape against the
array's own N-d chunk grid. Dropping the second validation loop from
`_validate_metadata` let such an array through, and it lost the end of
each chunk. Refuse it, as main does.

Replace the conformance test's oracle. It accepted any ValueError raised
below `resolve_metadata`, so a codec that refused every fill value went
unseen. The test now encodes a chunk that holds the fill value and
requires zarr-python to refuse the document if and only if that fails.
Draw 2000 examples, because the profiles' 300 missed both bugs this
branch fixes under the derandomized ci profile. Draw every spelling, and
simplify only the data types. Run the test in the slow Hypothesis recipe.

Assisted-by: ClaudeCode:claude-opus-5-5
A chunk grid whose rank differs from the shape reached the sharding
codec's rank check first, which blamed the shard. Check the grid against
the shape before the codec loop, and name ranks in the shard message.

Assisted-by: ClaudeCode:claude-opus-5-5
…s#4633) into fix/transpose-chunk-grid-validation

Keep this branch's shard checks, which use the chunk grid the codecs before
the shard leave, in place of zarr-developers#4633's rank guard against the array's own grid:
a 2-d array whose packbits filter feeds a 1-d shard that divides the packed
chunk is valid. Drop zarr-developers#4633's rank test, which test_sharding_after_flattening_
filter_indivisible[2d] covers. Take zarr-developers#4633's fill-value oracle for the
conformance test, checking storage as well as reading, with the sharding
behind transpose divergence removed.

Assisted-by: ClaudeCode:claude-opus-5-5

This branch has not been deployed

No deployments
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