Add opt-in checkpoint retention policy (TASK-049) - #84
Merged
Conversation
An audit found this stage was scoped ad-hoc -- opened and fully built in one day with its own criteria written the same day as its first task -- and that its Goal's own "scrubbed to any point" clause shipped with no operationalised criterion or mechanism at all. Adds Completion Criteria 6-9 (live scrub, combined solved-velocity + declared-field playback, checkpoint retention, partial-overlap cache reuse), drafts TASK-048/049/050/051 with their settled design decisions ahead of implementation, and sanctions "Status: Not started, drafted <date>" as a valid task-entry status in stage-specification.md now that check_stages.py's own TASK_DONE marker already handles it correctly. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…uses check_stages.py's lifecycle computation greps each task for an inline **Status: Done** marker, which Stage 0's tasks never carried -- they predate that convention and only ever recorded completion in the stage's own summary table. That made Stage.lifecycle read "opened" with 0/11 done, silently wrong since Stage 0 closed on 2026-08-19. Fixed by adding the marker to each task entry (dates from the existing summary table; TASK-008 marked Done with no date, since none was ever recorded) rather than special-casing Stage 0 in the checker, so the one general mechanism stays correct for every stage. Regression test added and confirmed red before the fix. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Closes Stage 8's Completion Criterion 8: `RecordingConfig. max_checkpoints_retained` bounds a recording's total on-disk checkpoint count, opt-in and unbounded by default so every existing config and golden demo is unaffected. Frame 0 is never pruned, confirmed by a deliberate mutation observed to fail the regression test before being reverted. Factored the checkpoint-filename parsing `replay.py` used to duplicate into a shared `checkpoint.list_checkpoints` helper, used by both the new pruning logic and `replay.find_checkpoint_at_or_before`. `--max-checkpoints-retained` added to both `pyflow record` and `pyflow resume`, overriding the config field the same way `--checkpoint-interval` already does. Verified by hand against the real CLI, not only the test suite: a 25-frame recording with `--checkpoint-interval 5 --max-checkpoints-retained 2` reports 6 checkpoints written but leaves exactly frame 0 plus the newest two on disk. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This was referenced Sep 9, 2026
This was referenced Sep 9, 2026
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 8 (see #83):
RecordingConfig. max_checkpoints_retainedbounds a recording's total on-disk checkpointcount, opt-in and unbounded by default.
RecordingConfig.max_checkpoints_retained: int | None = None,validated
> 0if set.(removing that exclusion) observed to fail the regression test before
being reverted.
replay.pyused toduplicate into a shared
checkpoint.list_checkpointshelper, used byboth the new pruning logic and
replay.find_checkpoint_at_or_before.--max-checkpoints-retainedon bothpyflow recordandpyflow resume, same override-config shape--checkpoint-intervalalreadyhas.
Stacked on #83 (
docs/reopen-stage-8) -- this branch was cut fromit since it needed that PR's TASK-049 stub entry in
roadmap.md. Thediff below includes #83's commits until that one merges; it will shrink
to just this branch's own two commits once #83 lands.
Test plan
green
confirmed to fail before being reverted
make lintand every relevantmake check-*target cleanmake test-- 1161 passed, 21 skipped, exit 0pyflow record --config examples/golden-demos/heat_diffusion.yaml --max-frames 25 --checkpoint-interval 5 --max-checkpoints-retained 2reports 6 checkpoints written butleaves exactly
{0, 20, 25}on disk;--helpon bothrecordand
resumeshows the new flag🤖 Generated with Claude Code