fix(sfm): page polish from the 1c bench -- #6, #10, #12, #16 (Batch 2)

- #6 Config tab by serial: the empty legacy edit form stays hidden (settings
  are read-only until phase 5); the settings box shows from the start, 'Not read
  yet', and a different unit's settings are never left on screen.
- #10 A start/stop that went out but was not confirmed is no longer called
  'failed'.  The route now adds 'sent' (acknowledged / unknown) and 'audit_id'
  to a ChangeUnconfirmed -- same status, same message -- and the page says
  'Start monitoring not confirmed: <what happened, audit record>'.
- #12 Device tab by serial: the empty legacy Compliance/Project tables are
  hidden behind a pointer to the Config tab; a Micromate's Firmware card reads
  'Thor line (version not read)' (its version string is in 0x01, undecoded).
- #16 A 504 with nothing sent adds: the connection opened, so the modem is
  reachable -- another program (THOR or Blastware) may be holding the line, or
  the unit is busy.  Measured 2026-10-29: THOR polling leaves SFM a 0-byte 504.

New logic lives in sfm/static/device_routing.js (firmwareLabel,
deviceErrorText, changeErrorText, serialPanes) under Node tests; the page glue
in sfm_webapp.js only applies them.  Checked in jsdom against the real page
(served at a fake origin, /static from disk): all four, legacy mode unchanged,
no script errors.

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-11-02 16:22:22 -05:00
1 parent 2b886c4f39
commit 8123d75d72
7 files changed
+163 -22

No files matched your search

+9 -4
View File
@@ -2,6 +2,8 @@
FastAPI Query() defaults are FieldInfo objects, not values."""
from __future__ import annotations
import json
import os
import sys
@@ -418,10 +420,13 @@ def test_a_change_unconfirmed_keeps_its_cause_status_and_names_the_audit_record(
"failed: silent -- audit record c7", audit_id="c7", sent="acknowledged",
http_status=504)
monkeypatch.setattr(srv, "_device_access_instance", Raises())
with pytest.raises(HTTPException) as e:
srv.device_monitor_start(**CH)
assert e.value.status_code == 504
assert "audit record c7" in e.value.detail
resp = srv.device_monitor_start(**CH)
assert resp.status_code == 504 # the cause's status, unchanged
body = json.loads(resp.body)
assert "audit record c7" in body["detail"]
# #10 (2026-11-02): the page tells "may have been sent" from "nothing sent" by
# these, not by matching the message.
assert (body["sent"], body["audit_id"]) == ("acknowledged", "c7")
def test_device_commands_normalises_the_serial(tmp_path, monkeypatch):