fix: stop raising on S3 checksum mismatches

This commit is contained in:
Brian Harrison
2026-03-31 00:15:07 -04:00
parent 88adcbcb81
commit 3f142ce1c0

View File

@@ -280,11 +280,17 @@ class MiniMateProtocol:
@staticmethod
def _validate_frame(frame: S3Frame, expected_sub: Optional[int]) -> None:
"""Validate checksum and SUB, raising on failure."""
"""Validate SUB; log but do not raise on bad checksum.
S3 response checksums frequently fail SUM8 validation due to inner-frame
delimiter bytes being captured as the checksum byte. The original
s3_parser.py deliberately never validates S3 checksums for exactly this
reason. We log a warning and continue.
"""
if not frame.checksum_valid:
raise ChecksumError(
f"Bad checksum in S3 frame SUB=0x{frame.sub:02X}"
)
# S3 checksums frequently fail SUM8 due to inner-frame delimiter bytes
# landing in the checksum position. Treat as informational only.
log.debug("S3 frame SUB=0x%02X: checksum mismatch (ignoring)", frame.sub)
if expected_sub is not None and frame.sub != expected_sub:
raise UnexpectedResponse(
f"Expected SUB=0x{expected_sub:02X}, got 0x{frame.sub:02X}"