Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit c34458e1722b5a5c0e248583c3e06aa745e1e814
parent bdd7dc10349788440f36f0ba0e20429c14a4a314
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Wed, 14 Oct 2026 17:44:06 -0400

plans: umtool redesign — board.spec races, as fixed (root causes, the write queue and held keys, the held-write spec, gates)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mplans/umtool-redesign.md | 80+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 80 insertions(+), 0 deletions(-)

diff --git a/plans/umtool-redesign.md b/plans/umtool-redesign.md @@ -3150,3 +3150,83 @@ lost), then umtool (`scripts/r6-umtool.sh`). Live: a dry-run watch over `the-qua day, the API model capped $5 a tick, and stores nothing; no schedules exist, the lane armed; decisions API 833 rows, notes' hrefs end `note=<id>`. +### board.spec races, as fixed + +**What.** The remaining `board.spec` serial-chain flake, root-caused in the app (`components/research/BoardView.tsx`). +Under load three different reds had shown: `s` did not mark the speaker checked (P6a run 2), a typed claim landed in +the case's title (R4 run 2), `e` did not focus the claim (P4a-3, R5). R5 fixed one race: a field asked for mid-save +waited for the redraw. It held the keys typed while it waited by throwing them away, and it left four more. + +**Root causes.** +- **Several writes in flight at once.** `busy` was one boolean. A note's save and the `s` after it were two PATCHes + racing their answers: an older answer landing last redrew the speaker as unchecked. A write finishing also cleared + `busy` while another was still answering. +- **Toggles and moves computed on the render that queued them.** Two `s` presses each sent `!speakerChecked` as the + page drew it: true, true. +- **Keys acting on a list about to be replaced.** The list remounts on every arrangement's answer. While a move was + answering: + - `j`/`k` moved the light in the old list, and the redraw then put it back. + - `e` focused a field the redraw took away. The claim typed after it ran as board commands: `r` opened the case's + rename, the rest went into its title, Enter renamed the case. + - R5's waiting field fixed the focus, but the claim typed meanwhile was dropped. +- **The light read from the last render.** A key in the same tick as a j/k acted on the line the page had last drawn. +- **A dialog's field never took the focus.** React's `autoFocus` focuses before `showModal()` and never writes the + attribute the browser's focusing steps read. So `a`/`r` + typing went to the dialog's ✕. + +**Fix.** +- **ONE write queue (`write`).** Every board write — moves, claim, note, speaker, sections, removal, re-verify, the + hand-off's reload — runs in the order asked. Each is computed on the case the previous one left (`docRef`; the + speaker toggle on the quote at its turn), and each answer is applied before the next starts. +- **Keys held while the board settles.** A capture listener on `window` runs before the list's j/k and any field. It + holds every key pressed while a write is queued or answering, or while earlier keys still wait, and replays them in + order once the board has settled, one per frame: + - a command acts on the redrawn board; + - a character or Backspace lands in the focused field; + - Enter goes to the field's handler, or submits its form; Escape closes a dialog. + - A field the operator is already typing in is left alone unless keys are waiting ahead of it. + - `data-board-busy` covers the held keys too. +- **The light is a ref** the list sets on every `lit` event. +- **`Dialog` focuses `[data-autofocus]`** after `showModal()` (additive); the board's ask field carries it. +- R5's pending-field rule is gone; the held keys do its job without losing the typing. + +**The spec** (`e2e/board.spec.ts`, one new test after test 102). `holdNext(page, method, part)` holds the next +matching board request at the network (`page.route`) until `release()`. So the board is settling, certainly and for as +long as the test needs, with no wait and no timing. Under a held write: +1. `e`, then the claim "Recorded at the vote, x-ray" (r, a, c, v, x and e are all board commands), then Enter. Nothing + acts while it is held. After release the claim is saved whole, the case title is unchanged, and no dialog opened. +2. A note saved with Enter and held; `s` twice. The PATCH bodies are `[true, false]`, in order, and the view matches + the file. +3. alt+k held, then `j`: the light lands on the line after the moved quote in the redrawn list. +4. `a` + a title + Enter: the section is added after release, the dialog's field focused. Then `x` + Escape: no + dialog, no quote removed. + +The test then restores the board for the tests after it. + +**Proof the spec catches the races.** The new spec run against `main`'s `BoardView.tsx` and `dialog.tsx`: 8 tests, +6 passed, 2 failed. Step 1's claim is "" (the typed keys were swallowed), and the hand-off test after it reads the +board the failure left. On the fix: below. + +| sha | what | +|---|---| +| `21c29bf5` | one write queue, held keys replayed on the settled board, the light as a ref, `Dialog`'s `data-autofocus`; `board.spec`'s held-write test | +| `7bc75790` | merge `main` `82ab18c5` (R6 live): clean; R6's one board change, the side panel's "From triage", is additive | + +**Gates.** + +| Gate | Result | +|---|---| +| `board.spec` alone, 5× (`21c29bf5`) | 8/8 each time: 5 of 5 runs green | +| repo-wide `tsc --noEmit` | clean at `21c29bf5` and at the merged tip `7bc75790` | +| umtool unit, at `7bc75790` | 860 tests: 858 pass, 2 skipped, 0 fail | +| `pnpm --filter umtool test` | 31/31 | +| `pnpm run test:scripts` | 1012 tests: 1010 pass, 2 skipped, 0 fail | +| capped umtool `next build` (corpus linked, `MemoryMax=5G`, heavy slot) | exit 0 at `7bc75790`; compiled 18.6 s, 1:13 wall (with the wait for memory), 1.51 GB max RSS; the link removed | +| full umtool e2e at `7bc75790` (detached, queued; about 7 min of its 20 were spent waiting for memory at the heavy slot) | **477 tests: 471 passed, 0 failed, 6 skipped** (the song-data skips), 10.4 min of tests; `board.spec` 8/8 | + +**Left.** +- **A held key that opens a dialog with no field** (`x`'s Remove the quote) lands the focus on the dialog's ✕. A held + Enter after it does not confirm the removal; a held Escape closes the dialog. This is the cautious side, and deliberate. +- **Held text goes in at the field's end**, not at a caret: a held key always targets a field the replay itself just + focused. +- **Other pages' lit lists** (Research's results, the run page) have no writes that remount them while keys are + pressed, so they are not changed.