A Requests page paired every Codex session file's calls with the
gateway's again on each query: clone, fold forks, match response ids.
That unpacked every session chunk three times and was about half of a
warm page (#3493). pairRowsMemo names the chunks of a pairing by their
serials (the probe chunk, which has none, by its rows' log offsets and
times) and keeps what the pairing found: the rows left out (skip,
matched), the actors it changed and each chunk's compactions. The next
query over the same chunks and window applies that to fresh clones
instead of pairing again. A changed file gets a new serial, a new
window or period misses, and adopt drops the memos with the parts.
Run at a6399dd49 (= origin/main, fetched):
- TestRequestPairsReusedAcrossPages (new): a gateway call paired with
its rollout, a fork copying another file's call and a Claude call,
every page of All/Today/Week at limit 1 and the whole page against
pageFromLedger. Broken by hand three ways, each red on the memo hit:
apply without matched ("all page 1: 4 rows, 157 input"), without skip
("4 rows, 127 input"), without compactions (page differs).
- Real data, same process (scratch test, not committed), fresh pairRows
vs the memo applied over a second read: sandbox with the live
rollouts (symlinked, read only) and a copy of usage.jsonl: All 15607
chunks, 4801 skip, 1469 matched, 2 actor sets; Today 58 matched; 7d
1075 matched. Actors, compactions, skip, matched equal, and pages
equal for 3 filters per period. Without the gateway log: All 15600
chunks, 4801 skip, all periods equal.
- Timing on that sandbox (load 110-143), page turns after the first:
v0.1.1449 mean 407 / 460 ms, this change 154 / 145 ms.
- go test -count=1 -timeout 45m ./internal/usage/... ./internal/usageapi/...
./internal/sessions/...: usageapi and sessions ok; usage red only on
TestUsageReadAfterAppendHashesNothingOnAFineClock/whole-second_stamp,
which is #3511 (taken by another session). At -count=20, load 154,
it fails 3/20 here and 2/20 at the base 1313b047f; it builds no page.
- gofmt -l clean; GOOS=linux and GOOS=windows go vet -tags nogui ok.
Not tried: the GUI against a live gateway; the page reads the same
QueryPage the tests and the real-data run used.