Skip to content

fix(#1069): merge origin/main into pushed branches instead of rebasing before PR - #1120

Merged
admarble merged 3 commits into
mainfrom
feature/1069-bug-qa-the-qa-phase-rebases-an-already-pushed-bran
Sep 20, 2026
Merged

admarble merged 3 commits into
mainfrom
feature/1069-bug-qa-the-qa-phase-rebases-an-already-pushed-bran

Conversation

@admarble

@admarble admarble commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • rebaseBeforePR now merges origin/main when the branch is already pushed (upstream exists and is not the base ref), so no pushed SHA is rewritten; unpushed branches still rebase.
  • A fresh worktree add -b … origin/main branch tracks origin/main by default, so a bare @{u} check would have merged every first run; the probe excludes the base ref (spec AC-5).
  • Merge conflicts run merge --abort and leave HEAD untouched (spec AC-6). The printed line is merged origin/main or rebased onto origin/main.
  • Lockfile-reinstall diff uses the captured pre-op HEAD, since a merge does not reliably set ORIG_HEAD.
  • Positional spawnSync mocks in src/commands/run.test.ts updated for the added probe calls. batch-executor.ts needed no change (call site unchanged).

Acceptance criteria

  • AC-1: pushed branch merges, pushed SHAs unchanged — src/lib/workflow/worktree-manager.test.ts case pushed branch merges and keeps SHAs
  • AC-2: no upstream still rebases — case no upstream rebases, plus fresh worktree branch tracking origin/main still rebases
  • AC-3: printed line says merge vs rebase — case reports merge vs rebase
  • AC-4: npm run build and npm run lint pass locally; full npm test is left to the runner per the launch rules. Ran worktree-manager.test.ts and run.test.ts: 148 passed.

Test plan

  • npx vitest run src/lib/workflow/worktree-manager.test.ts -t 1069 (5 passed, real git, no mocks)
  • npm run build, npm run lint

Mutation-verified: AC-1 — forced pushed = false (unconditional rebase); pushed branch merges and keeps SHAs failed; restored.

Closes #1069

🤖 Generated with Claude Code

Runner verification (guard-2026-09 wave 2, 2026-09-20)

  • qa: AC_NOT_MET twice (real: the new real-git cases had no git identity, green on macOS via GECOS and red on the Linux runner; the second round caught that the config sat one statement after the first commit), then AC_MET_BUT_NOT_A_PLUS on 4f3328dc.
  • Runner fixes: identity configured right after git clone (4f3328dc); a merge that fails after staging is aborted so createPR never sees MERGE_HEAD (fb95d910). A widening of push detection to origin/<branch> was tried and reverted: AC-1/AC-2 are literal about @{u}, the exec skill pushes with -u, and the mocked run.test.ts cases assume the @{u} call shape.
  • Runner ran worktree-manager.test.ts + run.test.ts (148 passed) and the five bug(qa): the qa phase rebases an already-pushed branch onto main, forcing a force-push to land it #1069 cases under an identity-less git (user.useConfigOnly, 5 passed); both markers classifier-valid; no batch-executor.ts change was needed.
  • Full npm test from a clean shell on 4f3328dc: 330 files, 6620 passed, 3 expected fail, 3 skipped, 349 s. CI green on the same head.

@admarble
admarble merged commit 6752923 into main Sep 20, 2026
6 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.

bug(qa): the qa phase rebases an already-pushed branch onto main, forcing a force-push to land it

1 participant