Work on Linear issue ABA-300: <issue identifier="ABA-300"> <title>Spike: prove the…
- User
Work on Linear issue ABA-300:
What
Drive the full Graphite (
gt) + GitHub (gh) PR-stacking sequence by hand against one real repo with two stacked branches, and write down the exact commands that work in this environment.Why
drain-cyclehas never touched Graphite or GitHub — nogt,gh, or PR code exists today. Before we wire the orchestrator to Graphite (Ticket 2), we need to know, not guess: whethergtruns from a linked git worktree, where a PR body comes from, and how a label gets applied. Building orchestration on unverified commands is the expensive way to discover they don't work here.How (mechanical)
Known-good mechanics from a prior manual run — reuse these, don't rediscover:
gtneedsgt auth(browser flow, one-time) andgt init --trunk mainper repo. Auth failure aborts submit before any push.- Adopt existing branches (don't recreate):
gt checkout <branch>thengt track --parent <parent>. Parent =mainfor the stack base; the previous branch for each step up. gt submit --no-interactivecreates draft PRs; add--publishfor ready-for-review.gt abortrefuses in non-interactive mode — usegit rebase --abort.- A branch forked off an older
mainshows "needs restack";gt restackrebases it. A semantic conflict is a stop-the-line — abort and surface, never auto-merge.
Steps:
- In a repo with
gt init --trunk mainand validgt auth, create branch A offmainand branch B off A, each with one commit. - From a linked worktree, run
gt track --parent main(A) andgt track --parent A(B). gt submit --no-interactive --publish; capture each PR number + URL (gh pr view --json number,urlorgtoutput).- Create the label if absent (
gh label create review:high), then apply it (gh pr edit <n> --add-label review:high). - Set a PR body — try the commit-message-derived body first, then
gh pr edit <n> --body-file <f>as the fallback.
Acceptance criteria
Assistant· claude-opus-4-8
I'll start by orienting myself — this spike requires driving real
gt/ghcommands against a real repo, so I need to know the current state before doing anything irreversible (like creating PRs).Assistant· claude-opus-4-8
gt1.8.6 andgh2.93.0 are installed,ghis authed asababushkin. drain-cycle is at/Users/anton/src/drain-cycle. Now let me inspect the drain-cycle repo state — this is where the spike must run.Assistant· claude-opus-4-8
drain-cycle already has
gt initdone (trunk: main) and showsgraphite-base/2,3,4remote branches — evidence of a prior stack. Let me checkgt auth, existing PRs, and what's already on GitHub.Assistant· claude-opus-4-8
Found the lay of the land. drain-cycle has
gt initdone,ghauthed, and 4 prior PRs (all basemain— not stacked). Noreview:highlabel exists.timeoutisn't available on this zsh. Let me verifygtauth non-interactively and look at repo structure to pick a harmless demo location.Assistant· claude-opus-4-8
gt lsworks. There's already a.worktrees/dir (the orchestrator's worktree pattern). Let me locate the gt auth token and check the worktrees dir.Assistant· claude-opus-4-8
Everything's in place:
gtis authed (token present in~/.config/graphite/auth),gt initis done,ghis authed. The gating precondition (gt auth+gt init) is already satisfied, so I won't hit the stop-the-line auth-failure path — but I'll record it as a precondition.Here's my plan, and the key assumptions I'm making — correct me if any are wrong, otherwise I'll proceed:
ASSUMPTIONS:
- The spike runs against
/Users/anton/src/drain-cycle(the repo named in the issue label), creating 2 real stacked PRs there — this is acceptance criterion #2, so it's the intended deliverable. - The two demo branches carry a harmless, self-documenting commit (
docs/spike-aba-300.md) — B builds on A so the stack is genuine. - To faithfully test finding (a), I'll use two linked worktrees under
.worktrees/(the orchestrator's actual one-worktree-per-issue pattern) and rungt track/gt submitfrom inside them.
- The spike runs against
Assistant· claude-opus-4-8
Finding (a) — first confirmation:
gt trackworks from a linked worktree. Now worktree B off A's tip, commit B (deliberately without a structured body, so I can test thegh pr edit --body-filefallback path for finding c), and track it onto A.Assistant· claude-opus-4-8
Stack assembled correctly:
gt lsshowsspike/aba-300-step-b→spike/aba-300-step-a→main, and even annotates which worktree each branch lives in. Now the real test —gt submit --stack --no-interactive --publishfrom worktree B:Assistant· claude-opus-4-8
Finding (a) fully confirmed —
gt submitworks from a linked worktree. PRs #5 (step A) and #6 (step B) created. Now let me verify the base order, draft state, and — critically for finding (c) — whethergtderived the PR body from the commit message body:Assistant· claude-opus-4-8
Finding (c) — empirically answered. PR #5's body is the commit-message body verbatim (
## What / ## Why / ## What to review); PR #6's body is empty because commit B had only a subject, no body. So:gtderives the PR body from the commit message body (text after the subject); no body → empty PR, requiring thegh pr edit --body-filefallback. Base order is correct (#5→main, #6→spike/aba-300-step-a) and both are published (not draft).Now I'll demonstrate the fallback on #6, and create + apply the
review:highlabel:Assistant· claude-opus-4-8
Now let me verify the complete end state against all of acceptance criterion #2:
Assistant· claude-opus-4-8
Acceptance criterion #2 — fully met:
- PR #5 base=
main, PR #6 base=spike/aba-300-step-a→ correct parent order ✓ - PR #5 carries
review:high✓ - Both bodies have all 3
## What/Why/What to reviewsections ✓ - Both published (not draft) ✓
Now the written decision. Let me check whether
docs/design-decisions.mdand therules/graphite-stack-review.mdrunbook exist so I can write the decision and reconcile §4.- PR #5 base=
Assistant· claude-opus-4-8
docs/design-decisions.mdexists in drain-cycle, but thegraphite-stack-review.mdrunbook isn't here — ABA-305 landed it in the "workflow pack," which may be a different repo. Let me locate it.Assistant· claude-opus-4-8
The runbook history is in workflow-hooks (the "workflow pack"), not drain-cycle. Let me find where
graphite-stack-review.mdactually lives — it may be on an unmerged branch.Assistant· claude-opus-4-8
The runbook lives on the
ABA-305branch (not merged to main), and there's already a commitacf011a fix(runbook): make restack conflict a stop-the-line in §4— that's reconciliation point #4 from the issue comment, done ahead of the spike as the comment said it could be. Let me read the runbook's current state on that branch and the reconciliation TODOs (points 1–3, which genuinely need this spike's findings).Assistant· claude-opus-4-8
Now I have the full reconciliation picture. The runbook on
ABA-305already has §4 fixed to stop-the-line (point 4, done ahead of the spike as the comment predicted). Remaining, needing this spike's empirical findings:- Point 1 (cwd/worktree) + Point 3 (auth/
gt initpreconditions) → the runbook has no preconditions block at all → add one. - Point 2 (
gt submitflags) → §5 uses baregt submit --stack→ add--no-interactive(+--publish).
Let me look at the existing
docs/design-decisions.mdformat so my decision entry matches it.- Point 1 (cwd/worktree) + Point 3 (auth/
Assistant· claude-opus-4-8
The format is numbered decisions with Alternative considered / Why sections; there are 15, and the intro says "Fifteen decisions are recorded." I'll add #16 for this spike and bump the count. Let me read the tail to append cleanly.
Assistant· claude-opus-4-8
Now I'll write the decision as #16 in drain-cycle's
docs/design-decisions.md, recording all four findings, the exact command sequence, the restack policy, and the PR proof.Assistant· claude-opus-4-8
Decision #16 recorded. Now reconcile the runbook on the
ABA-305branch — points 1–3 (point 4 already done). Let me switch workflow-hooks to that branch cleanly (it was clean at session start).Assistant· claude-opus-4-8
On ABA-305 now. Let me read the runbook on disk and apply points 1–3: add a Preconditions block (cwd + auth/
gt init) and fix §5 flags.Assistant· claude-opus-4-8
Both runbook edits applied. Let me check the version-bump convention (the §4 fix commit) before committing the reconciliation.
Assistant· claude-opus-4-8
The §4 fix didn't bump; the runbook's initial add (0.1.3) did. This reconciliation adds a new §0 section, so a patch bump to 0.1.4 marks the runbook reaching its reconciled state. Let me bump and commit on ABA-305.
Assistant· claude-opus-4-8
.claude-plugin/plugin.jsonis gitignored and not tracked, so the version bump didn't commit — only the runbook change landed in004029e. Let me check the real tracking state so I don't leave the tree weird.Assistant· claude-opus-4-8
Now it's clear:
.claude-plugin/plugin.jsonis tracked (the "ignored" hint referred to the directory pattern, but the already-tracked file committed fine). Commit004029eon ABA-305 includes both the runbook §0+§5 changes and the 0.1.4 bump. main is clean and untouched.Now commit the decision doc in drain-cycle (AC#1 deliverable). drain-cycle lands docs directly on main (per its history, e.g.
2e0d4cd docs: …), so I'll follow that convention, committing only my doc edit (leaving the unrelated untracked files alone):Assistant· claude-opus-4-8
Doc committed (
093c83d), spike worktrees removed, local branches + remote PRs persist as proof. Final step: post the decision + reconciliation summary to Linear ABA-300, closing the loop the issue comment opened.Assistant· claude-opus-4-8