Skip to content

fix(#1406): a non-default bare --base is cut from local <base> but counted against origin/<base> (#1380 follow-up, #1234/#1386 class) - #1479

Merged
admarble merged 3 commits into
mainfrom
feature/1406-fix-worktree-a-non-default-bare-base-is-cut-from-l
Oct 16, 2026
Merged

admarble merged 3 commits into
mainfrom
feature/1406-fix-worktree-a-non-default-bare-base-is-cut-from-l

Conversation

@admarble

@admarble admarble commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

A non-default bare --base (e.g. release) was cut from the local branch but counted as stale against origin/<base>, so a lagging local release produced a worktree that was already behind. computeWorktreeBaseRef now returns origin/<base> when the remote has it, except in chain mode, so creation, staleness (countCommitsBehind) and the recorded sequantBaseRef read one ref. The base is resolved after the fetch, which now runs for every non-chain base (a failed fetch is tolerated, so a local-only base still works). A --stacked predecessor and a base with no origin/<base> stay bare, as before.

Fixes #1406

Acceptance criteria

AC Status Evidence
AC-1 Met worktree-manager.test.ts › "1406 a lagging local base: the worktree is cut from origin/". Mutation recorded below
AC-2 Met "1406 a local-only base is still cut from the local branch"
AC-3 Met "1406 a stacked predecessor that is also on origin stays local", plus the existing #605 tests, which pass in CI's test job on this PR

Runner check: npx vitest run src/lib/workflow/worktree-manager.test.ts on the unmodified branch gives 71/71 passed.

Mutation verification

Mutation-verified: AC-1 — deleted the line in computeWorktreeBaseRef that returns origin/baseBranch when not in chain mode and the remote has it; worktree-manager.test.ts > #1234 ensureWorktree records sequantBaseRef > 1406 a lagging local base: the worktree is cut from origin/<base> failed (1 failed, 70 passed); restored.

QA verdict: AC_MET_BUT_NOT_A_PLUS. The only gap was the missing mutation record, now added above by the runner.


🤖 Generated by sequant run; body rewritten by the graph runner.

creation, recreate and the recorded base now share one ref

Entire-Checkpoint: bee26b292e0a
Entire-Checkpoint: babd04a25b75
@admarble
admarble merged commit 91fb052 into main Oct 16, 2026
8 checks passed
@admarble
admarble deleted the feature/1406-fix-worktree-a-non-default-bare-base-is-cut-from-l branch October 16, 2026 23:11
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.

fix(worktree): a non-default bare --base is cut from local <base> but counted against origin/<base> (#1380 follow-up, #1234/#1386 class)

1 participant