chore(web): extract App.tsx's leaf hooks (#2128)

Phase 1 of #2126. Six hooks move out of `clients/web/src/App.tsx`, taking
its component body from 4,891 to 4,267 lines with no behavior change:

- useThemeToggle       — the light/dark toggle
- useTabUiState        — the nine per-screen `ui` objects, the active tab,
                         the pinned-Protocol ids, and the session reset
- useInspectorStores   — the twelve state managers as one create/destroy
                         lifecycle, their `core/react` hooks, and the
                         pagination-mode selection
- useExportActions     — the eleven Clear / Export / Replay handlers
- useProgressToasts    — `notifications/progress` toasts
- useTaskToasts        — task-status toasts, the cancel confirmation, the
                         taskId -> progress map, and the in-flight
                         tool-call taskId ref

Holding the stores in one slot collapses `setupClientForServer`'s and
`onConfirmRemove`'s dependency arrays from twelve entries to two stable
callbacks; `destroyStores` reads the live set through a ref mirror rather
than the state it also writes.

All six hooks are at 100% on all four coverage dimensions, no `v8 ignore`
needed. Also refreshes the now-stale "~4.5k-line" description of App.tsx
in AGENTS.md and the coverage `include` comment.

Signed-off-by: cliffhall <cliff@futurescale.com>
This commit is contained in:
cliffhall 2026-08-26 19:42:16 -04:00
commit e42968ba78

View file

@ -189,7 +189,7 @@ export default defineConfig(({ command }) => {
reporter: ["text", "html", "json-summary"],
// Whitelist of gated directories. Deliberate top-level-file omissions
// (every src *directory* below is gated):
// • `src/App.tsx` — a ~4.5k-line composition root at ~42% branch
// • `src/App.tsx` — a ~4.3k-line composition root at ~42% branch
// coverage; gating it is a dedicated testing/decomposition effort,
// not a whitelist tweak.
// • `src/main.tsx` / `src/index.ts` — the browser and bin bootstraps