Commit Graph
833 Commits
Author SHA1 Message Date
serversdownandClaude Opus 5.5 e3a77e421d docs(spec,plan): phase 5 -- the units' own limits, from Instantel's manuals
Brian: use the actual unit limits, not what has been used in the past.
Trigger 0.005-10 in/s in 0.001 steps (capped by the range), record time
1-90 s (Micromate) or the MiniMate manual's 1 MB table by sample rate
(13 s in Histogram Combo), job number 1-9999.  The read-back reports any
value a unit does not take.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-03 19:30:07 -05:00
serversdownandClaude Opus 5.5 71609e71ab docs(plan): phase 5 -- changing a unit's settings by serial
Seven tasks: the Series 3 read assembly, one settings codec for both
series, the Micromate schedule read, each series' audited change, the
route (and the legacy write retired), and the page.  Spans measured
from 75,958 Blastware reports.  Bench after the final review, Brian's
go per send.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-03 18:51:53 -05:00
serversdownandClaude Opus 5.5 dba891d504 docs(spec): phase 5 -- the Micromate schedule check; work hours is next
A scheduled start loads the setup it names, so a change to another
setup would be undone at the next start: read schedule.dat and refuse
that case.  Configurable work-hours recording, without THOR's scheduler
or setup files, is the agreed next project.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-03 18:35:29 -05:00
serversdownandClaude Opus 5.5 0238e4d3f3 docs(spec): phase 5 -- changing a unit's settings by serial
Brian's intent (UM6047's trigger, notes typos, the backup unit), the
flow, the first-version fields, and what is measured: Series 3's
compliance block has Series 4's 0x1A layout; a whole 1A read assembles
to the 2,090 bytes Blastware writes back (exact on both 10-26 writes);
Blastware writes 00 00 at [26:28] and a per-unit constant after the
block.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-03 18:12:14 -05:00
serversdownandClaude Opus 5.5 cbce00f8e1 merge: dev into feat/series4-sfm-parity -- the decode checker's file-only fields (job number, codec by STRT[18], last-26-byte footer)
Brings be5bab4 and its history from the decode checker's branch: a Blastware
file's job number; decode_blastware_bytes choosing the codec by STRT[18] and the
histogram layout check by peak <= PVS <= sqrt(3) peak; the footer as the file's
last 26 bytes (no day-late histograms); docs (reference Appendix D.6, the
file-only status).

Conflicts, both kept whole:
- CLAUDE.md: this branch's 'Narrowed 2026-10-26' 5A block stays, followed by
  dev's 'Open, not blocking' line (the 8x sensitive-range item struck out --
  resolved by the file's range).
