providerInfoWith grew a row's model list by append for the decision
models the vendor list lacks and for the picks it lacked, then grew it
again with slices.Insert to put those picks in front, and grew Agents
one append at a time. The rows are now counted first and each list is
made once at its size, in the same order as before.
Real accounts (sandbox copy of the owner's HOME, network blocked),
40 polls of /api/state, /api/providers and drift, pprof alloc_space
between the two heap snapshots, v0.1.2484 (mhost) vs this (mrows):
providerInfoWith flat 50.7 MB -> 38.5 MB, cum 164.9 MB -> 138.8 MB
providersState cum 273.2 MB -> 270.5 MB (the total is noisy +-25 MB
from the state encoder's pooled buffers: 621 vs 637 MB)
/api/state and drift bodies byte-identical; /api/providers equal
but for `fetched` and one login's `lapsed`, set by a refused refresh
in the blocked sandbox when a token came due during one of the runs
(logins_on.go), a path this change doesn't touch.
TestProviderRowListsMadeAtTheirSize: 107 rows from 100 listed models,
7 picks the list lacks plus one it has, 3 agents; picks in front in
their order, cap == len for Models and Agents. On the old
providers.go (at HEAD) it fails: "models made for 219, 107 rows".
Forcing growth by hand in the new code fails it the same way.
Run on mote at this tree: gofmt, go vet, GOOS=windows go vet ok; the
new test and the model-order tests 3/3 ok; go test ./internal/gui:
only the known reds TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
TestMainWindowCorners (#3949) failed.
Not run: the full ./... suite.
providerInfoWith grew each provider's Models from nothing, and put each
model the user picked that its vendor no longer lists at the front with
an insert, a copy of the whole list each time. In twenty polls of the
Providers page with real accounts that was 13 MB of copies and 22.6 MB
of growth. The list is now made at its length, and the unlisted picks
are put in front with one insert, in the order they were before.
TestUnlistedPicksShownFirst: Available a, b and Exposed a, x, y, z show
as z, y, x, a, b with four exposed, as before.
Run on mote (macOS 27):
- gofmt, go vet ./internal/gui (darwin, windows, linux): ok
- the new test alone, 3 runs: ok
- broken by hand (the reverse taken out): red, "models shown as
[x y z a b], want [z y x a b]"
- go test ./internal/gui: ok but for two reds already filed and red on
main: TestSettingsSaveKeepsWhatItDoesNotSend (#4514) and
TestMainWindowCorners (#3949)
Not run: the whole suite; this changes one function of internal/gui.