Skip to content

Commit 860cab1

Browse files
Haiderclaude
andcommitted
fix(tui): make the flush test assert its own claim, and stop y/n propagation
Two remaining review points. The test named "enabling yolo clears a prompt that is already on screen" only asserted that a reply was sent — never that the prompt left the screen, which is the behaviour in its name. It now asserts the pending list empties. This works without emitting `permission.replied` because autoApprove removes the request optimistically on success. Adds `stopPropagation()` to the dialog's `y` and `n` branches, matching the `return` branch. Two reviewers disagreed on whether this is load-bearing: the dialog blurs the focused renderable on open and refocuses in a later tick, so a stray character cannot reach the prompt today. It is free consistency that keeps that true if the ordering ever changes. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01964Prd1Sz5JwWZmNTrFdiU
1 parent e8e42c7 commit 860cab1

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

packages/tui/src/component/dialog-yolo-confirm.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,19 @@ export function DialogYoloConfirm(props: { onChoose: (enable: boolean) => void }
5656
options[selected()].run()
5757
return
5858
}
59+
// stopPropagation for consistency with the `return` branch above. The dialog blurs
60+
// the focused renderable on open and only refocuses in a later tick, so a stray
61+
// character cannot reach the prompt today — this keeps it that way if that ordering
62+
// ever changes.
5963
if (evt.name === "y" && !evt.ctrl && !evt.meta) {
6064
evt.preventDefault()
65+
evt.stopPropagation()
6166
run(true)
6267
return
6368
}
6469
if (evt.name === "n" && !evt.ctrl && !evt.meta) {
6570
evt.preventDefault()
71+
evt.stopPropagation()
6672
run(false)
6773
}
6874
})

packages/tui/test/cli/cmd/tui/yolo-sync.test.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,10 @@ describe("tui sync: yolo auto-approve", () => {
214214
await wait(() => pending(sync, ROOT).length === 1)
215215
sync.yolo.set(ROOT, true)
216216
await wait(() => replies.length === 1)
217+
// Assert the behaviour in the test's name, not just that a reply went out: the
218+
// prompt must actually leave the screen. autoApprove removes it optimistically on
219+
// success, so this does not depend on the server's permission.replied event.
220+
await wait(() => pending(sync, ROOT).length === 0)
217221
} finally {
218222
app.renderer.destroy()
219223
await tmp[Symbol.asyncDispose]()

0 commit comments

Comments
 (0)