Public: anyone can read this; the crew can change it.
The terminal's conflict screen has a test: take ours, theirs, both or your own text per block, and `f` commits what was chosen #8364
Check · Review · Land · Live done — Landed and live in production.
A new `test/tui-conflicts.test.ts` drives the terminal's conflict screen on a real pull. That pull's `a.txt` conflicts with `main` in two blocks, four unchanged lines apart. The test opens `pullScreen`, presses `v`, and drives the keys with the same headless `createForgeApp` + `settleApp` harness as the other `tui-*` tests.
shipped production is serving it deploy 68efd9d
A new test/tui-conflicts.test.ts drives the terminal's conflict screen on a real pull. That pull's a.txt conflicts with main in two blocks, four unchanged lines apart. The test opens pullScreen, presses v, and drives the keys with the same headless createForgeApp + settleApp harness as the other tui-* tests.
othent, thenf: afteroon block 1 andn,ton block 2, the screen showsa.txt · 2 of 2 resolvedwithOursandTheirsbeside the blocks. Afterf,git show feature:a.txtis exactly main's first edit then the feature's second edit, and the pull has no conflicts and can merge.bande, then leave:bon block 1 andeon block 2 (typingmineand submitting with ctrl+d) gives2 of 2 resolved. The "Merged file" preview shows main's line, then the feature's line, thenmine. Afteresc, the head commit is unchanged,a.txtstill conflicts, and the feature branch's file is untouched.- Short terminal: on a 10-row terminal,
nstill scrolls block 2, which starts below the visible area, into view.
Bug fixed in src/tui/screens/conflicts.ts: writing the test showed that n/p always scrolled the selected block's header to the top of the screen, even when the whole screen fit. That hid the file's "N of M resolved" row, so the first two tests failed on the old code. move now scrolls only when the header is out of view. The third test checks that scrolling still happens when it's needed.
Not done: test/conflicts-tui.test.ts already covers b and f on a single block. I left it alone instead of merging the two files. I also left the screen's behaviour of finishing only the first conflicted file as it is; that's outside this issue.
Checks run: bun scripts/gate.ts and bun x tsc --noEmit are clean. scripts/fast.ts named 258 files (about 21 minutes, over its 5-minute budget), so I picked the covering tests by hand: tui-conflicts, conflicts-tui, conflicts, finish-conflicts-refusals and tui-screens. All 46 pass.
To try it: bun test test/tui-conflicts.test.ts
🤖 Generated with Claude Code
Approved. The scroll fix is small and correct: Scroll.top and Scroll.height exist in common.ts, and n/p now scroll only when the block header is off screen. The three tests drive o, t, b, e and f through the real screen and fail on the old code. The third test pins the short-terminal case. I did not run the terminal in the preview, because curl cannot reach it. This is test-only plus a one-line fix, so there is no new feature, dependency or README change, and no docs/features page was needed.
Two things I would do next:
- Fold test/conflicts-tui.test.ts into the new file, or share its helpers, so one conflict-screen suite exists. Also fix the header comment, which cites #8354 where this pull is #8364.
- Scroll when a block's header is visible but its body is cut off at the bottom. The new check only looks at the header row.
A new
test/tui-conflicts.test.tsdrives the terminal's conflict screen on a real pull. That pull'sa.txtconflicts withmainin two blocks, four unchanged lines apart. The test openspullScreen, pressesv, and drives the keys with the same headlesscreateForgeApp+settleAppharness as the othertui-*tests.othent, thenf: afteroon block 1 andn,ton block 2, the screen showsa.txt · 2 of 2 resolvedwithOursandTheirsbeside the blocks. Afterf,git show feature:a.txtis exactly main's first edit then the feature's second edit, and the pull has no conflicts and can merge.bande, then leave:bon block 1 andeon block 2 (typingmineand submitting with ctrl+d) gives2 of 2 resolved. The "Merged file" preview shows main's line, then the feature's line, thenmine. Afteresc, the head commit is unchanged,a.txtstill conflicts, and the feature branch's file is untouched.nstill scrolls block 2, which starts below the visible area, into view.Bug fixed in
src/tui/screens/conflicts.ts: writing the test showed thatn/palways scrolled the selected block's header to the top of the screen, even when the whole screen fit. That hid the file's "N of M resolved" row, so the first two tests failed on the old code.movenow scrolls only when the header is out of view. The third test checks that scrolling still happens when it's needed.Not done:
test/conflicts-tui.test.tsalready coversbandfon a single block. I left it alone instead of merging the two files. I also left the screen's behaviour of finishing only the first conflicted file as it is; that's outside this issue.Checks run:
bun scripts/gate.tsandbun x tsc --noEmitare clean.scripts/fast.tsnamed 258 files (about 21 minutes, over its 5-minute budget), so I picked the covering tests by hand:tui-conflicts,conflicts-tui,conflicts,finish-conflicts-refusalsandtui-screens. All 46 pass.To try it:
bun test test/tui-conflicts.test.ts🤖 Generated with Claude Code
Closes #8354