Skip to content

Fix upstream-dev CI job: zarr test overrides, stateful testing, upstream GHA#2294

Merged
li-em merged 10 commits into
mainfrom
li-em/2026-07-upstream
Jul 24, 2026
Merged

Fix upstream-dev CI job: zarr test overrides, stateful testing, upstream GHA#2294
li-em merged 10 commits into
mainfrom
li-em/2026-07-upstream

Conversation

@li-em

@li-em li-em commented Jul 24, 2026

Copy link
Copy Markdown
Member

Couple of different problems detected in #1921 fixed on this PR:

stateful testing fixes

  • test_zarr/test_stateful.py: use the storage-key chunk grid in shift_array. The rule used cdata_shape, which counts inner chunks for sharded arrays, while store keys and Session.shift_array operate on the outer (shard) grid. zarr main's hypothesis strategies now generate sharded arrays, exposing this: the model shuffled keys over a grid that doesn't exist (e.g. producing 0/c/1 for a single-shard array). A new storage_chunk_sizes helper uses zarr's write_chunk_sizes when available and derives the grid from shards or chunks on older zarr. Includes deterministic regression tests, verified against both zarr 3.1.6 and zarr nightly.

  • test_stateful_repo_ops.py: match the model's GC re-parenting to Rust. The model re-parented kept snapshots whose parent was GC'd to the initial snapshot, but delete_snapshots_from_repo_info re-parents over the deleted run to the nearest surviving ancestor. After a reset_branch back onto such a snapshot, model and repo disagreed on reachability, and the next garbage_collect predicted the wrong snapshots_deleted count. Triggered only when a GC deletes a middle run while older (ref-pointed) and newer (flushed_at-protected) snapshots both survive — hence the intermittent nightly appearances.

  • test_stateful_repo_ops.py: guard create_branch/create_tag against V1 expired-ancestor chains. V1 expiration rewrites only ref-reachable chains, so an unreachable commit's on-disk ancestry can still pass through expired snapshots the model dropped; creating a ref there resurrects history the model no longer tracks and fails check_ancestry. Applies the same full-ancestry assume() that reset_branch already uses.

@li-em
li-em requested a review from ianhi July 24, 2026 14:18
@li-em
li-em force-pushed the li-em/2026-07-upstream branch from 8c62e31 to 1646c4f Compare July 24, 2026 14:18
@codecov-commenter

codecov-commenter commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 84.70%. Comparing base (718963d) to head (d2bf926).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2294   +/-   ##
=======================================
  Coverage   84.70%   84.70%           
=======================================
  Files          88       88           
  Lines       38995    38995           
=======================================
  Hits        33030    33030           
  Misses       5965     5965           
Flag Coverage Δ
python 90.06% <ø> (ø)
rust 84.10% <ø> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@li-em
li-em force-pushed the li-em/2026-07-upstream branch from 91c55ae to f81fdae Compare July 24, 2026 15:21
li-em added 8 commits July 24, 2026 12:53
cdata_shape counts inner chunks for sharded arrays, but store keys and
Session.shift_array operate on the outer (shard) grid. zarr main's
strategies now generate sharded arrays, so the mismatched granularity
made the model shuffle keys over a grid that doesn't exist
(nightly upstream-dev failure in #1921).
V1 expiration rewrites only ref-reachable chains, so an unreachable
commit's on-disk ancestry can still pass through expired snapshots the
model dropped. Creating a ref there resurrects history the model no
longer tracks, failing check_ancestry. Apply the same full-ancestry
assume() that reset_branch already uses.
The model re-parented kept snapshots whose parent was GC'd to the
initial snapshot, but delete_snapshots_from_repo_info re-parents over
the deleted run to the nearest surviving ancestor. After reset_branch
onto such a snapshot the two disagreed on reachability, so the next
garbage_collect predicted the wrong snapshots_deleted count
(nightly upstream-dev failure in #1921).
Cover storage_chunk_sizes on sharded and plain arrays, and a
deterministic model-vs-store shift of a sharded array mirroring the
shift_array stateful rule.
@li-em
li-em force-pushed the li-em/2026-07-upstream branch from 7c98bee to f5edf95 Compare July 24, 2026 15:53
@li-em
li-em force-pushed the li-em/2026-07-upstream branch from f5edf95 to a249452 Compare July 24, 2026 16:12

@ianhi ianhi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

little headspinning to thnk about GC once more - but all seems correct to me!

# covers resetting to a commit whose ancestry *reaches* an expired-but-
# on-disk snapshot: the real ancestry resurrects it while the model has
# popped it, so skip unless the whole chain is still modelled.
# but modelling that divergence isn't worthwhile — just skip.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

is this comment no longer true?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

it got moved to the _v1_chain_fully_modelled docstring

Comment on lines +48 to +49
if hasattr(arr, "write_chunk_sizes"):
return arr.write_chunk_sizes # type: ignore[no-any-return]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Can we leave a comment about why we are usign write (outer) instead of read (inner) chunk sizes. I got pretty tripped up by this at first

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Expanded the docstring, it is indeed confusing 😵

Comment thread icechunk-python/tests/test_zarr/test_stateful.py Outdated
@li-em
li-em enabled auto-merge July 24, 2026 20:08
@li-em
li-em added this pull request to the merge queue Jul 24, 2026
Merged via the queue into main with commit ae75773 Jul 24, 2026
33 of 36 checks passed
@li-em
li-em deleted the li-em/2026-07-upstream branch July 24, 2026 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants