usage panel: verified for one account, not for two

the owner confirmed it live the same day. what that leaves untested is the
half the cache exists for — a second login, the tabs, a stored row surviving
a switch — so the docs now say which half is proven instead of claiming
neither is.

also records the bug the first deploy found, since the doc had asserted the
degradation that turned out to be broken.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-18 05:12:47 +00:00
co-authored by Claude Opus 5
parent 3cc9df27d7
commit 0f93262a8c
2 changed files with 24 additions and 21 deletions
+12 -3
View File
@@ -1,8 +1,12 @@
# The AI usage panel
**Built 2026-08-18. Never run against a live server.** The parts with unit tests are noted below; nothing
here has been exercised through HTTP, through a real turn, or with two accounts. The test plan at the end is
what "tested" would mean.
**Built and running 2026-08-18. Verified for ONE account, never for two.** The owner confirmed the panel
live the same day: limits, countdowns, tokens by day and by model all render against the signed-in account.
What that leaves untested is the half the cache exists for — a second Anthropic login, the account tabs, and
a stored row surviving a switch. Group C of the test plan below is that, and it is the only part still worth
running. It will be run when it is needed rather than pre-emptively, since the failure it would catch costs
nothing but a wrong tab.
Click the harness pill in the chat composer — the label reading **Claude Code**, left of the background-job
button — and it opens what Claude Code's own usage display shows: limits with reset countdowns, tokens by
@@ -18,6 +22,11 @@ pm2 restart officer officer-claude-code
`db:push` first. Without the table the panel still opens and still shows the signed-in account — the stored
read catches and returns an empty list — but there are no tabs and nothing survives an account switch.
That degradation was not free: it was broken on the first deploy and fixed the same day. `snapshotClaudeUsage`
had the read and the write in ONE `try`, so a missing table threw on the upsert and discarded a perfectly good
reading — the panel said "Not signed in" over an account that was signed in fine. The write has its own `try`
now, and `usage-store-degradation.test.ts` holds the line.
Both processes are needed for the _other_ change that shipped alongside this (`model:resolved`, see
"Related" below). The usage panel itself only needs `officer`.