Skip to content

Reuse a full-subset cache hit for pyflow play (TASK-050) - #87

Merged
AdamClemens merged 1 commit into
mainfrom
feat/partial-overlap-cache-reuse
Sep 9, 2026
Merged

Reuse a full-subset cache hit for pyflow play (TASK-050)#87
AdamClemens merged 1 commit into
mainfrom
feat/partial-overlap-cache-reuse

Conversation

@AdamClemens

Copy link
Copy Markdown
Owner

Summary

Replaces #85, which GitHub auto-closed (and then refused to reopen)
when its base branch (feat/checkpoint-retention-policy) was deleted
after #84 merged. Same commit (a746e83), same content, now targeting
main directly since #83/#84 are already merged.

Closes Stage 8's Completion Criterion 9: a pyflow play --cache DIR
request that falls fully inside an already-cached wider window is
sliced from it directly, at zero re-simulation cost.

  • _find_superset_window (src/pyflow/replay.py) ranks candidates by
    the range in the filename first, the same cheap-before-I/O shape
    find_checkpoint_at_or_before already uses, then slices the frames
    needed straight out of the matching window.
  • No new cache file is written for the sliced sub-range -- only an
    exact-range request still writes one, unchanged from before this.
  • A request that only partially overlaps a cached range, or extends
    past its edge, still falls back to full materialize_window -- a
    real, stated exclusion (full stitching across a cached window's own
    edge is deferred future work), confirmed by a deliberate mutation
    observed to fail the regression test before being reverted.

Test plan

  • Strict TDD: every new test written first, confirmed red, then
    green
  • Mutation test on the partial-overlap exclusion, confirmed to fail
    before being reverted
  • make lint and every relevant make check-* target clean
  • make test -- 1164 passed, 21 skipped, exit 0
  • Verified by hand against the real CLI: caching pyflow play --from-frame 0 --to-frame 20 --cache DIR, deleting every
    checkpoint, then pyflow play --from-frame 5 --to-frame 10 --cache DIR still exits 0 with no new cache file written for the
    narrower range
  • Already passed CI green on both platforms as Reuse a full-subset cache hit for pyflow play (TASK-050) #85 (unchanged
    commit)

🤖 Generated with Claude Code

Closes Stage 8's Completion Criterion 9: a `pyflow play --cache DIR`
request that falls fully inside an already-cached wider window is
sliced from it directly, at zero re-simulation cost, narrowing
TASK-046's own exact-range-only scope for the one case with a concrete,
avoidable cost.

`_find_superset_window` ranks candidates by the range in the filename
first (the same cheap-before-I/O shape `find_checkpoint_at_or_before`
already uses), then slices the frames needed straight out of the
matching window -- no new cache file is written for the sliced
sub-range. A request that only partially overlaps a cached range, or
extends past its edge, still falls back to full `materialize_window`;
confirmed to have real teeth by a deliberate mutation weakening that
check to an overlap-only one, observed to fail the regression test
before being reverted.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@AdamClemens
AdamClemens merged commit 2f6ed71 into main Sep 9, 2026
4 checks passed
@AdamClemens
AdamClemens deleted the feat/partial-overlap-cache-reuse branch September 9, 2026 15:32
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