fix(test): binary-exact pack reassembly in walker property test (#63) #39
fix/walker-prop-binary-pack-extract
into main
Fixes #63.
upload_pack_v2_walker_property_test flaked with {:error, :pack_checksum_mismatch} (deterministic on seed 117). It surfaced on the CI run for PR #38 but is unrelated to that change — it’s a pre-existing test-harness bug.
Root cause (harness only — production is correct)
extract_pack/1 reassembled the pack by running the sideband response through PktLine.decode, whose decode_one strips one trailing \n from every data packet (correct for text lines, wrong for binary sideband pack data). When a sideband chunk’s last byte was 0x0A, it was dropped → pack one byte short → checksum mismatch. Content-dependent, hence flaky; gitlink-to-local-commit topologies hit it often.
The server frames sideband data with encode_raw/encode_sideband_frame (no LF appended), so the wire bytes are exact and real git clones succeed. The bug never touched production output.
Fix
Reassemble the pack from raw length-prefixed pkt-line payloads, verbatim (no LF stripping). The asserted walker-reachability invariant is unchanged. Verified across seeds 1–160 (~12k graph builds), 0 failures.
Note
PktLine.decode_one‘s blanket LF-strip is a layering quirk (pkt-line payloads are length-exact); benign for the server’s text-command parsing, left as a possible follow-up.
🤖 Generated with Claude Code