fangorn/ex_git_objectstore
public
Flaky walker property test: extract_pack drops 0x0A-terminated sideband chunks → pack_checksum_mismatch #63
Links
No links yet.
Symptom
upload_pack_v2_walker_property_test.exs intermittently fails with Reader.parse failed: {:error, :pack_checksum_mismatch}. Deterministic on seed 117 (and the CI seed that hit it). Trigger is content-dependent — gitlink_target: :self topologies hit it often.
Root cause (test harness only — production is correct)
extract_pack/1 reassembles the pack by running the sideband response through PktLine.decode, whose decode_one strips one trailing LF from every data packet (correct for text lines, wrong for binary sideband pack data). When a sideband channel-1 pack chunk’s last byte is 0x0A, that byte is dropped → reassembled pack is one byte short → checksum mismatch.
The server frames sideband data with encode_raw/encode_sideband_frame (no LF appended), so the wire bytes are exact and real git clones fine — this never corrupts production output. Anvil is the git server and does not binary-decode sideband in production.
Fix
Reassemble the pack binary-exactly in the test: a length-prefixed pkt-line split that returns payloads verbatim (no LF stripping). The asserted invariant is unchanged.
Latent note
PktLine.decode_one LF-stripping is a layering quirk (pkt-line payloads are length-exact; LF-stripping belongs to higher text layers). It’s compensated by encode adding LF and is benign for the server’s text-command parsing, so not changed here — flagged for a possible follow-up.