Skip to content

The keystroke is answered in process - #609

Merged
felipesauer merged 1 commit into
main-v1from
the-keystroke-is-answered-in-process
Sep 9, 2026
Merged

The keystroke is answered in process#609
felipesauer merged 1 commit into
main-v1from
the-keystroke-is-answered-in-process

Conversation

@felipesauer

Copy link
Copy Markdown
Owner

code/src/choice was the worst directory in the repository — 79.31 statements, 38.23 branches, 88 functions, 84 lines — and every case about it ran in a child process, which instruments no line of this source. The reducer that decides what one key does and the adapter that draws the page were each held only by a pseudo-terminal over the built binary, and by two guards that read their source as text.

It goes to 98.85 / 91.17 / 100 / 100. No production file is touched.

What is new

src/choice/asked.test.ts presses keys through the very callback the product installed on its screen, standing in for the screen through the dynamic import the module already has. The three ways out; the chord taken before the character it carries (Ctrl-D leaves, d does not, and Ctrl-Up is not Up); Enter following the mark rather than the list; the arrows holding at both ends; and the arm the module says has to exist — every other key doing nothing at all.

tests/the-screen-a-choice-is-drawn-on.test.ts renders the real adapter, with ink, at streams that are not a terminal. What it does not answer is whether the terminal came back — raw mode and the caret are still the pty's question. What it does answer is that the page comes down: after close, the keys stop arriving.

tests/the-bare-name-asks.test.ts is untouched. It proves the surface answers, which is a different thing.

Both ledger rows leave, drained by the tests

Shown red first, by the stale direction, before either line was removed.

The ledger's own header claimed a shape it no longer held: thirty-four modules under wiring/ where the rows said thirty-two, twenty scattered where they said eighteen, seventy-seven keys in one sentence and seventy-nine in another — all three wrong before this branch, the prose a delivery behind the keys. They are counted off the keys now, by a case, in the file whose whole purpose is to refuse exactly that.

What the mutation battery found

Twenty-four rows, run in the foreground over committed files, restored by bytes. Two honest controls at 0 each.

Two mutations redden nothing: removing show's if (closed) return, and removing restore's. Probed directly against ink 7.1.1 — a rerender after an unmount neither throws nor writes a byte, and a second unmount does not throw. Both guards are correct and, today, the third statement of an invariant two collaborators already keep.

They are not removed: that is a production change, and Screen.close states idempotence as this product's promise rather than the library's. The two comments that claimed the guards stood between a caller and a throw are rewritten to say which premise fell and what falsified it, and a composite mutation shows the surviving case is not vacuous.

What is left uncovered, and why

Two branches in asked.ts, both unreachable, each with a case saying so rather than leaving a reader of the report to guess: the menu never opens with no door, and every call to leaving sits inside the reducer that already returned on the same flag.

doors.ts was not the target and was not chased. thresholds is unchanged.


build 0 · lint 0 · 4453 tests in 283 files (was 4426 in 281). Workspace coverage 95.50 → 95.72 statements, 88.93 → 89.31 branches, 97.01 → 97.18 functions, 96.73 → 96.89 lines.

`code/src/choice` was the worst directory in the repository — 79.31 statements,
38.23 branches, 88 functions, 84 lines — and every case about it ran in a child
process, which instruments no line of this source. The reducer that decides what
one key does and the adapter that draws the page were each held only by a
pseudo-terminal running the built binary, and by two guards that read their
source as text.

Two files close them, and neither converts the end-to-end case that already
exists — it proves the surface answers, which is a different thing:

  - `src/choice/asked.test.ts` presses keys through the very callback the
    product installed on its screen, standing in for the screen through the
    dynamic import the module already has. The three ways out, the chord taken
    before the character it carries, Enter following the mark rather than the
    list, the arrows holding at both ends, and the arm the module says has to
    exist — every other key doing nothing at all.
  - `tests/the-screen-a-choice-is-drawn-on.test.ts` renders the real adapter,
    with ink, at streams that are not a terminal. The premise that no test here
    does that was false: two files already render the console the same way. What
    it does assert is what that premise was afraid of — closing takes the page
    down, which is why the keys stop arriving.

Both rows leave the debt ledger, drained by the tests rather than by hand. The
ledger's own header claimed a shape it no longer held — thirty-four modules
under `wiring/` where the rows said thirty-two, twenty scattered where they said
eighteen, seventy-seven keys in one sentence and seventy-nine in another. The
numbers are counted off the keys now, by a case.

`choice` goes to 98.85 / 91.17 / 100 / 100. `screen.ts` is closed on all four.
The two branches left in `asked.ts` are unreachable, and two cases say why
instead of leaving a reader of the report to guess: the menu never opens with no
door, and every call to leaving is inside the reducer that already returned on
the same flag.

Coverage across the workspace: 95.50 to 95.72 statements, 88.93 to 89.31
branches, 97.01 to 97.18 functions, 96.73 to 96.89 lines. No production file is
touched.
@felipesauer
felipesauer merged commit 432c9d1 into main-v1 Sep 9, 2026
4 checks passed
@felipesauer
felipesauer deleted the the-keystroke-is-answered-in-process branch September 9, 2026 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant