Files
magpie/internal
yetone d03779cc10 usage: the Requests page's seen message ids are hashes, not copies
visibleLocal leaves out a Claude message written again in another file
(a resumed or forked session's copy). It kept every id it had seen as a
strings.Clone of the decoded chunk's string, so a long history's ~400k
ids were copied on each page build: ~7MB held at the start's peak and
27MB more allocated per run. It now keeps two maphash values of each id
(seeds made per process); two ids alike in both are ~1e-28 likely.

Measured with the real ~/.codex and ~/.claude histories (sandbox HOME,
fp3 harness), base bbb4fd478 vs this change, two alternating runs:
  visibleLocal allocated   81MB -> 55MB per run (the clones gone)
  footprint at the end     170 / 174MB -> 166 / 170MB
  footprint peak           275 / 278MB -> 252 / 277MB (noisy)

No test guarded the dedupe: breaking it by hand left ./internal/usage
green. TestVisibleLocalLeavesOutRepeatedMessages is new; with the
seen check turned off by hand it went red ("left out map[]").

Run at this head: gofmt clean; GOOS=linux and GOOS=windows go vet
-tags nogui ./internal/usage; go test -timeout 45m -count=1
./internal/usage ./internal/gui ok.
Not run: the full ./... suite (only internal/usage changed).
2026-10-27 04:58:22 +08:00
..
…
…
…