fangorn/ex_git_objectstore
public
Flaky: binary sideband reassembly via PktLine.decode drops 0x0A bytes (SidebandWriterTest) #64
Links
No links yet.
Follow-up to the latent issue flagged in #63.
Symptom
SidebandWriterTest “payload larger than max frame…” intermittently fails on main:
assert decode_sideband_payload(frames) == payload with the reassembled payload diverging from the original. Payload is :crypto.strong_rand_bytes(...), so it flakes whenever a sideband chunk happens to end in 0x0A.
Cause
The test reassembles binary sideband data with PktLine.decode, whose decode_one strips one trailing LF from every data packet — correct for text lines, wrong for binary. Same root cause as the walker flake (#63, fixed in #39), different test file.
Fix
The encode side is already split (encode adds LF for text; encode_raw/encode_sideband don’t, for binary). Complete the symmetry on the decode side: add PktLine.decode_raw/1 (+ decode_one_raw/1) that returns payloads verbatim, and use it for binary sideband reassembly. decode/1 (text) is unchanged.
Audited the other test files that decode sideband: upload_pack_test, upload_pack_v2_test, protocol_interop_test already use raw extract_sideband_pack helpers for the pack body; receive_pack_streaming decodes only text report-status — none flaky.
Follow-up
The 3 extract_sideband_pack helpers + the walker’s raw_pkt_payloads now duplicate what decode_raw/1 provides; consolidating them onto the shared primitive is a cleanup for later.