fix: prune start checkpoint on eviction#8
Merged
Conversation
A checkpoint taken at position 0 anchors to the START sentinel, which pruneCheckpoints skipped unconditionally — so limit eviction left it alive even though the state it named was no longer reachable, and revertTo silently landed on a different state instead of throwing. Prune START-anchored checkpoints whenever entries are evicted from the front. A dropped redo branch still leaves them intact: position 0 remains reachable there. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
pruneCheckpoints takes a plain readonly Anchor[] instead of a ReadonlySet: the redo-drop call site returns to its original shape, the eviction site is one spread, and the types check by ordinary array covariance rather than method bivariance. Reword the pruning docs to state the real rule — pruning is by anchor identity, not state reachability, which differ for a checkpoint anchored to the newest evicted entry — and note in revertTo the invariant that keeps indexOf from returning -1. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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 by cubic
Fixes incorrect handling of position-0 checkpoints during eviction. Eviction now prunes
START-anchored checkpoints sorevertTocan’t land on an unreachable state; redo-branch drops still keep them.Bug Fixes
STARTwhen front eviction occurs;revertToon a pruned name throws.Refactors
pruneCheckpointsto acceptreadonly Anchor[]and updated call sites.Written for commit 1f551d6. Summary will update on new commits.