fix(webapp): the final review's three page findings

- The arrow keys reached the legacy per-index waveform route in serial mode,
  even with no list loaded (an unlocked MiniMate chain walk + 5A on the same
  modem session).  perIndexLive() is now the one rule for the per-index
  buttons, the chips and the keyboard: live only for a list loaded without a
  serial that has events.
- A failed reconnect left the previous unit's confirmation live (badge,
  Diagnostics incl. the unguarded blind/slow-drip stops, call-home read).
  connectUnit() now drops it before it identifies; only this answer confirms.
- Unit strings reached innerHTML: the Device tab's cards (active_setup, new in
  1c) and its compliance/project tables now render as text, and Diagnostics'
  error spans go through escapeHtml().
- CLAUDE.md: the ring-path Runs A/B are a merge gate (the spec's prerequisite
  to a webapp sending serial), not only a use-time one.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
This commit is contained in:
serversdownandClaude Opus 5.5 committed 2026-10-29 12:16:49 -04:00
1 parent 073284fc88
commit 9082236c5e
3 files changed
+42 -9

No files matched your search

+14 -1
View File
@@ -24,7 +24,7 @@ PAGE = Path(__file__).resolve().parent.parent / "sfm" / "sfm_webapp.html"
NODE = shutil.which("node")
pytestmark = pytest.mark.skipif(NODE is None, reason="node is not installed; the page-logic tests need it")
EXPORTS = ["seriesFromSerial", "unitQuery", "deviceUrl", "confirmedSeries", "controlsFor", "eventView", "settingsRows",
EXPORTS = ["seriesFromSerial", "unitQuery", "deviceUrl", "confirmedSeries", "controlsFor", "eventView", "settingsRows", "perIndexLive", "escapeHtml",
"changeSummary", "downloadSummary"]
@@ -220,3 +220,16 @@ def test_settings_rows_show_unit_settings_with_a_dash_for_null():
assert b == [["Setup Name", "—"], ["Record Mode", "—"], ["Sample Rate", "—"], ["Record Time", "—"],
["Histogram Interval", "—"], ["Geo Trigger", "—"], ["Notes", "—"]]
assert c[4] == ["Histogram Interval", "15 s"]
def test_the_per_index_routes_follow_the_list_not_the_keyboard():
# the legacy per-index routes (Load / Save / Download / arrow keys) are live
# only for a list loaded without a serial that has events
r = run(["perIndexLive", [{"bySerial": False, "count": 2}]], ["perIndexLive", [{"bySerial": True, "count": 2}]],
["perIndexLive", [{"bySerial": False, "count": 0}]], ["perIndexLive", [{"bySerial": True, "count": 0}]])
assert r == [True, False, False, False]
def test_escape_html_makes_a_unit_string_inert():
r = run(["escapeHtml", ['Bench <b id="x">&\'']], ["escapeHtml", [None]], ["escapeHtml", [42]])
assert r == ["Bench &lt;b id=&quot;x&quot;&gt;&amp;&#39;", "", "42"]