commit 13de31e8f335ef80365cb3727cd0060dc780fabd
parent fd01705f5d0cde7f83cc12d164892ca0e75b946b
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Wed, 14 Oct 2026 21:49:58 -0400
Merge main (45aba2ca: board race 3, the R6.1/R6.2 docs) into ux/r63
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
8 files changed, 317 insertions(+), 57 deletions(-)
diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md
@@ -1,6 +1,7 @@
# Changelog
## [Unreleased]
+- **The research board keeps a key pressed just after a save, too.** A key that arrived after a save's answer, or after its redraw but before the moved line took the focus back, could still lose `e`'s field (the claim then went nowhere). The board now waits until the redraw is fully done before acting on any key. Needs a restart of umtool.
- **A recurring report's tick no longer calls a capped scan "nothing new".** Triage used to take the scope from one `enumerate_matches(".")`, which stops at 2,000 recordings — the co-host pilot's five channels hold 23,284, the newest read last, so its first tick found "0 new" and ended quiet. Tier 0 now lists the scope from the build's own per-channel manifests (every recording, uncapped, dated by the build's index) and reads the terms only over the new recordings (and, on a first run, from the start date). A scan that still hits a cap or misses a channel is **partial**: the tick says "partial — not reached: …" as a **Your call** card in umtool (never quiet, no quiet edition recorded), the triage run says so on its page, and its set of seen recordings is not kept, so the next run counts new from the last complete run (or from its start date). The same rule holds for a Refresh's search again (a capped search with nothing new ends **partial**, not "no change"), a series' window check, and the Inbox's daily refresh check (a partial check still raises its card, naming what it did not reach; `umtool refresh --check` prints PARTIAL). Needs a restart of the editor and umtool.
- **`enumerate_matches` takes `ids`.** Only the pages that hold those recordings are read, so the scan is bounded by them rather than by the scope; the footer says how many the scope holds. A sweep restricted to given recordings (a refresh's update, a triage's escalation) now scans only theirs.
- **A tick no longer waits hours on a paused transcription.** When the transcription workers are paused or none is enabled, a refresh's or tick's fetch skips `transcribe-bucket` and says "transcription is paused (…) — N recordings wait; a later run reads them once transcribed" as a warning. A fetch step that was cancelled is a warning; "nothing new to transcribe" is no longer one.
diff --git a/plans/umtool-redesign.md b/plans/umtool-redesign.md
@@ -463,7 +463,7 @@ mis-transcriptions and adapt by adding its own terms.
| R4 refresh | `ux/r4` → `main` `08fee8e1` | LIVE 2026-10-14 (editor nFiNyOdI…, umtool -HUqAEPA…) |
| R5 recurring reports | `ux/r5` → `main` `0bf4aacd` | LIVE 2026-10-14 (editor 379S-Sk9…, umtool vWDhtigj…) |
| R6 triage first | `ux/r6` → `main` `326beacf` | LIVE 2026-10-14 (editor i-wNjJfg…) |
-| Board races fix | `ux/board-race` → `main` `d9c119e2` | LIVE 2026-10-14 |
+| Board races fix | `ux/board-race` → `main` `d9c119e2`; race 3 `ux/board-race-2` → `main` `10542ff7` | LIVE 2026-10-14 |
| P6a cleanup, docs, audit | `ux/p6a` → `main` `7fb90e6e` | LIVE 2026-10-14 (umtool VUNZhrt6…) |
| P6b 308s, screenshot audit | `ux/p6b` → `main` `850e0989` | LIVE 2026-10-14 (umtool Te2jR-P8…) |
| R6.1 honest tier 0 + R4.1 | `ux/r61` | shipped on the branch |
@@ -3672,3 +3672,94 @@ since 10-07 (81 transcribed), one candidate (Melonie Mac's Go Boom Live! Ep 61 p
Mack" channel) rightly dismissed; a broader hand scan of the 81 found nothing co-host related — a quiet week, as the
record says (no co-hosts for the rest of the year, 2026-09-28; Melonie Mac on hiatus).
+### board.spec race 3 + R6.1 docs
+
+**What.** R6.1's full umtool e2e had four reds in `board.spec`'s serial chain from `:127`: "`e` did not focus the
+claim field". Run alone it went 8/8, 4/8, 8/8, 8/8, 8/8; the 4/8 ran beside a heavy common test run. The board-race
+fix (`21c29bf5`) had held keys while a write was queued or answering. Two later gaps were left open, and a key
+landing in either acted on a list or a focus that was about to change.
+
+**Found, not guessed.**
+- **The reproduction.** A throwaway stress spec ran rounds of alt+j / alt+k + `e` on a case of its own, under CDP
+ `Emulation.setCPUThrottlingRate`. At 6× it missed 10 of 25 rounds on `b969f61b`; each time the focus ended on the
+ moved line.
+- **The cause, from a page log.** The order on a miss was `apply` → `e` (trusted, not held) → `refocus effect`. The
+ key arrived AFTER the move's commit but BEFORE its passive effects:
+ - The board counted itself settled at the commit (a layout effect), so `e` focused the new claim field.
+ - The deferred refocus of the moved line then took the focus back, and the claim typed next went to the line.
+ - The remounted list's light and its j/k listener are passive effects too.
+- **The first gap**, closed in `b969f61b`: a write ends in microtasks, while React commits its answer in a later task.
+ The board counted itself settled when the write ended.
+
+**Fix** (`components/research/BoardView.tsx`).
+- **Settled** means no write queued or answering AND the last answer drawn with its effects run. `drawnV` is set in a
+ passive effect declared after the refocus. Being the parent's, it also runs after the list's own effects. Until
+ then keys are held, as during a write. Stress after the fix: 0 of 25 rounds at 6×, 0 of 40 at 10×.
+- **The view, the light and the list's key are ONE state**, with `v` saying which answer is drawn, so they can never
+ commit apart.
+- **An added section** is lit and focused in the redraw that draws it, inside its write. Before, it was a second
+ remount after the write had ended.
+- **`data-board-keys="ready"`** is set once the board's key listeners are attached.
+
+**The spec.** One new test hits each gap for certain from inside the page. These are spec-only hooks; the app has no
+test code.
+- **answer:** `Response.json` is wrapped, and `e` is dispatched 50 microtasks after the held move's answer is read.
+ That is after the write and before the commit.
+- **commit:** a MutationObserver sees the remounted list arrive and dispatches `n` in its callback. That is after the
+ commit and before the passive effects' task.
+
+Each key must focus its field, and the text typed next must be saved whole. Every board test now opens the board
+through `openBoard`, which waits for `data-board-keys="ready"`: before that, a key is the browser's, because nothing
+on the page listens yet.
+
+**Proof the spec catches both.** Each old `BoardView.tsx` was run with the new spec, 2 runs each:
+- `b969f61b` fails the commit gap ("Noted after the redraw" not saved). Its second run also hit the original chain
+ red, at `:137`, where `e` did not focus.
+- `main` (`54dbfb79`) fails the answer gap ("corded in the gap": the `R` and `e` were lost) and the chain.
+
+**R6.1 docs** (`umtool/docs/`).
+- `inbox.md`: **tick-partial** (Your call, **See what was missed**). Your call now includes a partial tick, and a
+ partial `refresh-available` check says what it did not read.
+- `triage.md`:
+ - **Partial runs**: never quiet, no seen set, the tick-partial card, capped window checks and refreshes.
+ - **The fetch under a hold**: the transcription-paused skip as a warning, and "nothing new to transcribe" as routine.
+ - **Recovering a bad run**: `report-schedule {"action":"reset-triage"}`, plan then `confirm`.
+ - Tier 0's whole-scope listing by manifests; the lead paragraph folded into "Where it runs".
+- `refresh.md`: the `partial` status.
+- `recurring.md`: the fetch's skips and the partial tick.
+
+| sha | what |
+|---|---|
+| `b969f61b` | the answer gap: settled only after the answer's commit; `data-board-keys`; the spec's answer-gap test and `openBoard` |
+| `f70f41e5` | docs: R6.1 |
+| `231076a8` | the commit gap: settled only after the redraw's passive effects; one state for view, light and list; the add-section remount inside its write; the spec's commit gap |
+| `3a994922` | merge `main` `21880180` (plans only) |
+| `f5772c0e` | merge `main` `7ab19c75` (R6.2 live) |
+| `c0961d73` | docs: triage.md's tier 0 listing and R6.2's "seen means judge-able", in a section of their own (the tiers table as `main` has it, so R6.3's edits merge cleanly) |
+
+**Gates** (at `c0961d73` unless said).
+
+| Gate | Result |
+|---|---|
+| `board.spec` alone at `3a994922` (the fix + the plans-only merge) | 4 plain runs 9/9 each; 4 runs started beside `pnpm --filter ./common test` (run 1 truly under it, load 15; runs 2–3 waited for the queue behind ux-r62 until common had ended; run 4 load 11.7): 9/9 each |
+| `board.spec` alone at `c0961d73`, truly loaded (the run started, then common's suite, running through it) | 2 runs, 9/9 each (load 4.6 → 9.0, 12.0 → 15.5) |
+| repo-wide `tsc --noEmit` | clean at `3a994922` and `c0961d73` |
+| umtool unit | 861 tests: 859 pass, 2 skipped, 0 fail |
+| `pnpm --filter umtool test` | 32/32 |
+| `pnpm run test:scripts` | 1013 tests: 1011 pass, 2 skipped, 0 fail |
+| `pnpm archilyzer docs cli --check` | clean |
+| capped umtool `next build` (corpus linked, `MemoryMax=5G`, heavy slot) | exit 0; compiled 12.8 s, 40 s wall, 1.63 GB max RSS; the link removed |
+| full umtool e2e at `c0961d73` (detached, queued) | **544 tests: 538 passed, 0 failed, 6 skipped** (the song-data skips), 10.8 min; `board.spec` 9/9 |
+
+`board.spec` alone, counted together: 10 runs, all 9/9 — four plain, four started beside common's suite, two truly under
+it — plus the full run. The stress spec stayed in the job's scratch; it was not committed.
+
+### board.spec race 3 + R6.1 docs rollout (orchestrator, 2026-10-14)
+
+`main` fast-forwarded to `10542ff7`: the board is settled only after the refocus and the list's setup have run (keys
+held until then, `data-board-keys="ready"`), its view, lit line and redraw one piece of state; the spec reaches both
+gaps from inside the page. Stress 0/25 at 6× and 0/40 at 10× CPU throttling (10/25 missed before); `board.spec` 10/10
+alone; full umtool e2e on the merged tip 538 passed, 0 failed, 6 skipped. Docs: `inbox.md` (tick-partial),
+`triage.md` (whole-scope listing, seen = judge-able, partial runs, the transcription-paused skip, `reset-triage`),
+`refresh.md`, `recurring.md`. umtool built and restarted (`scripts/board2-umtool.sh`); live `/research` and a case 200.
+
diff --git a/umtool/components/research/BoardView.tsx b/umtool/components/research/BoardView.tsx
@@ -123,14 +123,19 @@ type Ask =
export default function BoardView({ initial }: { initial: CaseView }) {
const router = useRouter();
const hydrated = useHydrated();
- const [view, setView] = useState<CaseView>(initial);
+ // WHAT IS DRAWN, as ONE state: the case's view, the light, the list's key
+ // (it remounts on an arrangement) and `v`, which answer this is. One state,
+ // so they can never commit apart -- React may render an update made with a
+ // key event's priority before one made from a fetch's continuation, and a
+ // board whose light, list and view committed in different renders sent a
+ // key to a line the next render replaced (race 3).
+ const [board, setBoard] = useState<{ view: CaseView; litId: string | null; listKey: number; v: number }>({ view: initial, litId: null, listKey: 0, v: 0 });
+ const { view, litId, listKey } = board;
// Writes queued or answering (the ref is read synchronously by the keys).
const [pending, setPending] = useState(0);
const pendingRef = useRef(0);
const busy = pending > 0;
const [status, setStatus] = useState<{ text: string; href?: string; tone?: "error" } | null>(null);
- const [litId, setLitId] = useState<string | null>(null);
- const [listKey, setListKey] = useState(0);
const [ask, setAsk] = useState<Ask | null>(null);
const [askText, setAskText] = useState("");
const [handoff, setHandoff] = useState<"article" | "video" | "sweep" | null>(null);
@@ -181,9 +186,32 @@ export default function BoardView({ initial }: { initial: CaseView }) {
return run;
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
- const apply = (v: CaseView) => {
+
+ // SETTLED = no write queued or answering AND the last answer is on screen
+ // with everything that follows a redraw done. An answer is applied (`apply`)
+ // before it is drawn: React commits it in a later task, and runs the passive
+ // effects after the commit later still -- the moved line's refocus above,
+ // the remounted list's light and its j/k listener. A key landing in either
+ // gap (under load, often) acted on a list or a focus about to change: `e`
+ // focused the claim, then the refocus put the focus back on the line (race
+ // 3). So the board is settled only once this effect -- a passive one,
+ // declared after the refocus, and a parent's, so after the list's own --
+ // has run for answer `applied` (`drawnV`).
+ const applied = useRef(0);
+ const drawnV = useRef(0);
+ useEffect(() => {
+ drawnV.current = board.v;
+ }, [board.v]);
+ const settled = () => pendingRef.current === 0 && drawnV.current === applied.current;
+
+ /** Draw an answer: its view, and with it the light and a remount when the list was rearranged. */
+ const apply = (v: CaseView, o: { remount?: boolean; lit?: string | null; focus?: string | null } = {}) => {
docRef.current = v.case;
- setView(v);
+ applied.current += 1;
+ const n = applied.current;
+ if (o.lit !== undefined) litRef.current = o.lit;
+ if (o.remount) refocus.current = o.focus ?? null;
+ setBoard((b) => ({ view: v, litId: o.lit !== undefined ? o.lit : b.litId, listKey: o.remount ? b.listKey + 1 : b.listKey, v: n }));
};
/** An arrangement (sections, order), computed on the case when its turn comes. */
@@ -193,13 +221,7 @@ export default function BoardView({ initial }: { initial: CaseView }) {
const body = next(docRef.current);
if (!body) return;
const v = await call<CaseView>(researchCaseApi(docRef.current.id), "PATCH", body);
- apply(v);
- refocus.current = keep;
- if (keep) {
- litRef.current = keep;
- setLitId(keep);
- }
- setListKey((k) => k + 1);
+ apply(v, { remount: true, focus: keep, ...(keep ? { lit: keep } : {}) });
}),
[write],
);
@@ -212,27 +234,24 @@ export default function BoardView({ initial }: { initial: CaseView }) {
if (!q) return;
const b = typeof body === "function" ? body(q) : body;
const r = await call<{ case: CaseView }>(researchCaseQuoteApi(docRef.current.id, qid), "PATCH", b);
- apply(r.case);
- if ("section" in b) {
- refocus.current = quoteLineId(qid);
- setListKey((k) => k + 1);
- }
+ apply(r.case, "section" in b ? { remount: true, focus: quoteLineId(qid) } : {});
if (b.useCurrentWords) say("The quote now has the transcript's current words; the old ones are kept in its history.");
}),
// eslint-disable-next-line react-hooks/exhaustive-deps
[write],
);
+ /** The case's fields; `keep` the line lit and focused after a section change (from the answer, if a function). */
const patchCase = useCallback(
- (body: Record<string, unknown> | ((d: CaseView["case"]) => Record<string, unknown>), keep: string | null = null) =>
+ (
+ body: Record<string, unknown> | ((d: CaseView["case"]) => Record<string, unknown>),
+ keep: string | null | ((v: CaseView) => string | null) = null,
+ ) =>
write(async () => {
const b = typeof body === "function" ? body(docRef.current) : body;
const v = await call<CaseView>(researchCaseApi(docRef.current.id), "PATCH", b);
- apply(v);
- if (b.sections) {
- refocus.current = keep;
- setListKey((k) => k + 1);
- }
+ const k = typeof keep === "function" ? keep(v) : keep;
+ apply(v, b.sections ? { remount: true, focus: k, ...(typeof keep === "function" && k ? { lit: k } : {}) } : {});
return v;
}),
// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -278,8 +297,7 @@ export default function BoardView({ initial }: { initial: CaseView }) {
(q: Quote) =>
write(async () => {
const r = await call<{ case: CaseView }>(researchCaseQuoteApi(docRef.current.id, q.id), "DELETE");
- apply(r.case);
- setListKey((k) => k + 1);
+ apply(r.case, { remount: true });
say(`Removed “${q.text.slice(0, 60)}${q.text.length > 60 ? "…" : ""}”`);
}),
// eslint-disable-next-line react-hooks/exhaustive-deps
@@ -297,14 +315,14 @@ export default function BoardView({ initial }: { initial: CaseView }) {
const t = askText.trim();
setAsk(null);
if (a.kind === "add-section" && t) {
- const v = await patchCase((d) => ({ sections: [...d.sections, { title: t }] }));
- const added = v?.case.sections.at(-1);
- if (added) {
- refocus.current = sectionLineId(added.id);
- litRef.current = sectionLineId(added.id);
- setLitId(sectionLineId(added.id));
- setListKey((k) => k + 1);
- }
+ // The new section is lit and focused in the same redraw that draws it.
+ await patchCase(
+ (d) => ({ sections: [...d.sections, { title: t }] }),
+ (v) => {
+ const added = v.case.sections.at(-1);
+ return added ? sectionLineId(added.id) : null;
+ },
+ );
} else if (a.kind === "rename-section" && t) {
await patchCase((d) => ({ sections: d.sections.map((s) => (s.id === a.sid ? { id: s.id, title: t } : s)) }), sectionLineId(a.sid));
} else if (a.kind === "remove-section") {
@@ -339,6 +357,9 @@ export default function BoardView({ initial }: { initial: CaseView }) {
const dispatching = useRef(false);
const [heldN, setHeldN] = useState(0);
const [kick, setKick] = useState(0);
+ // The keys are live (hydrated, every listener attached): a page's first key
+ // before this is the browser's, not the board's.
+ const [keysReady, setKeysReady] = useState(false);
useEffect(() => {
const onKey = (e: KeyboardEvent) => {
if (dispatching.current || e.metaKey || e.ctrlKey) return;
@@ -346,13 +367,14 @@ export default function BoardView({ initial }: { initial: CaseView }) {
const typing = !!(e.target as HTMLElement | null)?.closest?.(TYPING);
// A field the operator is typing in is left alone unless earlier keys
// are still waiting (then this one waits behind them, in order).
- if (held.current.length === 0 && (typing || pendingRef.current === 0)) return;
+ if (held.current.length === 0 && (typing || settled())) return;
e.preventDefault();
e.stopImmediatePropagation();
held.current.push({ key: e.key, code: e.code, altKey: e.altKey, shiftKey: e.shiftKey });
setHeldN(held.current.length);
};
window.addEventListener("keydown", onKey, true);
+ setKeysReady(true);
return () => window.removeEventListener("keydown", onKey, true);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
@@ -382,15 +404,15 @@ export default function BoardView({ initial }: { initial: CaseView }) {
// Settled (nothing queued or answering, the redraw committed): replay.
useEffect(() => {
- if (replaying.current || pending > 0 || held.current.length === 0) return;
+ if (replaying.current || !settled() || held.current.length === 0) return;
replaying.current = true;
void (async () => {
try {
- while (held.current.length && pendingRef.current === 0) {
+ while (held.current.length && settled()) {
// A frame between keys: what the last one did (a focus, a dialog, a
// new light) is on screen before the next one acts.
await new Promise((r) => setTimeout(r, 16));
- if (pendingRef.current > 0) break;
+ if (!settled()) break;
const k = held.current.shift()!;
replayKey(k);
}
@@ -399,11 +421,11 @@ export default function BoardView({ initial }: { initial: CaseView }) {
setHeldN(held.current.length);
// A write that started and answered while this loop waited a frame
// changed `pending` under it: look again.
- if (held.current.length && pendingRef.current === 0) setKick((n) => n + 1);
+ if (held.current.length && settled()) setKick((n) => n + 1);
}
})();
// eslint-disable-next-line react-hooks/exhaustive-deps
- }, [pending, listKey, heldN, kick]);
+ }, [pending, board.v, heldN, kick]);
useEffect(() => {
const onKey = (e: KeyboardEvent) => {
@@ -475,7 +497,7 @@ export default function BoardView({ initial }: { initial: CaseView }) {
const onLight = useCallback((d: LitDetail) => {
litRef.current = d.id;
- setLitId(d.id);
+ setBoard((b) => (b.litId === d.id ? b : { ...b, litId: d.id }));
}, []);
const s = doc.scope;
@@ -519,7 +541,7 @@ export default function BoardView({ initial }: { initial: CaseView }) {
/>
<div className="grid min-h-0 flex-1 grid-cols-[minmax(0,1fr)_300px]">
<div className="flex min-h-0 min-w-0 flex-col">
- <div className="min-h-0 flex-1 overflow-auto px-7 pb-4 pt-2" data-board-busy={busy || heldN > 0 ? "" : undefined}>
+ <div className="min-h-0 flex-1 overflow-auto px-7 pb-4 pt-2" data-board-busy={busy || heldN > 0 || board.v !== applied.current ? "" : undefined} data-board-keys={keysReady ? "ready" : undefined}>
{doc.quotes.length === 0 && doc.sections.length === 0 ? (
<EmptyState title="No quotes on this board yet">
<Link prefetch={false} href={researchFromCaseHref(doc)} className="ink-link">
diff --git a/umtool/docs/inbox.md b/umtool/docs/inbox.md
@@ -18,7 +18,7 @@
| Group | What lands there | Note on the page |
|---|---|---|
-| **Your call** | research proposals, failed runs, a tick that failed or was held, a refresh held by the cap — money or work waiting on a yes | spend or failed runs |
+| **Your call** | research proposals, failed runs, a tick that failed, was held or was partial, a refresh held by the cap — money or work waiting on a yes | spend or failed runs |
| **Review** | an iteration ready, drafts to review, an edition ready, new recordings since the current report | |
| **Blocking** | a blocking decision on an active piece; a `notes.json` that does not read; the machine's calls (a required tool absent, under 5 GB free under the reports root → **Check tools** / **Open system**, `/settings/system`) | active pieces only |
| **Notes** | open operator notes | |
@@ -87,11 +87,12 @@ Cover); a cut's opens the cut's page, at the song's full path.
| `iteration-failed` — a failed run not superseded by a later live one; spend from its `usage` | Your call | Retry run |
| `worth-researching` — a watch's tick whose triage escalated ([triage.md](triage.md)); gone once its board has a hand-off or every flag is marked | Your call | Open the board |
| `tick-failed`, `tick-held` ([recurring.md](recurring.md)) | Your call | Tick now / Raise cap |
+| `tick-partial` — the newest tick's scan hit a cap or did not reach a channel: its why is the tick's reason ("partial — not reached: …; nothing flagged in what was read (…)"); never a quiet edition ([triage.md](triage.md#partial-runs)) | Your call | See what was missed (the schedule's page) |
| `refresh-held` ([refresh.md](refresh.md)) | Your call | Refresh |
| `iteration-ready` — done, not current, newer than current | Review | Make i<n> current |
| `drafts-unreviewed` — drafted fields awaiting review (unreviewed, or edited since approved) | Review | Review drafts |
| `edition-ready` | Review | Review edition |
-| `refresh-available` | Review | Refresh |
+| `refresh-available` — a partial check says so ("the check was partial — not reached: …; a Refresh reads the rest"), never "nothing new" | Review | Refresh |
| `open-note` — an operator note (its href ends `note=<id>`) | Notes | Answer note |
| `unreadable-notes` | Blocking | Repair notes.json |
| `link-ambiguous` — a slug match no iteration or manifest settles | Open | Link the video |
diff --git a/umtool/docs/recurring.md b/umtool/docs/recurring.md
@@ -63,8 +63,10 @@ Tick now, and Edit cadence and Delete schedule in its **⋯** menu. An edition's
- **One tick at a time** machine-wide (queue `report-tick`), never two of one schedule. A missed window is ONE catch-up
tick (`missed` counts the rest). A resume or a new cadence re-plans from now.
- **No day is read twice.** A held or refused edition leaves no line; the next tick covers its window.
-- A step refused or skipped in the fetch (a held or cooling platform, a channel no build holds) is a warning on the
- tick, never its failure; a build that ran and failed fails it.
+- A step refused or skipped in the fetch (a held or cooling platform, a channel no build holds, transcription paused —
+ "N recordings wait") is a warning on the tick, never its failure; a build that ran and failed fails it.
+- A scan that hit a cap or missed a channel ends the tick **`partial`** (a tick-partial card), never quiet; a bad run is
+ undone with `reset-triage` ([triage.md](triage.md#partial-runs)).
## Where it is stored
diff --git a/umtool/docs/refresh.md b/umtool/docs/refresh.md
@@ -52,7 +52,7 @@ The dialog says, before anything runs:
A cap refusal ends `held-by-cap` with the estimate. The result is an **iteration-ready** card; making it current
stays yours (**Use this iteration**).
-`refresh.json` `status`: `running`, `no-change`, `updated`, `held-by-cap`, `failed`, `cancelled`. The iteration ends
+`refresh.json` `status`: `running`, `no-change`, `updated`, `held-by-cap`, `partial` (a capped search with nothing to update: "partial — not reached: …", never "no change"), `failed`, `cancelled`. The iteration ends
`done` whatever the refresh's status; only a failed revision or a cancel fails it.
## The daily check and its cards
diff --git a/umtool/docs/triage.md b/umtool/docs/triage.md
@@ -1,11 +1,10 @@
# Triage first
-A recurring report can run a cheap pass before its sweep. The pass flags what is
-worth researching. Only what it flags reaches the better model with tools.
-Release R6 of the umtool redesign; the plan is `plans/umtool-redesign.md`, "R6".
-
## Where it runs
+A cheap pass before a recurring report's sweep flags what is worth researching; only what it flags reaches the better
+model with tools (`plans/umtool-redesign.md`, "R6", "R6.1").
+
| Shape | What a tick does |
|---|---|
| **Watch** | Fetch, then triage what is new in scope. At or above the threshold, an API sweep of the flagged recordings, as a new article `<watch>-<date>`. Below it, nothing: the tick ends with its triage log, $0 API. |
@@ -26,6 +25,49 @@ topics and the threshold there.
The default threshold is one strong flag, or three flags of any strength.
+## Tier 0's listing and what is seen
+
+- **The listing is the whole scope, by id**, from each channel's transcripts manifest (uncapped; the summaries index
+ dates the rows) — on a first run too, where new is by upload date (`date >= since`). The terms query is bounded to
+ the new ids (`enumerate_matches` `ids`).
+- **Seen means judge-able.** A listed recording with no transcript yet (synced, not transcribed; a deleted upload with
+ metadata only) is neither new nor seen: the run after its transcript lands counts it new, and it is a candidate if it
+ matches. An id stored while it had no text is dropped on the next complete run. The log's first line says it:
+ "tier 0: 23,290 listed · 96 without a transcript yet (not seen; new once transcribed)"; the triage page counts them
+ under Tier 0.
+
+## Partial runs
+
+Tier 0 is **partial** when its listing could not read the whole scope: a cap, a channel not reached, a manifest that
+does not read, a record no page dates. Never a silent zero:
+
+- The run's summary starts "partial (not reached: …) ·"; the triage page marks tier 0 partial, the series page the run.
+- **A partial run keeps no seen set.** The last complete run's `seen.json` stands; with none, the next run counts new
+ from its `since`.
+- Below the threshold, the tick ends **`partial`**, never quiet: a **tick-partial** card (Your call, **See what was
+ missed**), "partial — not reached: …; nothing flagged in what was read (…)". A series records no quiet edition, so the
+ next tick covers the window. At or above the threshold it still escalates, with a warning on the tick.
+- A capped window check (a series without triage) and a capped refresh search end `partial` the same way.
+
+## The fetch under a hold
+
+A tick's fetch asks whether transcription is held now (the worker pool's live state: paused, or no worker enabled).
+Held, `transcribe-bucket` is skipped — "transcription is paused (…) — N recordings wait; a later run reads them once
+transcribed" — and that is a warning on the tick. A cancelled step is a warning; "nothing new to transcribe" is
+routine, never one.
+
+## Recovering a bad run
+
+```sh
+pnpm ops report-schedule --json '{"action":"reset-triage","id":"<schedule>"}' # the plan
+pnpm ops report-schedule --json '{"action":"reset-triage","id":"<schedule>","k":3,"confirm":true}' # from run 3 on
+```
+
+The plan names the triage runs it discards (from run `k` on; all by default), `seen.json` when those runs fed it (the
+next run counts new from its `since`), and the quiet editions they recorded (the next tick covers their windows
+again). The schedule, its cadence, its tick log and every edition article stay. Refused while a tick runs, and when
+there is nothing to discard.
+
## What you see
- **`/series/<id>`** — a watch's **Found** list (each escalation's article and
diff --git a/umtool/e2e/board.spec.ts b/umtool/e2e/board.spec.ts
@@ -50,6 +50,16 @@ async function holdNext(page: Page, method: string, part: string) {
return { seen, release, done: () => page.unroute(pattern, handler) };
}
+/**
+ * Open a board and wait until its keys are live (hydrated, every listener
+ * attached: `data-board-keys="ready"`). Before that a key is the browser's:
+ * the slips are server-drawn, but nothing on the page listens yet.
+ */
+async function openBoard(page: Page, id: string) {
+ await page.goto(researchCaseHref(id));
+ await expect(page.locator('[data-board-keys="ready"]')).toHaveCount(1);
+}
+
async function searched(page: Page) {
await page.goto(researchHref({ q: RESEARCH_PHRASE }));
await expect(page.locator("[data-honest]")).toBeVisible({ timeout: 30_000 });
@@ -125,7 +135,7 @@ test("pin from the results with p (a new case, named on the way) and from the re
});
test("sections and order: a, alt+j/k across sections, the section menu; claim, note and speaker saved", async ({ page }) => {
- await page.goto(researchCaseHref("lighthouse-case"));
+ await openBoard(page, "lighthouse-case");
const b = board(page);
await expect(b.locator("[data-quote]")).toHaveCount(3);
await page.locator("body").click();
@@ -197,7 +207,7 @@ test("sections and order: a, alt+j/k across sections, the section menu; claim, n
// fields the answer replaces. On the board as test 102 left it: Unsorted q3,
// q1; The keeper q2; Approval.
test("keys pressed while a write is held wait for it, then act on the settled board", async ({ page }) => {
- await page.goto(researchCaseHref("lighthouse-case"));
+ await openBoard(page, "lighthouse-case");
const b = board(page);
await expect(b.locator("[data-quote]")).toHaveCount(3);
const busy = page.locator("[data-board-busy]");
@@ -311,6 +321,97 @@ test("keys pressed while a write is held wait for it, then act on the settled bo
expect(order()).toBe("q3 q1");
});
+// THE REDRAW GAPS (race 3, after R6.1). A write's answer is applied before it
+// is drawn (React commits it in a later task), and the commit's passive effects
+// -- the moved line's refocus, the remounted list's light and j/k listener --
+// run later still. A key landing in either gap acted on a list or a focus about
+// to change: `e` focused the claim, then the deferred refocus put the focus
+// back on the line, and the claim typed next went nowhere (or ran as board
+// commands). Under load the gaps are wide; here each is hit for certain, from
+// inside the page (spec-only hooks):
+// answer the page's Response.json is wrapped: `e` is dispatched 50
+// microtasks after the held move's answer is read -- after the write,
+// before any task, so before the commit;
+// commit a MutationObserver sees the remounted list arrive: `e` is
+// dispatched in its callback -- after the commit, before the passive
+// effects' task.
+// Each time the key (`e`, then `n`) must wait, then focus its field, and what
+// is typed next must be saved whole.
+async function gapRound(page: Page, hook: "answer" | "commit", key: "e" | "n", text: string, dir: "Alt+j" | "Alt+k") {
+ const h = await holdNext(page, "PATCH", "/cases/lighthouse-case");
+ await page.keyboard.press(dir);
+ await h.seen;
+ await page.evaluate(([hook, key]) => {
+ const w = window as unknown as { __gap?: string };
+ const send = () => {
+ const el = (document.activeElement as HTMLElement | null) ?? document.body;
+ el.dispatchEvent(new KeyboardEvent("keydown", { key, code: `Key${key.toUpperCase()}`, bubbles: true, cancelable: true }));
+ w.__gap = "sent";
+ };
+ w.__gap = "armed";
+ if (hook === "answer") {
+ const json = Response.prototype.json;
+ Response.prototype.json = function (this: Response) {
+ const p = json.call(this);
+ if (w.__gap === "armed" && this.url.endsWith("/api/research/cases/lighthouse-case")) {
+ w.__gap = "answered";
+ Response.prototype.json = json;
+ void p.then(async () => {
+ for (let i = 0; i < 50; i++) await null;
+ send();
+ });
+ }
+ return p;
+ };
+ } else {
+ const root = document.querySelector("[data-board-keys]")!;
+ const mo = new MutationObserver((records) => {
+ const remounted = records.some((r) => [...r.addedNodes].some((n) => n instanceof HTMLElement && n.matches("[data-lit-list]")));
+ if (!remounted) return;
+ mo.disconnect();
+ send();
+ });
+ mo.observe(root, { childList: true, subtree: true });
+ }
+ }, [hook, key] as const);
+ h.release();
+ await page.waitForFunction(() => (window as unknown as { __gap?: string }).__gap === "sent");
+ await page.keyboard.type(text);
+ await page.keyboard.press("Enter");
+ await expect(page.locator("[data-board-busy]")).toHaveCount(0);
+ await h.done();
+}
+
+test("a key in the gap between a write's answer and its redraw, or its redraw and its effects, waits for both", async ({ page }) => {
+ await openBoard(page, "lighthouse-case");
+ const b = board(page);
+ await expect(b.locator("[data-quote]")).toHaveCount(3);
+ const quote = (id: string) => caseJson("lighthouse-case").quotes.find((q: { id: string }) => q.id === id);
+ const order = () =>
+ caseJson("lighthouse-case")
+ .quotes.filter((q: { section: string | null }) => q.section === null)
+ .map((q: { id: string }) => q.id)
+ .join(" ");
+ await expect.poll(order).toBe("q3 q1");
+ await b.locator('[data-quote="q3"]').click({ position: { x: 8, y: 8 } });
+ await expect(litId(page)).toHaveAttribute("data-lit-id", "q:q3");
+
+ await gapRound(page, "answer", "e", "Recorded in the gap", "Alt+j");
+ await expect.poll(() => quote("q3").claim).toBe("Recorded in the gap");
+ expect(order()).toBe("q1 q3");
+ await expect(litId(page)).toBeFocused();
+
+ await gapRound(page, "commit", "n", "Noted after the redraw", "Alt+k");
+ await expect.poll(() => quote("q3").note).toBe("Noted after the redraw");
+ expect(quote("q3").claim).toBe("Recorded in the gap");
+ expect(order()).toBe("q3 q1");
+ expect(caseJson("lighthouse-case").title).toBe("Lighthouse case");
+ await expect(page.locator("dialog[open]")).toHaveCount(0);
+
+ // Back as the tests below expect it.
+ expect((await page.request.patch("/api/research/cases/lighthouse-case/quotes/q3", { data: { claim: "", note: "" } })).ok()).toBe(true);
+});
+
test("the export: cited markdown in the house format, copied and downloadable", async ({ page, context, request }) => {
const md = await (await request.get("/api/research/cases/lighthouse-case/export.md")).text();
const heads = md.split("\n").filter((l) => l.startsWith("#"));
@@ -325,7 +426,7 @@ test("the export: cited markdown in the house format, copied and downloadable",
expect(dl.headers()["content-disposition"]).toBe('attachment; filename="lighthouse-case.md"');
await context.grantPermissions(["clipboard-read", "clipboard-write"]);
- await page.goto(researchCaseHref("lighthouse-case"));
+ await openBoard(page, "lighthouse-case");
await expect(board(page).locator("[data-quote]")).toHaveCount(3);
await page.locator("body").click();
await page.keyboard.press("c");
@@ -334,7 +435,7 @@ test("the export: cited markdown in the house format, copied and downloadable",
});
test("hand-offs: an article's plan (the model and cap, a seeded sweep) and a video's (the cue spans); local-only refused", async ({ page, request }) => {
- await page.goto(researchCaseHref("lighthouse-case"));
+ await openBoard(page, "lighthouse-case");
await page.getByRole("button", { name: "Draft an article from this board" }).click();
const art = page.locator('dialog[data-handoff="article"]');
await expect(art).toContainText("lighthouse-case");
@@ -369,7 +470,7 @@ test("hand-offs: an article's plan (the model and cap, a seeded sweep) and a vid
});
test("re-verify: the drifted quote shows the old and the new words, en vs en-orig is flagged, and nothing changes by itself", async ({ page }) => {
- await page.goto(researchCaseHref(BOARD_CASE));
+ await openBoard(page, BOARD_CASE);
const b = board(page);
await expect(b.locator("[data-quote]")).toHaveCount(3);
await page.locator("body").click();
@@ -398,7 +499,7 @@ test("re-verify: the drifted quote shows the old and the new words, en vs en-ori
test("the board fits 1366×768: the side panel and the first quote are on screen, the page does not scroll sideways", async ({ page }) => {
await page.setViewportSize({ width: 1366, height: 768 });
- await page.goto(researchCaseHref("lighthouse-case"));
+ await openBoard(page, "lighthouse-case");
await expect(page.getByRole("button", { name: "Draft an article from this board" })).toBeInViewport();
await expect(board(page).locator("[data-quote]").first()).toBeInViewport();
expect(await page.evaluate(() => document.documentElement.scrollWidth <= window.innerWidth)).toBe(true);