Every 15 s poll made the whole deduped file list again (~1.5 MB on a
real history, distinctOf's 58 MB over 40 polls). allFiles and
allFilesForTitles now compare each pass with the last list, held
weakly so a magpie with the page shut keeps none of it, and give the
same array back while nothing differs. A changed or gone file makes a
new list; the old one is never written into (cap == len). An empty
pass is an empty slice, never nil: refresh reads nil as "not listed"
and kept the parses of deleted files (TestGoneAgentLeavesNoSession
went red on the first try, caught before commit).
Run (mica): go test -count=1 -timeout 45m ./internal/sessions/
./internal/dirent/ ok; go vet of both ok; gofmt clean.
Broken by hand: the nil return makes TestFilesKeptWhileTheSame ("an
empty pass: nil") and TestGoneAgentLeavesNoSession ("5 parses kept")
red; a fresh slice on every pass makes TestFilesKeptWhileTheSame red.
Real account on mote, 40 unchanged /api/sessions polls, alloc_space:
179.5 MB (v0.1.3794 build) -> 147.9 MB; distinctOf gone, the kept
list's own compare 12 MB. /api/sessions body sha identical on both.
Not run: the full ./... suite (mote over its cores; this touches the
sessions package only) and the GUI suite.