Skip to content

fix(stack): harden merge cleanup and stranded repair#31

Closed
aryasaatvik wants to merge 2 commits into
kitlangton:mainfrom
aryasaatvik:pr/recover-stranded-squash-repair-anchors
Closed

fix(stack): harden merge cleanup and stranded repair#31
aryasaatvik wants to merge 2 commits into
kitlangton:mainfrom
aryasaatvik:pr/recover-stranded-squash-repair-anchors

Conversation

@aryasaatvik

@aryasaatvik aryasaatvik commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Summary

Fix two stack merge repair failure modes: landed branches checked out in clean sibling worktrees are released before cleanup, and stranded squash-merge descendants can recover their persisted replay anchor.

Changes

  • Add Git.release(branch) cleanup and dirty-owner preflight for checked-out landed branches.
  • Use persisted backup/landed-* anchors when repairing already trunk-parented descendants.
  • Cover both flows with focused regression tests.

Tests

  • bun run test
  • bun run typecheck
  • bun run format:check
  • bun run lint
  • bun run package:smoke

Detach clean sibling worktrees that own a just-landed branch before deleting the local branch during stack merge cleanup.

Dirty target owners now fail before hosted merge, matching descendant repair preflight behavior.
Use persisted child anchors that still match landed backup refs as replay boundaries after a partial squash-merge repair.

This keeps later sync repairs from replaying already-squashed parent commits when the child has already been reparented to trunk.
@aryasaatvik aryasaatvik force-pushed the pr/recover-stranded-squash-repair-anchors branch from 63c9643 to aec1e21 Compare June 30, 2026 18:58
@aryasaatvik aryasaatvik changed the title fix(stack): recover stranded squash repair anchors fix(stack): harden merge cleanup and stranded repair Jun 30, 2026
@kitlangton

Copy link
Copy Markdown
Owner

Merged directly to main (rebased cleanly after #30 landed). Authorship preserved. Thanks @aryasaatvik!

kitlangton pushed a commit that referenced this pull request Jun 30, 2026
If stack merge persists the landed state but aborts before descendant
repair, a later stack sync --apply can lose the correct replay boundary.
In squash-merge repos, the child then replays both the already-squashed
parent commits and its own, producing avoidable conflicts.

Use the persisted branch anchor as a fallback replay boundary when the
child is already parented to trunk and the stored anchor matches a
backup/landed-* head, so stranded descendants replay only their own
commits.
@kitlangton kitlangton closed this Jun 30, 2026
kitlangton added a commit that referenced this pull request Jun 30, 2026
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.

2 participants