Skip to content

Commit df18415

Browse files
d-v-bclaude
andauthored
test(stateful): bound how far append grows an axis in the array lifecycle test (#4470)
`append` could add up to 4 rows every step with no upper bound, so over the nightly profile's 100 steps an array with chunks of 1 reached tens of thousands of chunks and each `matches_model` read took seconds. The 500 nightly examples together exceeded pytest's 600s faulthandler_timeout (563s on the last green nightly, killed on 2026-10-03). Cap appended extents at 2 * MAX_SIDE. Assisted-by: ClaudeCode:claude-opus-5-5 Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 500673d commit df18415

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎tests/test_array_stateful.py‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
DTYPE = np.dtype("int16")
5151
METADATA_KEYS = (".zarray", ".zattrs", "zarr.json")
5252
MAX_SIDE = 6
53+
# `append` may grow an axis past `MAX_SIDE`, but not without bound: with chunks of 1,
54+
# the cells an extent of 100 steps could reach make each full-array read take seconds,
55+
# and the nightly run of every example together exceeded pytest's faulthandler_timeout.
56+
MAX_APPEND_EXTENT = 2 * MAX_SIDE
5357

5458

5559
async def _list(store: MemoryStore, prefix: str) -> list[str]:
@@ -210,7 +214,8 @@ def append(self, data: st.DataObject) -> None:
210214
axes = st.sampled_from(self.legacy_axes) | axes
211215
axis = data.draw(axes, label="axis")
212216
block_shape = list(self.shape)
213-
block_shape[axis] = data.draw(st.integers(0, 4), label="rows")
217+
max_rows = min(4, max(0, MAX_APPEND_EXTENT - self.shape[axis]))
218+
block_shape[axis] = data.draw(st.integers(0, max_rows), label="rows")
214219
block = data.draw(npst.arrays(DTYPE, tuple(block_shape)), label="block")
215220
note(f"append {block.shape} along {axis} to {self.shape}")
216221
if self.shape[axis] == 0 and block.shape[axis]:

0 commit comments

Comments
 (0)