format: chunk grids with a zero extent have no chunks (no division by zero)

A Fixed or Extensible Array index whose maximum extent (the current one
when no maximum is recorded) is 0 along a dimension has a zero stride for
every dimension before it; ChunkGrid::offsets divided by it. The unfixed
editor made such files by resizing a clawhdf5-written dataset to a zero
extent: `h5rs check` panicked and the next resize raised an internal
error (12 of the reviewer's random-edit seeds 10..39). Such an index has
no slot for any chunk of the dataset; offsets now returns None.

Tests: chunk_grid::zero_extent_has_no_chunks; edit_interop's
zero_extent_resizes_without_a_recorded_maximum on a file the unfixed
editor left (fixture) and on a 2.7.0-written file taken through zero
extents with `h5rs check --data` and h5dump at every step; test_edit.py
random edits on seeds 10..39 of a clawhdf5-written file.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
osobh
2026-09-27 07:40:11 -05:00
co-authored by Claude Opus 5.5
parent 1f7651644b
commit bdf584abb2
5 changed files with 116 additions and 0 deletions
+7
View File
@@ -445,6 +445,13 @@ def test_random_edits_match_h5py(h5py, tmp_path, source, seed):
h5dump_reads(ours_path, base)
@pytest.mark.parametrize("seed", range(10, 40))
def test_random_edits_on_clawhdf5_files(h5py, tmp_path, seed):
"""More random sequences on a clawhdf5-written file, whose resizes to
zero extents once left files `h5rs check` could not read."""
test_random_edits_match_h5py(h5py, tmp_path, "clawhdf5", seed)
def resized_model(before, shape, fill):
"""`before` resized to `shape` as HDF5 resizes: elements inside both
extents keep their values, the others read as the fill value."""