feat(webapp): name a unit by serial; series badge from the unit's own answer; Hang up for Series 4

- A Serial field beside host/port.  With one, the Live tabs use the serial-based
  endpoints (both series); without, every read behaves as before.
- The series badge, Hang up (Series 4), Diagnostics (Series 3), call-home read and
  the disabled config/call-home writes all follow applyControls() <- controlsFor()
  on the unit's own /device/info answer; editing the serial, host or port drops
  the confirmation.  Erase additionally needs a confirmed Series 3.
- Every /device/ request goes through deviceRequest/deviceFetch <- deviceUrl
  (a static test enforces it); the legacy per-event routes joined deviceUrl
  (event_waveform / event_file, index in the path).
- The status panel and Device tab read both shapes (shared and legacy).
- In serial mode the connect skips the legacy storage_range read (one connection
  fewer; a Micromate has no such route).  Start/stop without a serial behave as
  before; with one, only for a confirmed series.

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 11:50:24 -04:00
1 parent e3717706f8
commit 44d6e754bd
2 files changed
+166 -73

No files matched your search

+19
View File
@@ -169,3 +169,22 @@ def test_the_page_scripts_parse_together(tmp_path):
js.write_text("\n;\n".join(scripts))
r = subprocess.run([NODE, "--check", str(js)], capture_output=True, text=True, timeout=30)
assert r.returncode == 0, r.stderr
def test_every_device_url_is_built_by_deviceUrl():
"""One place builds /device/ URLs, so the series rules cannot be bypassed:
outside the device-routing block the page holds no hand-built device path."""
src = PAGE.read_text()
outside = re.sub(r"/\* <device-routing> \*/.*?/\* </device-routing> \*/", "", src, flags=re.S)
hand_built = [m.group(0) for m in re.finditer(r"(`\$\{api\(\)\}/device/[^`]*`|'/device/[^']*'|\"/device/[^\"]*\")", outside)]
assert hand_built == [], hand_built
def test_device_url_puts_an_event_index_in_the_path():
# the legacy per-event routes carry the index in the path, not the query
r = run(["deviceUrl", ["event_waveform", BLANK, {"index": 3}]],
["deviceUrl", ["event_file", S3, {"index": 0}]],
["deviceUrl", ["event_file", S3]])
assert r[0] == {"method": "GET", "path": "/device/event/3/waveform?host=h&tcp_port=9034"}
assert r[1] == {"method": "GET", "path": "/device/event/0/blastware_file?serial=BE9441&host=h&tcp_port=9034"}
assert "throws" in r[2]