From the 2026-11-04 bench:
- A MiniMate settings preview warns that a change is lost if someone is in
the unit's setup menu: a write sent with the menu open was acknowledged
and read back, then lost on Cancel or Save -- the menu writes its own
copy of the whole block back (measured both ways on BE9441).
- The two bytes after the MiniMate settings block went out as 00 00 and
the unit took them; the preview note says so instead of 'unmeasured'.
- A Micromate call-home plan no longer warns about 0x00 / 0x01: UM20147
took both, each way, on 11-03 and 11-04, matching its menu.
- read_waveform_data_raw drops the escaped-checksum's stray 0x10, as the
settings read does (it failed closed: the write's block check refused
203 bytes).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
From the whole-branch review of phase 5:
- The preview's revision now covers the changes asked for, so a live
change must be exactly what was previewed (any API caller, not only the
page). It covers what the preview showed -- the settings block (and a
Micromate's setup name) -- not the blocks a write only echoes, which are
re-read at send and sent as read (a MiniMate's trigger block byte 5
differs by session, #46).
- The units' limits hold on the block that would result: a range, rate or
mode change alone can no longer leave a held trigger, alarm or record
time over them.
- Every MiniMate block read is logical, so push_config_raw no longer
unescapes again (a job number of 4098, 10 02, was refused at Send); the
preview runs the write's own block check, so a block it would refuse is
shown as blocked.
- A MiniMate's monitoring refusal says a stop makes it call in (spec).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
DeviceAccess.change_settings refuses before any I/O a request with no
changes, a live change without its preview's revision, or no audit log,
then dispatches the series' change (never retried). The route returns
the preview (fields old -> new, warnings, blocked, revision) or the
result (fields old/new/now), statuses as the other changes, and marks
the cached by-host config dirty after a live change.
/device/config and /device/config/project now answer 410 with a pointer.
Deleted with them: MiniMateClient.apply_config / set_project_info and
the raw-offset _encode_compliance_config (#46 found it wrong), the
lab script poc_set_project.py and experiments.py's EXP6, both of which
wrote a live unit through it. Git keeps them.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Series3Adapter.settings reads the 1A block assembled into its 2,090
logical bytes and decodes it with micromate.setup_fields (a monitoring
unit's device-info answer is refused with 'stop monitoring first').
change_settings runs the shared change core: read the four settings
blocks, patch the settings block's fields, send Blastware's sequence
through push_config_raw with the event index, trigger and waveform blocks
as read, re-read. Refused before sending: monitoring, a value the unit
does not allow, a stale preview. push_config_raw's pre-check now raises
ImageRefused, so a refused image is audited as nothing sent.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
s4_change_settings runs the shared change core with a read-back verdict
for its state (as asked / unchanged / differs). It reads the active
setup's name (unstripped), the preferences, trigger and setup blocks and
the schedule; patches the setup through micromate.setup_fields; sends
THOR's setup push (0xDA 68 73 82 83 71 72, now enableable) once; reads
the setup back. Refused before sending: a monitoring unit, a value the
unit does not allow (422), a stale preview (SettingsChanged, 409), and --
shown as 'blocked' in the preview -- the factory setup, a schedule that
loads another setup, an unreadable schedule, or a block SFM has not seen
(ChangeRefused, 409). s4_settings carries the editable fields.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
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
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
- 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
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
- 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
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
- 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
- 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
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
Blastware names a direct download K441LTON.900 and only its call-in copy
K441LTON.900H, so a folder of directly downloaded events cannot be sorted by
kind. SFM's own files now always carry the letter. It is read from the file's
own record-type byte (STRT[18], #41) by the new with_type_letter() -- not from
the recording mode: BE9441's K441LTOK.R10 is a waveform that triggered 2 s into
histogram K441LTOK.QZ0 (Histogram+Continuous). A file whose type does not read
keeps the plain name; a name never fails a download.
All three paths that name a MiniMate file SFM builds: the device-access
download (the page's event list), WaveformStore.save (the legacy route's store
copy, the bench call-in server), and the legacy /device/event/{i}/blastware_file
download. Verified on BE9441's recorded 5A walk: 0111f210 -> K441LTON.900H,
011106a0 -> K441LTOK.R10W, byte-identical to Blastware's files.
find_event_by_blastware_name tightens with it: a lettered name matches itself
and the letterless form, not the other letter (a waveform and a histogram in the
same second are different events); a letterless name still matches all three.
Store consequence: new downloads only; rows and files stored before keep their
names, and 'already stored' still finds them. No schema change, no migration.
The event list shows the plain name until the event is downloaded (the type is
not known before the 5A).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
The reconnect in ce441a0 opened a fresh connection and sent a bare 0x15 (the
identity check) before any SESSION_RESET + POLL. It exists for a unit that has
just started -- sensor check, then monitoring -- and a monitoring MiniMate
ignores a bare request until woken (measured 2026-04-08), so the identity read
would have timed out and the start reported unconfirmed anyway. Now: open,
wake (the same retried wake the read-back uses), read the serial, read 0x1C --
the order the status read and the legacy write routes use. Still one
reconnect, TCP only, nothing re-sent.
The fake gains bare_requests_ignored (off unless a test asks): a fresh
connection's reads time out, with the real client's TimeoutError, until woken.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
A live Series-3 download was stored from the live 5A decode (store.save): a
histogram got no samples and nothing to plot (bench 2026-10-29). The download
now carries the assembled Blastware file (DownloadedEvent.bw_bytes, built by the
new blastware_file_bytes -- byte-identical to Blastware's own K441LTON.900 and
K441LTOK.R10), and persist_download stores it through save_imported_bw, the
path the watcher uses for Blastware's files, the way Series 4 already uses
save_imported_idf. The event is decoded from the file: histogram samples,
setup-block sample rate and record time (#44/#45). source.kind is 'sfm-live'.
The file path does not yet read three things right (measured on BE9441): a
histogram's vector sum (0.503 where Blastware and the unit say 0.385 -- the
decode checker's open finding), the mic peak (0), and a sensitive range. So the
unit's own 0C channel peaks, mic and vector sum are overlaid, as Series 4 does,
except an impossible vector sum (below the largest channel; BE9441's 0C read
-0.0, bench #4), and the unit's range is passed through for the stored samples.
Store consequence: new live MiniMate downloads only; existing rows and files are
untouched; no backfill, no migration. The record type still reads 'Waveform'
for a live histogram until #41 (record type from STRT[18]) lands from the decode
checker's branch.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
BE9441 over a modem, 2026-10-29: the start was acked, but the modem closed the
line during the ~30 s sensor check, so the read-back's first wake hit
'[Errno 32] Broken pipe' and the change was reported 503 'not checked' although
the unit was monitoring. On an OSError in the read-back, a TCP unit is now
reconnected once, its serial checked against the named unit, and its state read.
Nothing is re-sent: the start still goes out exactly once. A serial cable is
never reconnected (opening a MiniMate's port reboots it), a second failure or a
silence (a cleanly closed line) ends 'not checked' as before, and a different
unit after the reconnect is refused (409, change unconfirmed).
Store consequence: none.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
GET /device/monitor/status?serial=UM...&run_state=true adds
detail.run_state = {code, name}. For the ring-path bench test: the code
during and after a call-home (0x01 for ~18 s after a stop, inferred to be
call-home attempts; 0x03 = calling home) is what the test watches. Opt-in
because it is one more round trip (~0.65 s on cellular); a plain status read
is unchanged. Series 3 has no 0x49 and ignores it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Second start through SFM, BE9441 2026-10-26 23:54:41: acked 0x69, and Brian saw
'starting, performing sensor check, recording' -- but the read-back's single
SESSION_RESET + POLL went out 2.3 s after the ack, inside the ~30 s sensor
check, and was never answered or re-sent (504 after 120 s, audit ca7b5b42).
Brian: every unit is set to sensor-check before monitoring, ~30 s, then
'Recording...'.
- MiniMateProtocol.wake(attempt_s, deadline_s): SESSION_RESET + POLL re-sent
every attempt_s until the unit answers, then the POLL data step; a named
timeout at the deadline. Reads only. MiniMateClient.wake() wraps it.
- The Series-3 change: after a START, the first read waits S3_SENSOR_CHECK_S
(30 s) before asking; every read then wakes with retries (every 5 s, up to
60 s). A stop is unchanged -- its read-back was confirmed three times tonight.
Tests: a unit deaf for 4 probes is asked a 5th time and answers; a unit that
never answers ends in the named timeout after ~6 probes; a start's first read
waits the sensor check, a stop's does not; every read is preceded by a wake.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
BE9441, 2026-10-26 23:41:48 (through the bridge): SFM's start (0x96, Blastware's
own bytes) was acked 0x69 and the unit began monitoring -- Brian saw it -- but
the read-back sent one bare 0x1C two seconds later and got nothing for 120 s,
so the change reported 'sent and acknowledged, but reading the state back
failed' (504, audit 0c1cf813). Nothing was retried.
A monitoring MiniMate ignores a bare request until SESSION_RESET + POLL
(measured 2026-04-08). The read-back had relied on the connect's wake; a stop's
read-back (18:53, the unit idle by then) never needed it. Every state read in
the change now goes through _woken_state: client.poll() (41 03, POLL, 41 03,
POLL -- the connect's own sequence), then 0x1C.
Test: after the send, every 0x1C read is preceded by a POLL. No codec, store or
DB change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Measured on BE9441 tonight, through the recording bridge:
- Monitoring flag 0x0B while recording a histogram (confirmed at the unit), 0x00
idle. Only 0x10 had been measured as monitoring (BE11529, 2026-04-08), so the
status showed 'not monitoring' and the change path refused the state as
unknown(0x0B) -- refused, not skipped, which is the design working. 0x0B joins
S3_RUN_STATES and S3_MONITORING_FLAGS as measured. The shared status's
'monitoring' now follows the change path's reading: None for an unmeasured
flag, never a guessed False.
- Free memory 0x000D0E04 arrived as 0d 0e 10 04. The parser keeps the 10 of a
10 02/03/04 escape, so every field counted from the end read one byte off:
419.84 V and 251,655,168 bytes for 6.76 V and 983,028. New
framing.unescape_reply() (also used by parse_strt_end_key) runs first.
Tests: the two recorded replies (idle 16:24, monitoring 18:47) decode to the
unit's own values; each escaped value in the last ten bytes decodes; the status
mapping for 00 / 10 / 0B / unmeasured. No codec, store or DB change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
CLAUDE.md: the KNOWN BUG entry marked fixed (887e75d) with what settled it, and
retraction notes under the 5A sections that described the misreading (partial
stuffing, offset_hi 0x10 raw, 11-byte params, metadata pages 0x1002/0x1004).
Series-III reference: a 2026-10-26 (3) row. Spec: the MiniMate check updated.
Code comments that called the page bug open, updated; the adapter's struct.error
mapping kept as a defence, its message and test no longer naming the old bug.
Verified live on BE9441 the same day: all 8 events downloaded by serial, the 4
that cross a 64 KB page included, each whole and matching the unit's own peaks.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Review of 36f4e5d (measured): with the metadata-page bug put back, 4 of 7
BE12599 non-first waveforms decoded to nothing, and the check stored them
unverified as 'a histogram' -- the worst form of the bug it was built for.
Now: no waveform decode must decode as a histogram (stored unverified) or it is
refused; a waveform's record chain must end on its END record (0x06), as the
file reader requires -- cut-short streams have none; the structure checks run
for every unit and only the peak comparison is limited to a unit confirmed in
normal range (geo_range == 0; an unread range is no longer assumed normal);
a clipped blast at full scale on both sides counts as a match. Tests pin the
one-step tolerance, both ranges, the END record and the neither case.
No DB or schema change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Series 4 downloads were checked (decoded PVS against the unit's); Series 3's
were stored unchecked (verified=None), so BE9441's two bad files went in as
successes at the bench (2026-10-25). verify_s3_download(): if the waveform
decodes, all three geophone channels must be the same length and each peak must
be the unit's own 0C peak to one 0.005 in/s step, or the download is refused
(MalformedReply, "not saved"). Unverified (stored, as before): no waveform
decode -- a histogram; 0 of ~430 fixture histograms decode as one -- or a
sensitive-range unit, whose scale is still open. The reason goes in
detail["check"].
A test puts the metadata-page bug back and the check refuses the file it
produced. Session-replay helpers move to tests/minimate_replay.py.
No codec, store or DB change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
The final fix wave's AuditIncomplete landed in _exchange's `except DeviceError`,
which keeps the line -- so on the nine ring / link-fault paths (and a refusal) a
failed audit write turned a hang-up into a held Series-4 line, blocking a THOR
call-home for up to the 5-minute idle hang-up and making "SFM hung up" false.
AuditIncomplete now carries release_line, set by every finish whose path hangs
up anyway, and _exchange honours it. Also pins the Series-3 change path's
retry=False again (the rewritten lost-ack test no longer could).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Final fix wave for phase 3 (start/stop monitoring), per the whole-phase review.
- I1 + M2: every failure after the send has started is a ChangeUnconfirmed
(audit_id, sent = "acknowledged" | "unknown", the cause's HTTP status) whose
message says the frame was sent and names the audit record -- the ring in
place of the ack, the four lost-ack follow-ups, and the three read-back
paths. Series4Session releases the line on it. Every audit finish goes
through one helper; a finish that fails is AuditIncomplete (500) and still
says what happened to the unit. The line is kept.
- I2: device_commands gains `sent` (1 acknowledged, 0 nothing sent, NULL
unknown) and `states` (before / seen / after), with an idempotent ADD COLUMN
in _migrate for a table created earlier on this branch.
- M1: a RADIO RING already buffered is caught before 0x96/0x97 goes out
(pre_send = read_unsolicited, one 10 ms transport read). That is a
CallHomeInProgress with sent=0, not ChangeUnconfirmed.
- M3: Series 3 reads the raw 0x1C flag (new MonitorStatus.state_flag); a byte
other than 0x00/0x10, or a short section, is unknown(...) and refused.
- M8: even_if_already on a unit already in the state notes that the read-back
proves nothing.
- M10: a scan pins `.protocol.execute(` to sfm/device_access/s4.py; both
scans fail closed on a file that does not parse.
- M11: docs corrected (CLAUDE.md phase-2 sentence, phase-3 bullet, REST list;
micromate/protocol.py scope and the 0x49 read_state docstring; s4.py; route
docstrings). "No command has ever been originated" is NOT retracted.
- M12: GET /db/device_commands normalises the serial.
- Minors: unused imports, S3 dry-run frames and 120 s timeout pinned, test
rename, serial-cache and short-0x49 tests, _RUN_STATES comment.
Schema: two NULLable columns on the branch-new device_commands table, added
by _migrate on open; no backfill. No codec change, TOOL_VERSION unchanged.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
- Series4Session's docstring now states which errors keep the line: an
op raises a DeviceError only for a verdict on a healthy link (not
found, stale, unnameable), and _exchange keeps the line for those; any
library error means the link is suspect and hangs up. DecodeMismatch
is a library error and hangs up -- conservative. Later ops must keep
to it.
- Test: a micromate TimeoutError mid-download, on a fresh DeviceAccess
(no retry path), is NoAnswer, closes the client once and leaves no held
line. It pins existing behaviour; a mutation that keeps the line on
library errors makes it fail.
- README, event rows corrected in place: another unit's id is 422 (not
409); a stale id is 409 without downloading, both series; an event
already stored -- including by THOR's watcher -- returns its row and
changes nothing (detail.already_stored); MiniMate lists give
record_type null, on the normal timeout, and fail on a lost reply.
No code behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
minimateplus's _extract_record_type returns "Waveform" for every 0C
record layout -- it cannot tell a histogram -- so a MiniMate histogram
was listed as "waveform". The fake's "Histogram" was a value the real
client never produces, which is why no test saw it.
- _s3_ref: record_type is always None, with
detail.record_type_note = "Series 3's event record does not say
waveform or histogram; not decoded yet".
- default_s3_events(): both events "Waveform", as the real client gives.
- The shared-shape contract test allows exactly {"record_type"} to be
None for Series 3 and nothing for Series 4.
Rows SFM stores for Series 3 still carry "Waveform" from the decode (the
same as the legacy blastware_file route); parked in the spec. No codec,
store or DB change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
One lost 1F reply made the list return 1 of 3 events as a 200, and on a
download gave a false 404. The list also ran on the 120 s download
timeout, so each lost reply stalled the walk 120 s with the unit locked.
- get_events() strict mode (headers_only, or only_key): a lost 0A reply,
a lost 1F(browse) reply on the success path and on the partial-record
path all re-raise their ProtocolError; a 1F that hands back a key
already walked raises ProtocolError("event chain did not advance ...").
Legacy calls (none of the new options) behave exactly as before --
pinned by tests of the same three faults under get_events().
- Series3Adapter.list_events runs on the default timeout (10 s on TCP);
download_event keeps 120 s.
- FakeProto gains optional lost-reply injection; its default is unchanged.
The repeat-key guard sits at the loop head, which is reached only for a
non-null key -- equivalent to checking each 1F's key, in one place.
Read-only; nothing new on the wire. No codec, store or DB change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
Series3Adapter.download_event compared the timestamp only after
download_event_by_key had run the whole 5A. A stale id cost a full
download of the wrong event (minutes on cellular), could surface the
64 KB-page 502 instead of 409, and a lost 0C reply was reported as "the
unit was erased".
- get_events() gains only_key_timestamp: with only_key, if the target's 0C
says another time (or none), the target takes the existing bypass --
no 1F(arm), no POLL, no 5A. A new branch only; it adds no command.
- download_event_by_key(key4, *, expected_timestamp=None) passes it on.
- The adapter converts the id's stamp to that ISO form and checks, in
order: no event -> 404; no readable 0C timestamp -> 502 MalformedReply
("could not read ... record (0C)"); a different time -> 409 StaleEvent;
no frames -> 502.
- The fake's download mirrors the real walk (no frames on a mismatch) and
records what it was asked for.
- Legacy get_events() (none of the new options) is pinned by a test of
its exact call sequence and 5A arguments, written before the change.
Read-only; nothing new on the wire. No codec, store or DB change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
THOR's watcher (and Blastware's ACH) store every event through
/db/import/idf_file and /db/import/blastware_file, with the paired report.
Storing a download of the same event afterwards overwrote that richer copy:
on Series 4 the file, .h5 and sidecar were rewritten (extensions dropped);
on Series 3 the row lost PVS, project strings and ZC frequencies and was
repointed at a second, review-less file set.
persist_download now looks up (serial, timestamp) first. A row there is
returned as it stands -- inserted false, detail.already_stored true -- with
no store call, no insert_events and no sidecar write. Never merge.
- DownloadedEvent gains `timestamp` (the unit's own event time) and
`record` (Series 4's 0x0C fields); both adapters set them.
- The Series-3 `event is None` guard now runs before backfill/save, with a
message that is true there ("nothing was stored").
- Tests build the watcher's state exactly as the import endpoints do and
prove the row dict, the sidecar bytes and the file mtimes are unchanged.
No schema change, no migration, no codec change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
The /device guard let every non-UM serial through before its held-line
check. FastAPI drops an undeclared `serial`, so `?serial=BE18193` on a
legacy route still ran Series-3 code at an address holding a Series-4
line -- the hole the guard exists to close. Serial-aware routes go
straight to DeviceAccess, which refuses that case itself; everything
else is checked. baud is no longer parsed (it is not in the address
key, and pydantic's coercion made "38400.0" a second way past).
Also, from the same review:
- RingWatchTransport clears its frame state on every write, so a stray
STX on an idle line cannot hide the ring that answers the next request.
- Series4Session.is_open reads _client once; held_serial() calls it
without the unit lock, and a concurrent hang-up between two reads was
an AttributeError (a 500).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44