Files
magpie/internal/budget
yetone 8b2fb6b082 budget: a kept window is reused only for a limit that starts when it did (TestGatewayKeyLimitCLI)
059d995d5 keeps what AllOf counted of each window, keyed by window{key,
start's Unix second, scope}. A 10-day limit reset and then made a
5-hour one a millisecond later share that key, so the 5-hour status
took the 10-day prefix: its Start was the 10-day Since, its Reset the
5-hour one, 5h0m0.0017s apart, and the rows it counted were from the
old start. CI at 61a04f42a was red on ubuntu and macOS for it.

A kept entry is reused now only when its start is the limit's own.

Run (mote is out of disk and refuses ssh, so WSL and the Windows box):
- TestAllOfKeptWindowIsOfItsOwnStart (new): red on the old code with
  Start 14:36:23.1, Reset 19:36:23.1017, green with the fix.
- go test ./internal/budget ./internal/access: ok on WSL (-count=3)
  and Windows.
- go test -run TestGatewayKey -v ./internal/cli: all 11 pass on
  Windows, and with -tags nogui on WSL; TestGatewayKeyLimitCLI is the
  CI red.
- go vet ./internal/budget, gofmt -l: clean.
- internal/gateway on Windows: TestClaudeAsRootEnv red (#2425, open),
  and the package hit the 10m default timeout; not on this path.
Not tried: a full ./... run.
2026-11-11 14:55:15 +08:00
..