Skip to content

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

Closed
AdamClemens wants to merge 1 commit into
feat/checkpoint-retention-policyfrom
feat/partial-overlap-cache-reuse
Closed

Reuse a full-subset cache hit for pyflow play (TASK-050)#85
AdamClemens wants to merge 1 commit into
feat/checkpoint-retention-policyfrom
feat/partial-overlap-cache-reuse

Conversation

@AdamClemens

Copy link
Copy Markdown
Owner

Summary

Closes Stage 8's Completion Criterion 9 (see #83, #84): 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.

Stacked on #84 (feat/checkpoint-retention-policy, itself stacked
on #83) -- base set to that branch since this one was cut from it. The
diff will shrink to just this branch's own commit once the earlier two
merge.

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

🤖 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

Copy link
Copy Markdown
Owner Author

Superseded by #87 -- GitHub auto-closed this PR when its base branch (feat/checkpoint-retention-policy) was deleted after #84 merged, and refused to reopen it since the base ref no longer exists. Same commit, now targeting main directly.

@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