From 3b6e8366fbaadc0ee45ebef9474ffb99c5a726c5 Mon Sep 17 00:00:00 2001 From: Prateek Chaplot Date: Mon, 23 Nov 2026 18:03:51 +0530 Subject: [PATCH] chore(integration): record live-mode, settings, and eviction verification --- docs/TASKS.md | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/docs/TASKS.md b/docs/TASKS.md index 56a9e09..0b5d216 100644 --- a/docs/TASKS.md +++ b/docs/TASKS.md @@ -34,7 +34,7 @@ Statuses: done (PR merged) · doing (branch open, pending review) · remaining | ID | Task | Branch | Verification | Status | |---|---|---|---|---| -| _(empty)_ | | | | | +| T4.1 | Live wiring + eviction + settings persistence | `arch/tts/t4.1` | 36/36 live browser checks on the built bundle **and** behind the Vite dev proxy (voice list + preview, SSE progress → succeeded, playback/highlight/seek, three §9.2-named downloads, history restore/delete, `putSettings` on blur persisted across reload); 25 live generations at limit 20 → 20 rows + 20 WAVs, five oldest ids 404, no `.part`; 93 Vitest; ESLint; `tsc --noEmit`; Prettier (CRLF); live build; 196 pytest unit + 16 integration | pending PR review | ## Remaining @@ -56,9 +56,10 @@ _All P3 tasks done._ ### P4 — Integration +_T4.1 in progress — see Doing._ + | ID | Task | Files | Deps | Acceptance criteria (summary) | |---|---|---|---|---| -| T4.1 | Live wiring + eviction + settings persistence | `frontend/src/api/index.ts`, `frontend/src/state/appContext.tsx`, `src/tts/history/dal.py` | P2, P3 | Live browser flow, persisted settings, bounded history eviction | | T4.2 | Accessibility + error-copy pass | `frontend/src/components/`, `frontend/src/strings.ts` | T3.1–T3.3 | Keyboard-only workflow manually verified and recorded | | T4.3 | Observability polish | `src/tts/config.py`, `src/tts/jobs/manager.py` | P2 | Failure reason logged without full input text | @@ -136,3 +137,10 @@ _All P3 tasks done._ - T3.3 testability: without jsdom, row rules live in exported pure helpers (`canRestore`, `canDelete`, `historyStatusText`, `historyPreview`, `formatHistoryTime`, `historyStartsOpen`) and the presentational `HistoryList` is rendered with `renderToStaticMarkup`. Interactive behavior was verified in mock mode with a temporary headless-Chromium Playwright script (removed after the run, not committed). - T3.3 shared-file note: `App.tsx` and `styles.css` are not assigned to T3.3 but received additive edits — T3.1/T3.2 left the history placeholder for this task, so `App.tsx` now renders `HistoryPanel`, and `styles.css` gained history/disclosure rules. `contracts.ts`, `appContext.tsx`, `api/*`, and the mock were untouched (all needed actions and methods already existed). - T3.3 frozen downstream (T5.1 AC13 spec): rows use classes `.history-item`, `.history-preview`, `.history-meta`, `.history-actions`; controls carry `aria-label="Open generation: "` and `aria-label="Delete generation: "`; the count line is `N saved generation(s)` and the empty state reads "Nothing here yet. Generate audio and it will appear in this list." +- T4.1 decisions: **no production code change was needed.** The default API mode was already `live` (`frontend/src/api/index.ts` resolves `mock` only for `VITE_API_MODE=mock`, and no `.env*` or script sets it), `putSettings` on control blur has existed since T3.1, and eviction already bounds rows at `TTS_HISTORY_LIMIT` with file removal (T1.5/T1.6). Live runs confirmed all three, so this task's deliverable is the verification record instead of edits to its owned files; `api/index.ts`, `state/appContext.tsx`, and `history/dal.py` are untouched. +- T4.1 live verification: one temporary headless-Chromium script (removed after the run, not committed) drove **36 checks twice** — once against the built bundle served by `tts` from `frontend/dist`, once through the Vite dev proxy (`npx vite --port 5173`, `/api` → 8321) per §14.5 integration point 3. Both runs passed 36/36: no mock badge, `en_US-lessac-medium` listed and selected, preview WAV 200, SSE statuses `Queued → Generating 0/3 … 3/3 → Audio ready.` (so R6 proxy buffering was not observed), blob audio 4.1–4.2 s with 12 words/3 cues, playback advance + single-word highlight following (`Hello → world. → live → check. → Numbers → like`), cue-click and ±5 s seek, WAV/SRT/VTT downloads all named `hello-world-this-is-a-live_.{wav,srt,vtt}` with RIFF/SRT/WEBVTT content, history list → restore → delete → empty state, and rate/volume changes persisted on blur and survived a reload. No console or page errors. +- T4.1 eviction: 25 sequential live generations (default limit 20) took 6.8 s; afterwards `GET /api/generations?limit=100` reported `total=20` with 20 items, the five oldest ids answered 404 (the newest answered 200), `.venv/tts-data/generations` held exactly 20 `.wav` files and no `.part` files, and the oldest five audio files were gone — the AC's "25th generation evicts the 1st" holds (eviction runs per insert, so the overshoot never exceeds one row). +- T4.1 settings: keyboard-driven slider changes (rate 1.5, volume 0.85) persisted through `PUT /api/settings` on blur and reloaded from the server (`GET /api/settings` after reload returned the same values), which closes T3.1's "live persistence unverified" note. Persistence is server-side (`app_settings` in `library.db`), not `localStorage`, so it survives a server restart by construction. +- T4.1 mock parity decision (closes T1.4's follow-up): the mock stays as shipped. `mock.ts:buildCues` has no sentence grouping, no 1 200 ms floor, and no audio-duration cap, and its in-memory history is unbounded. Both are accepted **mock-only simplifications** and are recorded here instead of mirrored, because the mock is a P3 scaffold that only runs under `VITE_API_MODE=mock` and `mock.ts` is not one of T4.1's owned files; live behavior (`tts.subtitles.cues`, DAL eviction) is the binding contract. +- T4.1 observation for T5.2 (`KNOWN_LIMITATIONS.md`): words whose phonemes do not reconcile become zero-width `aligned=false` entries, so the highlight is empty while they are spoken — the fixture sentence "Hello world. This is a live check. Numbers like 42 stay honest." produced 2 unaligned words (`This`, `a`) and a highlight gap between `world.` and `is`. This is the FR-05 honest-degradation path (and the words render `.unaligned`), but it is visible to users and should be documented rather than debugged. +- T4.1 environment: this checkout was bare at task start (no `gh`, `.venv`, `frontend/node_modules`, Playwright browsers, or Piper voice); setup was re-run and the voice copied into an isolated `TTS_DATA_DIR=.venv\tts-data` so neither the live run nor the eviction check touched `%LOCALAPPDATA%\tts`. On Windows the Vite dev server binds `localhost` (IPv6) rather than `127.0.0.1`, and `npm run dev -- --port 5173` misparses the port as Vite's root, so the proxy check used `npx vite --port 5173` and `http://localhost:5173`. Prettier's CRLF check also needs the equals form on npm 11: `npx prettier --check . --end-of-line=crlf` (the T2.3 form `npm run format:check -- --end-of-line crlf` now fails with "No files matching the pattern were found: crlf").