While the host hasn't listed the plugins' providers (just started, or it
can't: offline, or a plugin that fails), Cached read and decoded the whole
plugin-providers.json on every call. The window's 15s drift poll asks it
for each look at a plugin's model (pluginOfAgent, PluginOf,
pluginAccounts), so on a real config copy it was 31.7MB of the 47MB the
poll allocated in two minutes (Unmarshal 21.8MB, ReadFile 9.45MB).
savedProviders reads it through filememo, parsed once per version of the
file. What it gives is shared; Cached's loop copies each provider before
setting its accounts, as it already did with provCache. A file that only
partly decodes keeps what decoded, as before.
Run (mote, at origin/main 773902a77 + this):
- TestCachedReadsSavedProvidersOnce: ok. Broken by hand (the per-call
decode back): red, 3657 allocations for a 300-provider file, want <=100.
- gofmt -l clean; go vet ./..., GOOS=linux go vet -tags nogui ./...,
GOOS=windows go vet ./...: ok.
- go test -count=1 -timeout 45m ./...: 86 packages ok;
internal/gui red only in TestMainWindowCorners/macOS_26_SDK, #3949
(that test on macOS 27, untouched here).
- Drift poll on a real config copy (8 calls in 2 minutes): plugin.Cached
gone from the profile, Values 34.4MB -> 14.9MB, Drift 45.4MB -> 37.9MB.