A TypeSafe Jev provider with several keys never left its first key when that
one's quota ran out. serveSystemOne and the classifier (askClassifier → askJev)
always sent to p.Key, with no rest and no rotation. Only a decision group
failed over (serveDecisionGroup, askDecisionGroup).
Now the single provider goes the same way as a group:
- decideKeys plans its keys and accounts with s.plan, so Smart or In order,
rests and barred keys apply. probeOne keeps only the resting one back
soonest.
- serveDecideTries and askDecideTries (the group's loops, pulled out) ask
each in turn. A retryable failure that isn't the request's own rests it and
the next is asked.
- serveSystemOne keeps #905's limits. A gateway key held to some accounts is
asked only on those (allowedCandidates), and gets 403 keyAccountsError when
none serves the model.
- A provider whose every key is set not to serve the model is refused 403
(barredError) instead of being sent on its first key.
- decideSeat is gone; the trace lists every key tried.
- docs/subsystems/gateway-routing.md says so.
Run: go test -p 1 -tags nogui -run 'SystemOne|Decid|Decide|Jev|Classif|
KeyAccount|KeyModel|Disabled|RemoteMagpie|Caller|Usage|Plugin.*Decide|
Barred|Rest|Probe' ./internal/gateway (ok, 124s).
TestDecisionProviderKeysFailOver (Smart and In order) refuses the first key
429 and checks:
- /v1/systemone answers 200 from the second, the trace has two tries and the
first rests, and one usage row goes to the provider;
- the next request asks only the second;
- the same holds through askClassifier.
Broken by hand: with the old decide.go, decide_group.go and classify.go it
fails "systemone: 429 no capacity for k1" in both. The first version of the
reordering ran the barred check before the held-key one, and
TestGatewayKeyAccountsSystemOne caught the changed 403 message. The held
check now runs first.
gofmt -l clean; GOOS=darwin/linux/windows go vet -tags nogui
./internal/gateway ok.
Not tried against the real TypeSafe API.
Full suite: SUITE_LINE