The merge queue checks a pull request against the branch it targets, not the default branch (GST-3445) (#4663)

`gstack-ship-queue ready` now checks a pull request against the branch
it targets, so a PR into a branch other than main is no longer refused
when its /ship review was done against that branch.

Why: Founderstar #1024 targets `garrytan/v0.2-plan-wip`, and ready
refused its correct /ship review record because it compared that record
against main.

Nothing to do: until this lands, passing `--base ` to ready works around
it.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
Review-Finding: p1/specialist-batched#1 reader=specialist-batched
Review-Finding: p1/specialist-batched#2 reader=specialist-batched
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-22 09:46:02 +00:00
1 parent 465d911d9c
commit 7df6466b99
7 files changed
+146 -6

No files matched your search

+10 -3
View File
@@ -22,7 +22,7 @@
* gstack-ship-queue train build|status|verdict|bisect|rebuild|watch|prune ... (merge trains; train --help)
* gstack-ship-queue wave plan|build|status|settle ... (wave PRs: 3-6 same-area PRs in one train slot; wave --help)
*
* Every subcommand takes --base <branch> (default lib/default-base.ts) and
* Every subcommand takes --base <branch> (default: ready's --pr PR base, else lib/default-base.ts) and
* ends with GSTACK_RESULT: skill=ship-queue status=complete|refused run=<path>.
* gstack-restamp stays the primitive. Nothing here pushes, except land, ready
* under changelog_fragments (its READY receipt note), and under a
@@ -92,7 +92,7 @@ const HELP = `gstack-ship-queue — the shared merge queue's protocol steps (doc
wave plan|build|status|settle ... wave PRs under a train policy: 3-6 same-area PRs in one slot and one version
(wave --help; docs/ship-policy.md#wave-prs)
--base <branch>: base branch (default: origin/HEAD unless it names the checked-out branch, else the PR's base, origin/main). Nothing here pushes, except land (the stamp commit and the
--base <branch>: base branch (default: for ready, the base of the PR --pr names; otherwise origin/HEAD unless it names the checked-out branch, else the PR's base, origin/main; ready refuses a --base that is not its PR's base). Nothing here pushes, except land (the stamp commit and the
refs/notes/gstack-land lock), ready under changelog_fragments (its READY receipt note) and merge trains.
${exitTableHelp()}`;
@@ -201,8 +201,14 @@ async function main(argv: string[]): Promise<number> {
if (probe.status !== 0) return usage('not inside a git repository');
const repoRoot = probe.stdout.trim();
const gh = (a: string[]) => { const r = ghSpawnSync(a, { cwd: repoRoot, encoding: 'utf8', timeout: 60_000 }); return { ok: r.status === 0, out: r.stdout ?? '', err: r.stderr ?? (r.error ? String(r.error.message) : '') }; };
const ctx: QueueContext = { repoRoot, base: resolveBaseBranch(repoRoot, flag(args, '--base')), gh };
const pr = flag(args, '--pr');
const explicitBase = flag(args, '--base');
let prBase: string | undefined;
if (pr && /^\d+$/.test(pr) && cmd === 'ready') {
const view = gh(['pr', 'view', pr, '--json', 'baseRefName']);
try { prBase = view.ok ? JSON.parse(view.out).baseRefName || undefined : undefined; } catch {}
}
const ctx: QueueContext = { repoRoot, base: resolveBaseBranch(repoRoot, explicitBase ?? prBase), gh };
if (cmd === 'gate-ahead') return gateAhead(ctx, args);
if (cmd === 'train') {
const train = await import('../crew/lib/ship-queue-train-cli');
@@ -234,6 +240,7 @@ async function main(argv: string[]): Promise<number> {
if (gateExit !== undefined && !/^-?\d+$/.test(gateExit)) return usage('--gate-exit needs an exit code');
const gate = { gateExit: gateExit === undefined ? undefined : Number(gateExit), gateLog: flag(args, '--gate-log') };
if (cmd === 'ready') {
if (explicitBase && prBase && prBase !== ctx.base) return finish('ready', { ok: false, lines: [], run: 'none', failure: { code: 'QUEUE_NOT_READY', message: `#${pr} targets ${prBase}, not ${ctx.base}, so a receipt reviewed against ${ctx.base} does not cover it`, fix: `rerun ready without --base, or with --base ${prBase}` } });
const unfetched = refreshBase(ctx);
const loaded = loadBasePolicy(ctx);
if (!('message' in loaded) && loaded.policy.train) return (await import('../crew/lib/ship-queue-train-cli')).readyMain(ctx, args, { pr, pregate: flag(args, '--pregate'), trail: flag(args, '--trail'), ...gate });