fangorn/ex_git_objectstore
public
ref:6cddd4f7626bcde116d297bb8c7ce150b007642c
fix(protocol): add PktLine.decode_raw for binary sideband reassembly (#64)
SidebandWriterTest flaked on main: it reassembles a random binary payload
(:crypto.strong_rand_bytes) via PktLine.decode, whose decode_one strips one
trailing LF from every data packet. That's correct for text lines but wrong
for binary — when a sideband chunk ends in 0x0A the byte is dropped and the
reassembled payload no longer matches. Same root cause as the walker flake
(#63, fixed in #39), different test file.
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) returning payloads verbatim,
factoring the framing through a shared do_decode_one/2 so decode/1's
text-stripping behavior is byte-identical. Use decode_raw in the sideband
test helper.
Audited the other sideband-decoding tests: 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.
Tests: decode_raw unit tests (preserves trailing LF + 0x0A frame boundaries);
sideband_writer + full protocol suite green (107 tests); decode/1 text path
unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
SHA:
6cddd4f7626bcde116d297bb8c7ce150b007642c
Author:
CI <ci@anvil.test>
Date:
2026-05-29 07:22
Parents:
ef39fe6
3 files changed
+62
-18
| Type | ||
|---|---|---|
|
|
lib/ex_git_objectstore/protocol/pkt_line.ex | +35 −13 |
|
||
|
|
test/ex_git_objectstore/protocol/pkt_line_test.exs | +22 −0 |
|
||
|
|
test/ex_git_objectstore/protocol/sideband_writer_test.exs | +5 −5 |
|
||