← back to AbramsEgo

build-queue/done/25-donut-paid-zero-label.md

26 lines

# AbramsEgo task 25 — donut mislabels paid-but-idle providers as "$0 (local)"

Read SPEC.md. Steve HARD rule: every cost figure labeled honestly; ONLY free/local shows
`$0 (local)`. The provider donut legend (`renderProviderDonut`, `public/index.html` ~line 397)
computes `const amt=(p.local||(p.total||0)===0)?'$0 (local)':usd(p.total);` — so ANY provider
with $0 spend in the 30d window gets the "(local)" tag, even a metered PAID one. Live right now:
**browserbase** (~$47 all-time, ~15¢/session) renders as "$0 (local)". That's the exact
hidden-spend mislabel the rule exists to prevent. Server side is already correct: `server.js`
line 567 sets `local: /\(local\)/i.test(provider)` — trust it.

~5 min, surgical:

1. In `public/index.html` ~line 397 change the amount to trust the server flag:
   `const amt = p.local ? '$0 (local)' : usd(p.total);`
   Paid-but-idle providers now show `$0.0000` (honest: paid, no spend this window),
   truly-local ones keep `$0 (local)`.
2. `pm2 restart abramsego`, then verify:
   `curl -s -u admin:'DW2024!' http://127.0.0.1:9773/api/data | python3 -c "import sys,json;print([(p['provider'],p['total'],p['local']) for p in json.load(sys.stdin)['cost']['byProvider']])"`
   — confirm browserbase has `local: False`; load http://127.0.0.1:9773/ and confirm the legend
   row for browserbase reads `$0.0000` (not "(local)") while Ollama-style rows keep `$0 (local)`.
3. Commit:
   `git add -A && git commit -m "fix: donut legend only labels truly-local providers \$0 (local) — paid-but-idle shows honest \$0" --author="Steve <steve@designerwallcoverings.com>"`

Do NOT touch the donut geometry, colors, or the server's deriveProvider mapping — they're
correct. Local only, no deploy.