feat(micromate): fetch_event returns the bytes with the checked decode

get_event() now delegates to fetch_event(), which returns (blob, result).
The same peak-vector-sum self-check applies, so a DecodeMismatch still stops
the bytes from being stored. get_event() keeps its signature and behaviour.

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-21 16:52:43 -04:00
1 parent d5484d10c0
commit 83d1a98c1c
2 files changed
+61 -1

No files matched your search

+12 -1
View File
@@ -550,6 +550,17 @@ class MicromateClient:
Histograms are not verified: `samples` is empty for them.
"""
return self.fetch_event(ref, verify=verify, tolerance=tolerance,
chunk_size=chunk_size)[1]
def fetch_event(self, ref: MicromateEventRef, *, verify: bool = True,
tolerance: float = 0.01, chunk_size: Optional[int] = None):
"""`get_event()`, returning the raw bytes too: `(blob, result)`.
For a caller that stores the file AND wants the self-check: the bytes go
to the waveform store unchanged, and a DecodeMismatch stops them being
stored at all.
"""
if not ref.record_type:
raise ValueError(
f"event {ref.key_hex}: record_type is unknown, so the codec "
@@ -580,7 +591,7 @@ class MicromateClient:
)
if err is not None:
log.debug("event %s: PVS agrees to %+.4f%%", ref.uid, 100 * err)
return result
return blob, result
@staticmethod
def decode_error(ref: MicromateEventRef, result) -> Optional[float]: