test: assert the per-branch restack checkpoint survives a midway conflict#92
Merged
Conversation
…lict The engine saves after each branch in a restack cascade so that a conflict partway up the stack cannot lose the progress already made (st continue resumes from disk). The onto-reparent save and the per-prune save are tested; the restack cascade — the path CLAUDE.md calls out — was not. Adds a fast fake-git test: restack main -> a -> b -> c with c conflicting, and assert the most recent checkpoint already has a and b rebased onto their parents' new tips. Mutation-checked: removing RestackBranch's env.save() makes it fail.
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.
What
Adds a fast fake-git test closing a coverage gap on the engine's save-checkpoint protocol.
The engine persists after each branch in a restack cascade, so a conflict partway up the stack can't lose the progress already made —
st continue(a fresh process reading from disk) resumes from where it got to. CLAUDE.md calls this out: "checkpoint the state at safe points ... so a later conflict cannot lose progress."That guarantee was tested for the onto reparent (
TestOntoPersistsReparentBeforeRestackingDescendants) and the per-prune save (TestSyncPersistsEachSuccessfulPrune), but not for the restack cascade itself.The test
Restacks
main → a → b → cwith the trunk advanced (so all are out of date) andcset to conflict. It records everyenv.Savecheckpoint and asserts the most recent one already hasaandbrebased onto their parents' new tips — i.e. they were persisted beforecstalled the cascade.Mutation-checked while writing: neutralising
RestackBranch'senv.save()makes the test fail (restack persisted nothing before the conflict), so it genuinely guards the behaviour.Test-only change.
make cigreen — coverage 86.4%.