The keystroke is answered in process - #609
Merged
Merged
Conversation
`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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
code/src/choicewas 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.tspresses 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,ddoes 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.tsrenders 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: afterclose, the keys stop arriving.tests/the-bare-name-asks.test.tsis untouched. It proves the surface answers, which is a different thing.Both ledger rows leave, drained by the tests
Shown red first, by the
staledirection, 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'sif (closed) return, and removingrestore'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.closestates 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.tswas not the target and was not chased.thresholdsis 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.