From 3ed898051945966167bf33bce586b3d59f7e8f50 Mon Sep 17 00:00:00 2001 From: Tom Boucher Date: Thu, 30 Apr 2026 22:18:34 -0400 Subject: [PATCH] fix(#2916): drop unreachable post-creation merge-base guard CodeRabbit pointed out the post-creation guard is structurally unreachable: immediately after `git checkout -b X origin/$DEFAULT_BRANCH`, HEAD == origin/$DEFAULT_BRANCH, so both the merge-base form (`MB == DT`) and the alternative "ahead-of" count form (`AHEAD == 0`) are sentinels that always pass on a successful fresh checkout. With the explicit base arg + fail-fast on the checkout, the guard cannot catch anything new. Removing it (rather than swapping in another no-op that satisfies the linter but adds no actual coverage) is the honest fix. Comment retained to explain why no post-creation guard is needed: the explicit base argument to `git checkout -b` is the single source of correctness for #2916. Same simplification mirrored in get-shit-done/workflows/quick.md. Full suite: 6102/6102. --- get-shit-done/workflows/execute-phase.md | 8 +++----- get-shit-done/workflows/quick.md | 11 ++++------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/get-shit-done/workflows/execute-phase.md b/get-shit-done/workflows/execute-phase.md index 86d243c6a..b50ea11f2 100644 --- a/get-shit-done/workflows/execute-phase.md +++ b/get-shit-done/workflows/execute-phase.md @@ -238,13 +238,11 @@ else else git switch --quiet "$DEFAULT_BRANCH" 2>/dev/null && git merge --ff-only --quiet "origin/$DEFAULT_BRANCH" 2>/dev/null || true fi + # Pinned base + fail-fast: on success HEAD is exactly at origin/$DEFAULT_BRANCH, + # so a post-creation merge-base or "ahead-of" guard would be unreachable. The + # explicit base argument here is the single source of correctness for #2916. git checkout -b "$BRANCH_NAME" "origin/$DEFAULT_BRANCH" \ || { echo "ERROR: Could not create '$BRANCH_NAME' from origin/$DEFAULT_BRANCH (#2916)." >&2; exit 1; } - # Warn only on fresh creation when HEAD did NOT fork from origin/$DEFAULT_BRANCH — #2916. - # Skipped on resume because origin may have advanced legitimately since first creation. - if MB=$(git merge-base HEAD "origin/${DEFAULT_BRANCH}" 2>/dev/null) && DT=$(git rev-parse --verify --quiet "refs/remotes/origin/${DEFAULT_BRANCH}" 2>/dev/null) && [ "$MB" != "$DT" ]; then - echo "WARNING: Phase branch '$BRANCH_NAME' does not fork from origin/${DEFAULT_BRANCH}; verify the base is intentional." - fi fi ``` diff --git a/get-shit-done/workflows/quick.md b/get-shit-done/workflows/quick.md index c7cf6f265..936578346 100644 --- a/get-shit-done/workflows/quick.md +++ b/get-shit-done/workflows/quick.md @@ -218,16 +218,13 @@ else || true fi - # Always pin the new branch to origin/$DEFAULT_BRANCH so the start point is + # Pin the new branch to origin/$DEFAULT_BRANCH so the start point is # deterministic regardless of which branch we are currently on (#2916). + # On success HEAD is exactly at origin/$DEFAULT_BRANCH, so a post-creation + # merge-base / "ahead-of" guard would be unreachable — the explicit base + # argument here is the single source of correctness for #2916. git checkout -b "$branch_name" "origin/$DEFAULT_BRANCH" \ || { echo "ERROR: Could not create '$branch_name' from origin/$DEFAULT_BRANCH (#2916)." >&2; exit 1; } - - # Warn only on fresh creation when HEAD did NOT fork from origin/$DEFAULT_BRANCH — #2916. - # Skipped on resume because origin may have advanced legitimately since first creation. - if MB=$(git merge-base HEAD "origin/${DEFAULT_BRANCH}" 2>/dev/null) && DT=$(git rev-parse --verify --quiet "refs/remotes/origin/${DEFAULT_BRANCH}" 2>/dev/null) && [ "$MB" != "$DT" ]; then - echo "WARNING: Quick-task branch '$branch_name' does not fork from origin/${DEFAULT_BRANCH}; verify the base is intentional before continuing." - fi fi ```