A pay-as-you-go key, a prepaid wallet, or an account whose use wasn't
read has Seat.Used read 0, and LeastUsed compared that 0 as if it were a
share of 0%: any subscription that had used more than nothing went after
every such key, so paid balance burned while subscription quota sat
idle. Smart and Pace already keep a seat whose allowance isn't known
behind those whose share was told; LeastUsed now does too: the shareless
go after subscriptions with room and before those running low or spent,
ordered among themselves by what a wallet has left and what magpie sent
a key lately. A learning account still goes first, once, as in Smart
and Pace. Pools of seats that all tell a share, or all tell none, are
ordered as before.
What changed:
- internal/routes/strategies.go: LeastUsed places seats by whether their
share was told (Known with a use past 0 or a renewal known) before the
Used comparison; its comment says so.
- internal/routes/routes_test.go: TestLeastUsedSeatsWithNoShare locks a
key behind subs with room, a wallet behind a told share and before a
key, keys past low and spent subs, a learning account first, and told
shares ordered by use as before.
Run:
- go test ./internal/routes/ -count=1 (fails on the parent at
TestLeastUsedSeatsWithNoShare: [key sub], passes with the fix)
- go vet ./internal/routes/, gofmt clean
Generated-by: GLM-5.3-Flash (ZCode)