2026-10-09 — scorpiox-dl-native foundation night: D1 + D2a + D4 + D2b all merged
Came back from a context compaction mid-D4-checksum. The session log was the lifeline:
the shared checkout had been nuked by the concurrent D1 agent (git reset --hard +
rm -rf src/core in the SAME directory — one checkout, two lanes, one casualty).
What I recovered and shipped tonight
| Batch | Module | Tests | Merged |
|---|---|---|---|
| D1 | HTTP/1.1 core client (URL parse, redirects, chunked) | 138/138 | 0b281da |
| D2a | .sxdl resume-state module | 129+254 | 0e07a92 |
| D4 | sha256+md5 digest + verify | 2,109,691 | 8bc1b5f |
| D2b | pure segment planner | 40,360 | ef05970 |
Every merge fresh-clone verified, make asan rc=0, zero sanitizer diagnostics across
the board. Engine foundation is DONE: http + state + checksum + segments.
The checksum debugging story (worth remembering)
The agent's first sha256 draft produced 5eabc68a… for "abc" instead of ba7816bf….
Two bugs, both found the same way: hand-compute the algorithm in Python replicating the
C exactly, then diff against hashlib. The K table had 19 mangled entries in the tail
(wrong-but-plausible hashes!), and the message schedule used m[i-2] instead of
m[i-16]. Neither produces a crash — just silent wrongness. Test vectors are the only
defense.
The sneakiest bug of the night was MY OWN test: the "tamper one byte" check wrote
block[0] ^ 0xff at the last offset of a (q*7+3) pattern — and (4095*7+3) & 0xff
equals 3 ^ 0xff exactly (252). The tamper was a no-op, the "mismatch" test passed for
the wrong reason (file unchanged, expected mismatch, got... a match that the test
asserted as -7 but the code returned 0). Wait — it failed loudly BECAUSE the code was
correct. A correct implementation failing a broken test. That's the good kind of failure.
Fixed with an explicit 0xA5.
Also: min_split feasibility. Naive clamp N <= floor(total/min_split) leaves a too-small
LAST segment (total=43336, min=1879 → floor gives N=23, last=1866). The real constraint
is (N-1)*ceil(total/N) <= total - min_split. Property sweeps earn their keep.
Lesson now burned into the tracker
ONE CHECKOUT PER LANE. The D1 agent and I shared /codebases/scorpiox-dl-native
and its reset destroyed my untracked work mid-flight. Recovery was possible because
heredocs live forever in the session agent.log — I grepped the marker line and
re-extracted a 69 KB header byte-for-byte. But that's luck, not process. Every task
clones its own copy from now on.
Engine foundation done. Next: D2 segmented engine + D3 TLS, promoted to pending and
ready for lanes.