Skip to content

v1.94.3.0 fix(ship-preflight): stop when origin's default branch can't be read (#3718 follow-up) - #3913

Merged
capy-ai[bot] merged 4 commits into
mainfrom
capy/ship-preflight-lsremote-stop
Nov 3, 2026
Merged

capy-ai[bot] merged 4 commits into
mainfrom
capy/ship-preflight-lsremote-stop

Conversation

@garrytan

@garrytan garrytan commented Nov 3, 2026 •

Copy link
Copy Markdown
Owner
{
  "schema_version": 1,
  "pr": 3913,
  "head": "ef4d28d251450c8cb3ca747612952ecb3626af06",
  "version": "1.93.34.0",
  "base": "main",
  "session_kind": "unattended",
  "thread": "jam_01M68A3Q3474STK2VM8MSCTFGE",
  "head_tree": "9c4e08530987d2c06f9d967deec9382ec4c4999c",
  "product_patch_id": "94df7727bae17648aab323290b6dea6829f3267b",
  "gstack_version": "1.93.37.0",
  "review_depth": {
    "depth": "light",
    "class": "code",
    "runtime_lines": 9,
    "rules": "b2272efd321ce7cb",
    "base": "54606c525c254fb2925c99f388c203884b827832",
    "registry": "54606c525c254fb2925c99f388c203884b827832",
    "gate_scan": {
      "tagged": 0,
      "head": "ef4d28d251450c8cb3ca747612952ecb3626af06"
    },
    "reasons": [
      "runtime=9"
    ],
    "risk": []
  },
  "pregate": "requires-remote cleared @9c4e08530987 (1 checks, current for ef4d28d25145)",
  "requires_remote": [
    "pregate.json/remote_gate: remote-gate tree=9c4e08530987 tests=412"
  ],
  "issues": {
    "fixes": [],
    "refs": [
      3718
    ],
    "flakes": []
  },
  "docs": {
    "status": "updated",
    "scope": "docs/eval-calls.md, docs/eval-models.md, changelog.d/capy-ship-preflight-lsremote-stop.md"
  },
  "review_loop": {
    "passes": 1,
    "blocking_found": 2,
    "deferred": 0,
    "noted": 4,
    "fixed": 2,
    "scope": "frozen",
    "fix_checks": 1
  },
  "review_targeted": {
    "classes": [
      "gate"
    ],
    "rules": "c82addff6fb60fa0",
    "brief_sha": "7f92a0d0a8319c3c0e076fb3b1a4689c45120b2be2c14dfc7d4cb03aafa9d6a5",
    "product_patch_id": "94df7727bae17648aab323290b6dea6829f3267b",
    "status": "done",
    "findings": 1,
    "raised_by": "targeted"
  }
}

Carries the two pieces of #3718 that wave #3852 didn't land. #3718 is closed as superseded.

Captain (GSTA-36): "A. Close #3718 as superseded by #3852, with a short note naming the two pieces you're carrying forward. Then open a fresh PR from main with the ship-preflight "restore access first" stop (failing-first test in test/ship-preflight.test.ts) and the two doc lines. It's a bug fix, so no /autoplan. Run it as R65 says: the printed review plan once on the final head, one fix round. Then send READY to me. The unused grant on #3718 lapses. Nothing else is owed."

What changes

gstack-ship-preflight no longer trusts a local origin/HEAD when origin can't say its default branch (lib/ship-preflight.ts). On main, preflight fell back to the local origin/HEAD whenever git ls-remote --symref origin HEAD failed or named no branch:

  • With no local origin/HEAD, preflight on the default branch merged the given base into it and kept going.
  • In a PR-branch clone whose origin/HEAD names the feature branch, preflight refused that branch as "on the base branch".

Now:

  • A failed ls-remote stops with git ls-remote origin HEAD failed: …; restore access first before anything merges.
  • A remote HEAD that names no branch (a detached HEAD, or a server that sends no symref) falls back to defaultBaseBranch() in lib/default-base.ts, the same order every other base-relative step uses.
  • The default-branch check runs after the fetch, so a failed fetch still reports the fetch.

Docs. docs/eval-calls.md and docs/eval-models.md now describe the default --base the way lib/default-base.ts resolves it: origin/HEAD's branch unless it names the checked-out branch, its upstream or HEAD's commit, then the PR's base, the remote's live HEAD, main or master.

Proof (failing first)

Two new tests in test/ship-preflight.test.ts. In each one, a git wrapper on PATH changes only what ls-remote returns.

  • ls-remote fails while the fetch works. On main this test fails: on the default branch with no local origin/HEAD, --base release exited 0 (Expected: 3, Received: 0). With this PR, both setups stop with the "restore access first" line and print no MERGE:.
  • ls-remote prints only a sha. With c3b3c37's lib/ship-preflight.ts, this test fails (Expected: 3, Received: 0). With this PR, the default branch stops as the base branch and the feature branch goes on.

timeout 300 bun test test/ship-preflight.test.ts: 25 pass, 0 fail at 1ec7fe1. bun run typecheck is clean.

Open notes (informational, not fixed: the one fix round is used)

  • Non-main default with no symref. On a repo whose default branch is neither main nor master (say develop), with a server that sends no HEAD symref, defaultBaseBranch() skips develop because it is the checked-out branch. Preflight on develop with another --base then goes on, where main's local-ref fallback stopped. It needs both conditions together; GitHub always sends the symref.
  • The wrapper tests loop on Capy machines. On a Capy shared-tree machine, Bun.which('git') can resolve to Capy's git guard, which runs the stub again. The two wrapper tests then hit their 60 s timeout there. CI is unaffected.

Refs #3718

garrytan and others added 3 commits November 3, 2026 01:54
… guessing the default branch

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…efault-base order; docs name the whole order

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
…in/HEAD

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
@trunk-io

trunk-io Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

😎 This pull request was merged.

@github-actions github-actions Bot changed the title fix(ship-preflight): stop when origin's default branch can't be read (#3718 follow-up) v1.94.3.0 fix(ship-preflight): stop when origin's default branch can't be read (#3718 follow-up) Nov 3, 2026
@capy-ai
capy-ai Bot merged commit ad51cef into main Nov 3, 2026
45 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