Skip to content

test: assert the per-branch restack checkpoint survives a midway conflict#92

Merged
andyrewlee merged 1 commit into
mainfrom
test/restack-save-checkpoint
Jun 21, 2026
Merged

test: assert the per-branch restack checkpoint survives a midway conflict#92
andyrewlee merged 1 commit into
mainfrom
test/restack-save-checkpoint

Conversation

@andyrewlee

Copy link
Copy Markdown
Owner

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 → c with the trunk advanced (so all are out of date) and c set to conflict. It records every env.Save checkpoint and asserts the most recent one already has a and b rebased onto their parents' new tips — i.e. they were persisted before c stalled the cascade.

Mutation-checked while writing: neutralising RestackBranch's env.save() makes the test fail (restack persisted nothing before the conflict), so it genuinely guards the behaviour.

Test-only change. make ci green — coverage 86.4%.

…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.
@andyrewlee andyrewlee merged commit 0a76742 into main Jun 21, 2026
4 checks passed
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