Files
magpie/docs
ggbdpqandfactory-droid[bot] 44b5b2b96b provider: a Claude usage ask invalidates an older read even in the same clock tick
Refs #1228. The original test fails with "a reading from before the ask
was kept". A temporary diagnostic measured identical UnixNano values for
the read's start and the later ask; that diagnostic is not shipped.

What changed:
- Count both whole-page and manual-card Claude asks with a generation.
  Advance it under subscription then login cache locks, so publication
  cannot check the old generation and then commit after the ask.
- Capture the generation before launching LoginUsage/SubscriptionUsage;
  reject an older account read or leave the cards due for another read.
- Record each Claude /usage run's ask generation. Keep timestamps, the
  zero sentinel, floor, idle behavior, saved-account scope and fallbacks.
- Document ordering and lock ownership in the providers/accounts design.
  No tests, routing.go, account files or dependency versions changed.

Run on upstream 8f2a314cf9:
- Original test unchanged: count=50 passes (12.317s). Product-only stash
  restores real red, count=30 (7.077s); pop then count=5 passes (2.137s).
- Expanded usage/header/saved-card paths race count=5 pass (122.691s),
  Go 1.26.8 and installed MinGW gcc, external sandbox home/temp and
  pinned Go caches.
- Provider nogui vet passes on Windows, Linux, Darwin. Windows default
  build and Linux/Darwin nogui builds pass. gofmt and staged diff clean.
- Provider full package and full ./... were not rerun; real account,
  GUI engines/languages, Darwin GUI build and cross-OS runtime not tried.
  Targeted evidence only, not a claim of complete merge acceptance.

Generated-by: Factory Droid (GPT-6.1 Sol)

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2026-10-13 06:43:00 +08:00
..