Commit Graph
1 Commits
Author SHA1 Message Date
yetone 186453e009 provider: a plan key's card says when it was read (jiabubu)
jiabubu (Discord #feedback): on Usage -> Overview the Kimi Code card
showed no "Updated ..." line while every other provider's card did.
The GUI's readWhen shows it only when a quota carries readAt, and
PlanQuotas' key plan cards (Kimi Code, OpenCode Go, GLM Coding Plan,
MiniMax, Ollama, Command Code) and StepFun's, Volcengine's and
Tencent's never set it. Each now goes through readNow, which stamps
a reading that worked and has windows or a balance, as the other
subscriptions' cards already did. A failed read is left alone.

Test: TestPlanKeyCardSaysWhenRead (sandbox HOME, a fake Kimi
/coding/v1/usages, a kimi-code-cn key) wants the card's ReadAt between
the call's start and end.

Run on mote at this tree:
- go vet ./internal/provider: darwin, GOOS=linux -tags nogui, windows
- go test ./internal/provider: ok (184s)
- go test -run 'Quota|Usage|Plan|Balance' ./internal/gui ./internal/cli: ok
- gofmt -l: clean
Broken by hand: without readNow on the plan path the test is red
("readAt <nil>, asOf <nil>"); green with it.

Not tried: a real Kimi Code key; no GUI test, since the page already
draws readAt when the API gives it and the omission was the API's;
Windows/Linux runs.
2026-11-04 16:55:33 +08:00