dog/WEAVE (umbrella)
graf/WEAVE is the token-level file-history engine (SCCS-weave: one interleaved-delta TLV per file, birth-id (seq,pos) per token). It is graf-only, its on-disk form needs a 7-buffer BASS decode on every op, and its merge aligns POSITIONALLY (the DIS-003 root cause). Rework it as a columnar, HUNK-compliant dog/WEAVE — weave{text,toks,ins,rms,commits} — reusable by every dog and keyed on real commit ids. Full API + wire form in api. This is the umbrella; work lands via DOG-002..DOG-005.
graf/WEAVE.{c,h} (~1300 LoC) — interleaved T/R TLV, decoded
into 7 parallel BASS arrays (WEAVE_DECODE/wdec) on every op.
seq the caller must assign equally on bothmerge sides; the SHA-keyed topo-sort is non-total → the DIS-003 flake.
weave, though the wire form is already HUNK-adjacent (text+tok32).
wdec: text + tok end-offsets + seq/pos + R-set pool)is ALREADY the columnar shape this rework makes canonical.
dog/WEAVE: parsed view weave{text,toks,ins,rms,commits} over a
HUNK-compliant blob; zero-copy WEAVEParse, no per-call decode.
(commits[ins], per-commit ordinal), commits[i] a stable
u64 = high 64 bits of the commit sha1 — the DIS-003 robust fix.
WEAVENext (linear fold) + WEAVEMerge (identity interleave);
WEAVEProduce reproduces ANY past rev as scoped-alive bytes.
dog/-layer so sniff/keeper/spot/bro can weave too, not just graf.tok32 offset is 24-bit → 16 MiB cap on a weave's cumulative text; filesover it drop to a coarse blob-level fallback (shared with DIFF-007).
commits[0] = spine/root; reserved high u64s replace the old
WEAVE_WT_SRC/WEAVE_CFLCT_SRC sentinels.
scope (ancestor closure) is supplied
by graf's DAG, mapped through commits[] — same split as today.
abc/ API change without review; the diff core relocates via DOG-002.
'X'/'K' sub-records stay byte-identical to HUNK so a weave projects to a hunk for free. Outer 'W' container adds 'I'/'M'/'C'.
pos dropped, recomputed as the per-commit ordinal in weave order (bothmerge sides enumerate a shared commit's tokens identically — keeps "two a's of aa" distinct).
tok32 side reused as two bits {in,rm}; custom bit = multi-remover flag.
in-off ⇒ spine inserter; rm reads 1 (or count+N if custom) from rms.
commits[] (bit i = slot i
active, bit 0 = spine always set) — classification is a bit-test, no WEAVEsetfn. Built once per op from a u64cs of active hashlets at the DAG boundary (WEAVEScope). WEAVEMerge replaces WEAVEApply.
WEAVENext diffs the new blob against
the running weave's alive view — NO base_scope arg. Forks fold via WEAVEMerge; an "evil merge" is WEAVEMerge then WEAVENext.
next), not as parallel isolated clones.
BRAM+NEIL to dog/ (prereq: dog/ can't dep up).Parse/Next/Merge/Produce + cursor + tests.Emit{Diff,Full,Merged}+Alive/Produce + cap fallback.graf/WEAVE; update both INDEX.md.DIFF-007 (outtoks overflow), MEM-036/MEM-040 (TLV-builder OOB/leak).
u64 identity assumes no high-64-bit sha collision within one
file's commit set; guard with a must() on table insert.