Reuse a full-subset cache hit for pyflow play (TASK-050) - #85
Closed
AdamClemens wants to merge 1 commit into
Closed
Conversation
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>
5 tasks
6 tasks
Owner
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes Stage 8's Completion Criterion 9 (see #83, #84): a
pyflow play --cache DIRrequest that falls fully inside an already-cached widerwindow is sliced from it directly, at zero re-simulation cost.
_find_superset_window(src/pyflow/replay.py) ranks candidates bythe range in the filename first, the same cheap-before-I/O shape
find_checkpoint_at_or_beforealready uses, then slices the framesneeded straight out of the matching window.
exact-range request still writes one, unchanged from before this.
past its edge, still falls back to full
materialize_window-- areal, 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 stackedon #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
green
before being reverted
make lintand every relevantmake check-*target cleanmake test-- 1164 passed, 21 skipped, exit 0pyflow play --from-frame 0 --to-frame 20 --cache DIR, deleting everycheckpoint, then
pyflow play --from-frame 5 --to-frame 10 --cache DIRstill exits 0 with no new cache file written for thenarrower range
🤖 Generated with Claude Code