FE-877: Brownfield promotion — commit the cook result onto cook/<runId>#221
FE-877: Brownfield promotion — commit the cook result onto cook/<runId>#221kostandinang wants to merge 1 commit into
Conversation
56b7014 to
e9a6f5e
Compare
e9a6f5e to
cd5ef22
Compare
4b2ab45 to
decc14d
Compare
cd5ef22 to
e7a2007
Compare
decc14d to
92af4c7
Compare
e7a2007 to
b59e71f
Compare
92af4c7 to
6a7e6c1
Compare
b59e71f to
58d7775
Compare
PR SummaryMedium Risk Overview CLI ( Tests cover happy path, missing branch, real linked-worktree topology, and tracked deletions. Reviewed by Cursor Bugbot for commit 843025d. Bugbot is set up for automated code reviews on this repo. Configure here. |
58d7775 to
d8ee639
Compare
cae46da to
8b72f34
Compare
d8ee639 to
a0ebbda
Compare
8b72f34 to
eb1c494
Compare
a0ebbda to
17ae900
Compare
…d> via git plumbing Co-authored-by: Amp <amp@ampcode.com> Amp-Thread-ID: https://ampcode.com/threads/T-019ecb9a-9a08-733b-833d-76885fc8243a
eb1c494 to
ce73674
Compare
17ae900 to
843025d
Compare

Stack Context
Stacks on FE-876 (#220). Seventh Arc-1 frontier -- extends FE-827's greenfield promotion (
promote-run.ts) to brownfield, closing the cook-codebase-mode follow-on: a completed brownfield result used to sit uncommitted in the worktree with no path back into the user's checkout.What?
Commit a completed brownfield cook result onto the repo's own
cook/<runId>branch as one reviewable commit.promoteBrownfieldRun,promote-run.ts): the brownfield sandbox was created withgit worktree add -b cook/<runId> ... HEAD, so the branch already exists at the base. This lands the composed tree on top of it via plumbing -- seed a throwaway index from the base (read-tree), stage the composed tree against an external work-tree (add -A),write-tree->commit-tree -p <base>-> compare-and-swapupdate-ref. ReusespromotionSourceDirto compose across slice layouts (shared / per-slice +__epic__merge, conflicts reported).runCook,cook-cli.ts): brownfield promotion now runs automatically on a completed run (the old "greenfield-only" block is gone); greenfield stays opt-in via--out.Why?
git plumbingis the whole point: the user's active branch, working tree, and index are never touched -- only one commit and one ref move. Mergingcook/<runId>into the working branch stays the user's call (the orchestrator-arcs guardrail: promotion must not freelance into their branch). Gitignored deps (node_modules/) don't land, becauseadd -Ahonors the worktree's.gitignore. Unblocks FE-872's deferred brownfield dep-delta capture over the CoW baseline.Tests
Against throwaway git repos: composed tree lands on
cook/<runId>(parent = base,app.tsmodified +feature.tsadded present,node_modules/absent) whilemain/HEAD/working-tree/index stay untouched and no stray branches appear; a missingcook/<runId>branch throws.Review fixes (this revision)
cook/<runId>viagit branch, not the productiongit worktree add -b cook/<runId>topology -- exactly where "update-ref a checked-out branch" could fail. Added a test that promotes from the main repo while the branch is checked out in a linked worktree (verified out-of-band thatupdate-refsucceeds there): only the ref moves, main checkout untouched.read-tree base+add -Acaptures deletions, not just adds/mods).--outwarning. Brownfield auto-promotes, so--outno longer silently no-ops -- it warns that the result lands oncook/<runId>.parentisupdate-ref's expected old-value).Co-authored-by: Amp amp@ampcode.com