A first build pairs four days at a time, but a chunk was taken whole
into each span it reached. A session file or ledger block written over
weeks was paired in every span: on the owner's history the late spans
paired ~257k rows each, near all of it, ~230k of them from ~180 such
chunks. coldSpans now takes a chunk reaching past a span's
[from-heatReach, to+heatReach) as its rows within that window, and its
rows of no time, as a chunk of its own (rowChunk.within). Rows past the
reach pair with nothing counted in the span. Lazy gateway blocks and
chunks with raw rows are taken as before.
Run (mote, at this head):
- go vet ./internal/usage; GOOS=linux and GOOS=windows go vet
./internal/usage: ok.
- go test -count=1 ./internal/usage ./internal/usageapi: ok.
- TestFirstBuildPairsSpans gains a Codex thread written over 20 days,
each call with its gateway record; spans of 1, 4 and 14 days must
match pairing at once (total 11).
- Broken by hand: within keeping no rows -> TestFirstBuildPairsSpans
red (the long thread's effort 71 vs 141 at once). Not caught: a
window narrowed by heatReach on each side stays green, since the
fixture's call and its record are a second apart.
- Real history (owner's, sandbox HOME copy, cold start, 3 runs each,
against v0.1.2310's change): phys_footprint_peak 313/318/317 MB vs
324/318/325 MB (avg 316 vs 322). CPU 4:15/4:07/4:04 vs
4:10/3:58/3:59 at load ~23 (within noise, maybe +2%). The span log
shows the late spans' rows 256,871 -> 144,691. heatmap, sessions
overview (0/7/30) and stats (0/30) JSON byte-identical in all three
runs; requests equal to 1e-9 (summation order).
Not changed: the peak now sits on the requests page's first build
(~73MB) beside the sessions stats cache (~85MB retained) and Codex
effort (~28MB); those come next.