fix(minimateplus): a one-event download is whole or it is an error

BE9441 rebooted mid-download at the bench (2026-10-25): the chunk at 0x7D06
got one stray byte and then silence, the 5A loop logged "unexpected end-of-
stream -- proceeding to TERM", the TERM got no reply either, and the short event
(17,920 / 17,920 / 17,408 of 21,504 samples) was stored as a success.

read_bulk_waveform_stream(strict=True) now raises on every early end: no STRT,
a metadata page or chunk with no reply, a mid-stream terminator, the chunk cap,
or no TERM reply.  get_events passes it for the strict walks (headers_only,
only_key) and, in strict mode, re-raises a 5A error instead of logging
"metadata unavailable" and returning the event without frames.  The legacy
full walk is unchanged, call for call (strict passed only when on).

Tests replay BE9441's recorded session through the real MiniMateClient: whole,
event 1 comes back in full; with the 5A stream quiet from chunk 40 while the
walk is still answered -- the bench's reboot -- it raises "ended early".

No codec, store or DB change.

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-25 18:11:13 -04:00
1 parent 352f6944e7
commit 75d79ece6c
4 files changed
+247 -5

No files matched your search

+6 -2
View File
@@ -497,6 +497,8 @@ class MiniMateClient:
"""
proto = self._require_proto()
strict = headers_only or only_key is not None
# Passed only when on, so the legacy walk's 5A call is unchanged.
strict_5a = {"strict": True} if strict else {}
log.info("get_events: requesting first event (SUB 1E)")
try:
@@ -653,7 +655,7 @@ class MiniMateClient:
)
a5_frames = proto.read_bulk_waveform_stream(
cur_key, stop_after_metadata=False, max_chunks=128,
include_terminator=True,
include_terminator=True, **strict_5a,
)
if a5_frames:
a5_ok = True
@@ -672,7 +674,7 @@ class MiniMateClient:
cur_key, stop_after_metadata=True,
include_terminator=True,
extra_chunks_after_metadata=extra_chunks_after_metadata,
max_chunks=128,
max_chunks=128, **strict_5a,
)
if a5_frames:
a5_ok = True
@@ -684,6 +686,8 @@ class MiniMateClient:
ev.project_info.operator if ev.project_info else None,
)
except ProtocolError as exc:
if strict:
raise # a one-event download is whole or it is an error
log.warning(
"get_events: 5A failed for key=%s: %s — metadata unavailable",
cur_key.hex(), exc,