- docs/instantel_protocol_reference.md (CRLF, byte-safe): the change-log rows in
  date order -- dev's 2026-11-03 and 2026-11-02, this branch's 2026-11-03
  (call home), 2026-10-29 and 2026-10-27 (#46, this branch only).

Suite on the merged tree: 1399 passed, the 16 known failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-03 15:34:59 -05:00
serversdownandClaude Opus 5.5 2e1c2ba21f docs: phase 4 bench -- call-home on/off on both series, idle and monitoring
Benched 2026-11-03 on UM20147 and BE9441 (each on its own modem, one send per
go): idle, a no-op, off and on all acked, read back and confirmed on each unit's
menu; UM20147 accepts 0x00 at [5].  Monitoring, neither series takes a change: a
MiniMate answers 0x2C with its device-info block, a Micromate acks and ignores
('Feature disabled while monitoring').  Series 4 [118:120] is a function of the
block's content -- XOR 0x6D7D per bit-0 flip on two units, not a nonce.  A stop's
call-in reached THOR when the ring followed the ack.  UM20147's clock is an hour
ahead (DST).  Spec, both protocol references (Series III: a CRLF row), CLAUDE.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-03 15:32:51 -05:00
serversdownandClaude Opus 5.5 789e24be50 fix(sfm): the top bar names a Micromate's firmware line; a stale overlay comment
- The page's top bar Firmware read '—' for a Micromate: Batch 2 gave the Device
  tab's card firmwareLabel() but not populateDeviceBar.  Seen at the bench
  2026-11-03; checked in jsdom ('—' before, 'Thor line (version not read)' after).
- save_imported_bw's overlay comment said the waveform codec was undecoded and
  gave +-10 in/s; the overlay now stays because production keeps a paired
  Blastware report as the record until the file-only decode has no blanks
  (flagged by the decode-checker session).  Comment only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-03 15:32:02 -05:00
serversdownandClaude Opus 5.5 f35845d403 fix(sfm): a Micromate's call-home is refused while monitoring, and only a real call-home block is ever edited
Measured at the bench 2026-11-03 (UM20147): monitoring, a Micromate returns its
real call-home block and ACKS a call-home write, but does not apply it -- three
read-backs unchanged, and its own menu says 'Feature disabled while monitoring'.
SFM now refuses up front (UnitStateUnknown, 409: '... is monitoring -- a Micromate
ignores call-home changes while monitoring ...; stop monitoring first -- nothing
sent'), dry run included, instead of sending a write the unit ignores.

And the block must be the call-home block: micromate.writes.is_call_home_content
checks its header is its own length (00 7C, N = 124 -- 00 7C DC on every read,
UM12947 and UM20147).  plan_call_home_enabled refuses any other 126 bytes, the
change refuses before sending, and call_home_state says why (enabled = None).
At the bench this was checked by eye before the monitoring write.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-03 15:32:02 -05:00
serversdownandClaude Opus 5.5 5326e99ac2 fix(sfm): a monitoring MiniMate's call-home says 'stop monitoring first', not 'unknown(0x6E)'
Measured at the bench 2026-11-03 (BE9441): while monitoring, a MiniMate answers
the 0x2C call-home read with its DEVICE-INFO block ('Instantel', 'MiniMate Plus',
its serial) -- as it answers 1A -- and idle again, minutes later, the call-home
block.  SFM writes back only a block it just read, so a monitoring MiniMate's
call-home cannot be changed; the change core already refused (byte 5 read as
'unknown(0x6E)', nothing sent), but said so cryptically.

- minimateplus.protocol.is_call_home_block(raw): the block starts with its own
  length 0x7C and is N (or N + 2) bytes unescaped; the device-info block fails it.
- The Series-3 change raises UnitStateUnknown (409) with 'did not return its
  call-home settings -- a MiniMate answers the call-home read with its
  device-info block while monitoring; stop monitoring first ... nothing sent',
  for a dry run too.  call_home_state returns enabled = None with that reason.
- The page's callHomeRows shows the reason in place of 'Unknown (byte 5 = ...)'.

A blind write while monitoring stays untested on purpose.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-03 14:19:19 -05:00
serversdownandClaude Opus 5.5 be5bab4787 docs(changelog): Unreleased -- where file-only decoding stands
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-03 13:06:19 -05:00
serversdownandClaude Opus 5.5 fc7ce5df02 merge: where file-only decoding stands, and that prod's ASCII overlay is scaffolding
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-03 13:06:07 -05:00
serversdownandClaude Opus 5.5 5a089671e8 docs: where file-only decoding stands, and that prod's ASCII overlay is scaffolding
CLAUDE.md 'Where things stand' now says plainly how prod uses a paired
Blastware ASCII report (save_imported_bw overlays its peaks, notes,
sample rate and record time onto SFM's decode), that only report-less
events run on the decoder alone, and that the overlay is scaffolding to
retire at step 3 of the plan.  The checker status is brought up to dev:
18 of 88 fields, the remaining groups A-F in the proposed order.

README roadmap: the same framing and progress.

Protocol reference:
- D.3.3: the footer is the file's last 26 bytes; footer[18:24] is not
  fixed (retracted).
- D.6.1: STRT[18] picks the codec.
- D.6.3: the job number.
- D.6.5: the PVS^2 high word is non-zero above 1.28 in/s (retracted
  'reads 0000'); the peak/PVS consistency check; Blastware's Number of
  Intervals is the monitoring time / the interval.
- D.6.7: refreshed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-03 13:05:58 -05:00
serversdownandClaude Opus 5.5 fcacc8f28c docs(changelog): Unreleased -- the footer is the file's last 26 bytes
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-03 13:04:13 -05:00
serversdownandClaude Opus 5.5 e227448483 merge: a Blastware file's footer is its last 26 bytes -- no more day-late histograms
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-03 13:03:29 -05:00
serversdownandClaude Opus 5.5 e1e8a851c8 docs: where the 1995 default-clock events come from
Brian's account: units come back from calibration with the internal
battery unplugged, so a comms-test trigger before the date is set
carries the default.  DL2 holds 17 such events on 6 units, all within
1995-09-01 12:02 .. 09-03 11:24.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-03 12:12:02 -05:00
serversdownandClaude Opus 5.5 8a40eb638a fix(decode): a Blastware file's footer is its last 26 bytes -- no more day-late histograms
Every DL2 file ends in a valid footer: 0e 08 and two valid times on
70,041 / 70,041.  The decoder took the first '0e 08 + plausible year'
instead, and 14 files also hold an earlier record, ~1.1 KB before the
end, with the stop time followed by zeros:
- a histogram started at its own stop -- a day late on BE9558's daily
  histograms (K558L9XP.FK0H: 2025-10-08 19:10:01 for Blastware's
  2025-10-07 19:14:08); T003LCYV.JD0H got no time at all;
- a waveform lost its stop, so the trigger was never computed and the
  stop was stamped instead (K440I4LG.JK0W: 11:14:12 for 11:14:08).

The last 26 bytes are now taken when they are a footer; otherwise the
old search stands unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-03 12:10:44 -05:00
serversdownandClaude Opus 5.5 dd9f6dde7a docs(changelog): Unreleased -- histograms go to the histogram codec
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-03 11:32:57 -05:00
serversdownandClaude Opus 5.5 f768ec42f3 merge: histograms go to the histogram codec, and a loud interval no longer hides a short one
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-03 11:32:01 -05:00
serversdownandClaude Opus 5.5 9820a5389f docs(spec): phase 4's final review -- what it caught before the bench
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-02 17:24:13 -05:00
serversdownandClaude Opus 5.5 9e03b3f0ab fix(sfm): a Micromate in an unknown run state gets no call-home write, and a lost ack keeps its snapshot (phase-4 review)
- s4_change_call_home's read_state now returns an unknown(0xNN) run state as
  it is, so the change core refuses it (UnitStateUnknown, nothing sent), as
  start/stop already does; it checked only for calling_home.
- run_change records the snapshot on the lost-ack path too: after an ack is
  lost, what the unit now holds (and, on Series 4, whether [118:120] moved) is
  what tells whether the write landed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-02 17:23:59 -05:00
serversdownandClaude Opus 5.5 bdd76b8f74 fix(minimateplus): a built call-home image is framed once, never unescaped again (phase-4 review)
call_home_image returns the unescaped N + 2 image, but the send path handed it
to write_call_home_config, whose write_image unescapes again -- and unescaping
is not idempotent: a real 0x10 before 02/03/04 loses its 0x10.  A call-in time
of 16:02-16:04 (hour 0x10) is exactly that.  One such time made the send refuse
before the wire yet audited as 'sent, acknowledgement lost'; two made it send a
block shifted by two bytes from [101] (num_retries and the time fields wrong).
The Blastware-frame test could not see it: it checked the image builder, not
the bytes the protocol framed.

- MiniMateProtocol.write_call_home_image(image) frames a built image once
  (0x7E, ack 0x81, 0x7F, ack 0x80), raising ImageRefused before any byte when
  it is not a whole block; write_call_home_config (the legacy multi-field path)
  is write_image once + that.  Its stale 127-byte docstring is gone.
- MiniMateClient.write_call_home_image uses it.
- The Series-3 change passes is_refusal=ImageRefused, so a pre-wire refusal is
  audited as nothing sent (sent = 0), not as a lost ack.

Tests drive the real client -> protocol over a stub answering with BE11529's
recorded acks: the unit's own read, a 16:02 time, and 16:03 + 16:04 all go out
exactly as built; a short image is refused with nothing written.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-02 17:23:59 -05:00
serversdownandClaude Opus 5.5 3e1d42e04b docs: phase 4 built -- call-home enable/disable by serial; bench questions
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-02 17:07:36 -05:00
serversdownandClaude Opus 5.5 51e7dddcb3 test(micromate): corpus counts are floors, and 0x71 is the over-the-ceiling example
Two test-side breaks, found by the full suite after phase-4 task 6:
- test_micromate_framing's three whole-session tests pinned exact counts of a
  gitignored corpus (bridges/captures/9-24-26 - micromate2, a symlink into the
  main checkout).  The full copy of the BW VM's captures on 2026-11-02 added
  sessions: 287 responses / 241 reads / 287 requests, every one passing the same
  per-frame checks.  The counts are now floors (>= 251 / 218 / 251), so a lost
  file still fails and a grown corpus does not.
- test_micromate_opcodes' beyond-the-ceiling permit took 0x7E, enableable since
  the call-home commit (eeb55ef); 0x71 (the setup write, phase 5) replaces it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-02 17:07:04 -05:00
serversdownandClaude Opus 5.5 84c142f36c feat(sfm): the page's Call Home tab by serial -- state and audited On / Off (phase 4)
device_routing.js (Node-tested): call_home_state / call_home_on / call_home_off
routes (serial required); controlsFor gains callHomeChange (by serial, a
confirmed Series 3 or 4) and callHomeRead now covers a Series 4 by serial;
serialPanes gains callHomeForm / callHomeBox; callHomeRows renders the switch
(On / Off / 'Unknown (byte 5 = 0xNN)'), dial string and series;
changeErrorText takes the whole label ('Start monitoring', 'Enable call-home').

sfm_webapp.js: by serial the Call Home tab hides the legacy multi-field form
(Series 3 by host only) and shows the unit's switch with On / Off.  Each asks
confirm(), sends one audited change, reports it with changeSummary /
changeErrorText, then re-reads quietly so the change's own result stays on
screen.  A different unit's switch is never left showing.  The new buttons are
wired with addEventListener, not onclick= (no inline JS).

Checked in jsdom against the real page: placeholder, read, Off (confirm, the
disable route, 'confirmed -- enabled -> disabled'), a serial edit clearing it,
legacy mode unchanged, no script errors.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-02 17:05:00 -05:00
serversdownandClaude Opus 5.5 06fa56db09 feat(sfm): call-home state and enable/disable by serial -- GET /device/call_home/state, POST /device/call_home/{enable,disable} (phase 4)
- DeviceAccess.call_home_state (a read) and set_call_home (change=True: never
  retried, audit required for a live change, dry run without one), routed by
  series like start/stop.  A config write is read back on its own window: up
  to 3 reads, 1 s apart, not the monitoring one.
- Routes, serial required (422 without), all three serial-aware: the state as
  a dict; enable / disable through _change_response, so their statuses are
  start/stop's and an unconfirmed change carries sent + audit_id.  The legacy
  GET / POST /device/call_home are unchanged (a Micromate serial is still
  refused there, 501).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-02 17:01:14 -05:00
serversdownandClaude Opus 5.5 453d42e32a test(s3): SFM's call-home write equals Blastware's, frame for frame -- opens the live send
Ground truth: Blastware changing BE11529's call-home settings on 2026-04-20
(Remote Access -> Setup Unit), paired raw files of what it sent and what the
unit answered: the read, the enable (read 0x00 -> wrote 0x01), the disable
(read 0x01 -> wrote 0x00).  From the unit's own read before each write, SFM's
0x7E frame (call_home_image + build_bw_write_frame) is Blastware's byte for
byte -- nothing but byte 5 differs from the read -- and the 0x7F confirm too.
Mutation-checked: inverting the byte SFM writes fails the test.

S3_CALL_HOME_FRAME_VERIFIED is now True; the gate stays tested shut by
monkeypatch, and a test pins that its comment names this proof.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-02 16:59:15 -05:00
serversdownandClaude Opus 5.5 8612cd9df7 feat(sfm): Series-3 call-home state and audited enable/disable, live send gated until its frame is verified (phase 4)
- minimateplus.protocol: call_home_enabled(raw) reads byte 5 of the UNESCAPED
  0x2C payload (0x01 on / 0x00 off, measured 2026-04-20; anything else None --
  bench finding #1's lesson: an escaped byte before it would move the raw
  index); call_home_image(raw, enabled) is write_image's N + 2 image with byte 5
  set and everything else as read, refusing a byte 5 never measured.
- MiniMateClient.read_call_home_raw() / write_call_home_image(image) (0x7E then
  0x7F, each ack checked, never retried).
- Series3Adapter.call_home_state (wake, then 0x2C; no serial read, like status)
  and change_call_home: the shared change core with a connect() identity check,
  state 'enabled' / 'disabled' / 'unknown(0xNN)' (unknown sends nothing), the
  plan showing both exact frames, a snapshot of both unescaped images.
- S3_CALL_HOME_FRAME_VERIFIED = False: a live change is refused (501) before any
  connection until the frame is reproduced from Blastware's (next commit).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-02 16:57:55 -05:00
serversdownandClaude Opus 5.5 eeb55effe9 feat(sfm): Series-4 call-home state and audited enable/disable (phase 4)
- micromate: ENABLEABLE_WRITES gains 0x7E/0x7F (the call-home write and its
  confirm; spec row 9, enable/disable only); MicromateClient.get_call_home_content()
  returns the 126-byte 0x2C content.
- sfm/device_access: CallHomeState (serial, series, enabled, dial_string, detail
  with byte5 and the whole block); s4_call_home_state reads bit 0 of [5] and the
  dial string at [6:46]; s4_change_call_home runs the shared change core with
  micromate.writes.plan_call_home_enabled -- built from the read run_change made
  just before, and that same plan is the one sent.  A unit calling home (run
  state 0x03) is refused, nothing sent.  The read-back judges the edited bit
  only; the snapshot records both blocks and every changed offset -- [118:120]
  is unit-maintained and always moves.
- The write-ceiling tests take 0x71 (the setup write, phase 5) as their
  over-the-ceiling example now that 0x7E is enableable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-02 16:56:04 -05:00
serversdownandClaude Opus 5.5 1dd5bfa464 refactor(sfm): run_change takes a ChangeKind -- start/stop unchanged, call-home next (phase 4)
run_change named its change and its target state from a start/stop bool.  A
ChangeKind (action, want, became) now says what the change is called and which
state read back means it took; monitoring_change(start) gives exactly today's
names, call_home_change(enabled) the new ones.  An optional snapshot hook
records what the unit holds after the change in the result and the audit row
(never the verdict; one that raises is recorded as its error).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-02 16:53:48 -05:00
serversdownandClaude Opus 5.5 5b37ea22cc docs(plan): phase 4 -- call-home enable/disable by serial, both series
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-02 16:47:56 -05:00
serversdownandClaude Opus 5.5 2389b4c4f6 docs: the SFM page's JavaScript lives in sfm/static/ (CLAUDE.md layout)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-02 16:22:38 -05:00
serversdownandClaude Opus 5.5 8123d75d72 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
2026-11-02 16:22:22 -05:00
serversdownandClaude Opus 5.5 aec4a38473 fix(decode): histograms go to the histogram codec, and a loud interval no longer hides a short one
Three causes behind the histograms the checker found decoding wrongly:

1. The file decoder tried the waveform codec first, whatever the record
   type.  It accepted BE9440 / BE9557 / BE17354's 2018 5 s histograms and
   returned ~5x too many 'samples' (K440HDXX.XH0H: SFM 44,504, Blastware
   6,976).  The codec now follows STRT[18] (0x46 / 0x0A on 70,041 /
   70,041 DL2 files); only an unknown type falls back to trial order, and a
   chosen codec that fails is a decode problem rather than a silent switch.

2. The sub-minute layout check required each record's 'zero word' to be
   0000.  It is the high word of the interval's PVS squared, non-zero above
   1.28 in/s, so a one-block histogram with a loud interval was not
   recognised (T193KR5M.X90H, K440HA3C.JM0H, R352HFZ7.530H decoded to
   nothing).  The check is now the measured relation peak <= PVS <=
   sqrt(3) * peak, which holds on 34,502,955 / 34,502,955 DL2 sub-minute
   intervals.  The no-terminal-tail trim uses the same test.  Two test
   builders wrote PVS bytes no real record has (one still in the retracted
   little-endian layout); they now write peak^2 in the measured layout, and
   the retraction test keeps a legacy builder of its own.

3. Checker carve-out interval-count-is-duration: Blastware's Number of
   Intervals is (stop - start) / interval from the footer times, and its
   own interval table lists one block fewer when the unit never wrote the
   last minute.  SFM matches the table (T193KSWP.FF0H: 2,880 vs 2,850).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-02 16:20:32 -05:00
serversdownandClaude Opus 5.5 2b886c4f39 refactor(sfm): move the page's JavaScript out of sfm_webapp.html into sfm/static/ (no code change)
Stack-wide rule since 2026-11-02 (terra-view docs/tmi-stack.md, Terra-View's
rule 4): no inline JavaScript, because a test cannot load it.  This page's tests
had to regex their code out of the HTML.  Batch 2 edits both of the page's
scripts, so they come out first, verbatim:

- sfm/static/device_routing.js: the tested routing rules (157 lines)
- sfm/static/sfm_webapp.js: the rest of the page (2,274 lines)

The page loads them with <script src="static/..."> where the inline scripts
were, so load order and the onclick handlers are unchanged.  Verified: putting
the files back inside those tags reproduces the old sfm_webapp.html byte for
byte, and a jsdom page check (served at http://sfm.local/, /static from disk,
no network) gives identical output before and after.

The server serves sfm/static/ at /static/, with Cache-Control: no-cache so a
browser revalidates (a cheap 304) and a new SFM never runs a cached old
script.  Opened from disk, the page needs its static/ folder beside it.

Tests: the routing tests load the file instead of regexing the HTML; new
test_webapp_static pins no inline <script> in the page and the /static route
(through the whole app, middleware included).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-02 16:17:44 -05:00
serversdownandClaude Opus 5.5 99b6b315d6 docs(changelog): Unreleased -- the job number from the file
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-02 16:09:48 -05:00
serversdownandClaude Opus 5.5 fec59679e6 merge: a Blastware file's job number, and whether Blastware shows it
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-02 16:09:16 -05:00
serversdownandClaude Opus 5.5 7a58bad28d feat(decode): a Blastware file's job number, and whether Blastware shows it
The setup block has Series IV's 0x1A layout here too: report flags at
k - 9 (bit 0x02 = job number shown) and the number, uint16 BE, at k - 8,
kept while switched off.  The flag matches Blastware's JobNumber on
2,997 / 2,997 DL2 events that print one and 66,986 / 66,986 that don't.
Every printed value is 1 and matches; hidden ones hold real numbers
(802, 1012, 1013, 622), so the value is only proven for 1.

- ProjectInfo.job_number_enabled / job_number, named as in
  micromate.setup_block.
- write_event_hdf5 stores both as .h5 attrs when read (additive).
- The checker reports the number only when shown, and scores a number
  only SFM shows as a mismatch.  The old test that pinned JobNumber as
  sfm_blank now checks only the ZC cases it also covered.

Not carried into the DB, the API or the PDF report yet (needs a column).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-02 14:31:23 -05:00
serversdownandClaude Opus 5.5 15a27d5921 docs(changelog): Unreleased -- the file's pre-trigger is the event's
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-02 14:23:49 -05:00
serversdownandClaude Opus 5.5 a30cf47825 merge: the file's pre-trigger is the event's -- corrects today's #48 note
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-02 14:23:33 -05:00
serversdownandClaude Opus 5.5 5bed7d6c6f docs: the file's pre-trigger is the event's, not the setting -- corrects today's #48 note
The pre-trigger float in an event file's setup block varies from event
to event on the same unit, often on the same day (BE18193: -0.25 and
-0.248 on 2026-08-21; 253-256 samples at 1024 sps, -0.002 to -0.249 s
at 4096 sps), and Blastware reports the same per-event value as
Pre-triggerLength.  So it is the event's own pre-trigger, and the note
written earlier today overstated what the files say about #48: the live
1A holds the setting, so a missing anchor in a file says little about
whether the live read loses its anchor.  #48 stays open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-02 14:23:32 -05:00
serversdownandClaude Opus 5.5 55d74c0a7b docs(changelog): Unreleased -- the event-file fields in the protocol reference
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-02 14:04:10 -05:00
serversdownandClaude Opus 5.5 9c0b608c38 merge: the event-file fields in the protocol reference (Appendix D.6) and CLAUDE.md
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-02 14:03:58 -05:00
serversdownandClaude Opus 5.5 b6e726f850 docs: the event-file fields SFM reads from the file alone (reference Appendix D.6)
New Appendix D.6 records the bytes and DL2 verification for every field
SFM reads from a Blastware event file: record type STRT[18], the
recording-setup block (sample rate k-42, pre-trigger k-36, record time
k-30, the four notes), the geophone range (label+29), each histogram
interval's PVS^2, and the mic scale (0.25 Pa per count, dB offset
81.9384).  None of these were written down outside code and issues.

Retracted in place:
- D.3.1's STRT[20] = record time: it is 00 on 70,041 / 70,041 DL2 files.
- the 2026-08-26 reading of sub-minute histogram records as little-
  endian: big-endian from byte 5 since v0.32.0 (#47/#49), and the
  '2-word tail' is the PVS^2.  Also in CLAUDE.md.

Measured for #48 (files only): the 1A 'stable anchor' be 80 00 00 00 00
is the setup's pre-trigger -0.25 s plus 00 00.  It is present only on
the 3,886 / 6,541 DL2 waveforms recorded at exactly -0.25 s, and on no
histogram.  The live 1A read is still unmeasured.

CLAUDE.md: Where things stand reflects the range fix on dev (6,524 /
6,524 waveforms exact); the 8x sensitive-range item and the MicL dB
item are marked resolved in place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-02 14:03:47 -05:00
serversdownandClaude Opus 5.5 f98c4ff129 fix(sfm): a MiniMate download stores what its own file says, at the range it was recorded at (#17)
With the decode checker's fixes merged (histogram vector sum 625bc39, mic psi
5644dbd, the file's geophone range 4844135), the event file reads everything
Blastware reports.  So a live download's row and samples are now the file's:
peaks, vector sum, mic -- and the geophone range from the file's own setup
block, the setting when the event was recorded.  The live 1A is the unit's
setting now, which may have changed since; it is the fallback only when the
file's range does not read.

Measured: K557J1KB.RQ0W (Sensitive waveform) downloaded with its settings unread
-- e.g. while monitoring -- stores 0.019 / 0.055 / 0.019 and PVS 0.061,
Blastware's report; its .h5 read 0.155 / 0.44 (8x) before.  M010HR6K.OA0H
(Sensitive histogram) likewise.  K441LTON.900 (Normal) stores Blastware's
values whatever the unit's current settings say, and its mic is 5.80e-4 psi
(Blastware: 106.0 dB(L)).

The unit's 0C summary stays the download check, and fills in the channel peaks
and vector sum only when the file's range does not read (never seen in DL2) and
the unit is not confirmed Normal -- the impossible-vector-sum guard kept there.
The mic is the file's always.  Closes the range part of open finding #17.

Store consequence: new live downloads only; no backfill, no migration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-02 13:48:59 -05:00
serversdownandClaude Opus 5.5 d0c14aaec8 merge: dev into feat/series4-sfm-parity -- the geophone range from the file, and v0.33.0
Brings 057df47 (fix 4844135, changelog be58b4f) from the decode checker's branch
-- Event.geo_range from the file's setup channel block (label+29: 0 Normal,
1 Sensitive, None not read), peaks and histogram PVS scaled by it,
write_event_hdf5(geo_range=None) using it -- and dev's v0.33.0 release commit
(6c7c6b0).

Conflicts, resolved as agreed with the decode session:
- sfm/waveform_store.py save_imported_bw: dev dropped the forced
  geo_range="normal"; this branch keeps its geo_range parameter, now
  Optional, default None -- an import uses the file's own range, an explicit
  value (a live download's) still wins.
- CLAUDE.md: dev's newer 'Where things stand (updated 2026-11-01)' date.

Measured on the merged tree: K557J1KB.RQ0W (Sensitive waveform) decodes
0.019 / 0.055 / 0.019, PVS 0.061 -- Blastware's report -- and its imported
.h5 peaks 0.0194 / 0.055 / 0.0194 (forcing 'normal' gives 8x: 0.155 / 0.44).
M010HR6K.OA0H (Sensitive histogram) likewise.  The live path still passes the
unit's 1A range or 'normal' when unread -- unchanged by this merge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-02 12:06:35 -05:00
serversdownandClaude Opus 5.5 be58b4f8f0 docs(changelog): Unreleased -- the geophone range from the file
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-02 12:04:15 -05:00
serversdownandClaude Opus 5.5 057df47460 merge: a Blastware file's geophone range from its setup -- Sensitive events no longer 8x
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-02 12:03:41 -05:00
serversdownandClaude Opus 5.5 4844135f01 fix(decode): a Blastware file's geophone range comes from its setup -- Sensitive events no longer read 8x
In the setup's channel blocks, the byte 29 after each geophone label is
the range: 0x00 Normal (10 in/s), 0x01 Sensitive (1.25 in/s).  It matches
Blastware's GeoRange on 70,042 / 70,042 DL2 events, all three channels
agreeing on every one (35 Sensitive).  SFM's live 1A has the same byte
at label+33.  SFM assumed Normal, so every Sensitive event's peaks,
vector sum and .h5 samples read 8x high.

- Event.geo_range (0 / 1, None when not read -- channels disagreeing,
  an unknown value or a missing block -- with a decode_problems entry).
- decode_blastware_bytes scales peaks and the histogram vector sum by it.
- event_hdf5.write_event_hdf5: geo_range defaults to None = the event's
  own, else Normal; an explicit argument still wins.
- waveform_store.save_imported_bw and scripts/backfill_sidecars.py stop
  forcing 'normal', so imports and the backfill store the file's range.
  The waveform_store line was agreed with the parity session, which owns
  that file; its own branch keeps a geo_range parameter, defaulting to
  None at its next dev merge.
- The checker's SFM side converts at the event's range and reports
  GeoRange; tests that pinned the old 8x gap now pin the fix, and the
  saturation carve-out is still tested against an 8x value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-01 16:26:15 -05:00
serversdownandClaude Opus 5.5 6c7c6b0a15 chore(release): v0.33.0 — SFM reads Series-3 events from the file alone, and proves it
A Blastware event that reaches SFM without its ASCII report -- every DL2
event before 2025, and every event SFM downloads itself -- now carries
its sample rate, record time, pre-trigger, notes and event type, the
histogram vector sum the unit stores, and a mic reading at one count =
0.25 Pa.  The new decode checker proves each against Blastware's own
_XML.XML reports for 70,042 DL2 events.

- CHANGELOG: Unreleased -> v0.33.0 with theme and Migration.
- TOOL_VERSION 0.33.0 (gates the backfill regeneration).
- pyproject, CLAUDE.md and README versions; README status entry and
  roadmap (the Series-III codec item was long done; the file-only goal
  added); CLAUDE.md 'Where things stand' brought up to v0.33.0.

Deploy: back up seismo_relay.db, then backfill_sidecars.py and
backfill_event_shape.py (~2 h on the NAS).  No schema change, no
migration, event times do not move.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-01 14:20:15 -05:00
serversdownandClaude Opus 5.5 1141a15543 merge: dev into feat/series4-sfm-parity -- one MicL count is 0.25 Pa
Brings 30a249e (fixes 5644dbd + 1895150, changelog 287ef2a) from the decode
checker's branch: the file's mic psi was ~95x low (_MIC_PSI_PER_COUNT =
0.25 Pa / count), and Blastware's dB offset is 81.9384.  K441LTON.900's mic
reads ~5.80e-4 psi from the file, as Blastware's 106.0 dB(L).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-31 02:20:32 -04:00