From 128bc9996c6f81c24919de0c2ed96dbf7c5d8680 Mon Sep 17 00:00:00 2001 From: Strycher Date: Wed, 29 Jul 2026 03:46:04 -0400 Subject: [PATCH] test(#430): fix oversized-frame test for the 176-byte ceiling The 172->176 ceiling raise made the existing "drops oversized frames and resyncs" test's 173-byte frame a valid length, so it buffered instead of dropping (it was red). Derive the over-max length from the ceiling so it stays a genuine oversized frame and still exercises drop-and-resync, confirming the higher ceiling doesn't weaken corrupt-frame recovery. Full suite: 643 green. Co-Authored-By: Claude Opus 4.8 --- test/services/usb_serial_frame_codec_test.dart | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/test/services/usb_serial_frame_codec_test.dart b/test/services/usb_serial_frame_codec_test.dart index 32242bd..18ef715 100644 --- a/test/services/usb_serial_frame_codec_test.dart +++ b/test/services/usb_serial_frame_codec_test.dart @@ -102,11 +102,16 @@ void main() { () { final decoder = UsbSerialFrameDecoder(); + // A frame claiming a payload above the max must be dropped, and the + // decoder must resync to the next valid frame. Length is derived from the + // ceiling so this stays a genuine over-max after it was raised to 176 + // (#430) — a hard-coded 173 is now a valid length. + final oversized = usbSerialMaxPayloadLength + 1; final packets = decoder.ingest( Uint8List.fromList([ usbSerialRxFrameStart, - 0xAD, - 0x00, + oversized & 0xff, + (oversized >> 8) & 0xff, 0x99, usbSerialRxFrameStart, 0x01,