From 0e7ea82da697821b9ccd981b73770607ecb83e14 Mon Sep 17 00:00:00 2001 From: jonathan Date: Wed, 29 Jul 2026 21:15:49 +0200 Subject: [PATCH] =?UTF-8?q?refactor:=20de-duplicate=20webui.html=20?= =?UTF-8?q?=E2=80=94=20shared=20ranking=20step,=20one=20param=20reader,=20?= =?UTF-8?q?one=20day-arm?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit No behaviour change. Targeted extractions only: the globals-heavy state machine is left alone deliberately, since its interactions encode screen-reader semantics with no JS test harness to catch a regression. * The U/I loudness walk was implemented twice — once in stepClip's by-score branch, once in the keydown handler's in-player branch — including the anchor resolution, the bounds check and both boundary announcements. Extracted nextInOrder(order, pos, dir, jump). Verified behaviourally identical to both originals by exhaustive comparison over every (length, cursor, direction, shift) combination. * The five coupled globals that arm a day's queue were set in two places (fresh build, re-open of a kept panel). Now armDayQueue(). * The three analysis inputs were read in three places, two of them with hardcoded fallbacks '12'/'2'/'0.5' — duplicating web.py's constants and the value= attributes, so the same three numbers lived in four client-side places. analysisParams() is now the only reader and the fallbacks are gone: an empty input sends an empty param, which _qs_float() resolves to the server default. hlParams() is its values joined. * recMap (idx -> filename) duplicated allFiles; dropped, with fileNameByIdx() for the one label that needed it. pollStatus iterates allFiles and lets a missing badge element mark an unrendered row. * analyse()'s btn is optional, so autoloadDayAnalyses stops fabricating a detached button just to have something to disable; the error path still produces a retry button either way. * Unused dayId parameter on _attachFileRowHandlers; stale "waveform" CSS comment; vestigial .chip / button.chip split (all chips are buttons). Verified: getElementById cross-check against declared and dynamic ids (no unresolved), page serves and parses with every required id present, pytest 78 passed. Co-Authored-By: Claude Opus 5 --- CLAUDE.md | 6 +-- webui.html | 143 ++++++++++++++++++++++++++++++----------------------- 2 files changed, 85 insertions(+), 64 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 63e1455..b981d68 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -38,10 +38,10 @@ Dependencies: `requests` (streams), `numpy` + `soundfile` (FLAC output and FLAC - Serving: `_stream()` (Range support), `_copy_to_response()`, `_safe_path()` (path traversal guard). `webui.html` (one `