← back to AbramsEgo

build-queue/done/10-finish-provider-donut.md

25 lines

# AbramsEgo task 10 — FINISH + verify + commit the per-provider cost donut (SPEC panel 3)

Read SPEC.md. The donut is already CODED but not landed: `server.js` computes `cost.byProvider`
(see the `byProvider` block ~line 444–495) and `public/index.html` has `renderProviderDonut()`
(~line 376) + the `#costproviders` element. BUT the LIVE API returns `cost.byProvider: null`, so the
card shows "no provider data". The prior attempt (08) timed out at 15 min (rc=142) mid-verify and left
`server.js` + `public/index.html` uncommitted. Your job is the SHORT finish — do NOT rewrite the donut.

KEEP IT SURGICAL — this failed once on timeout. Do the ONE wiring fix, verify, commit. ~10 min.

1. `pm2 restart abramsego`, then:
   `curl -s -u admin:'DW2024!' http://127.0.0.1:9773/api/data | python3 -c "import sys,json;print(json.load(sys.stdin)['cost'].get('byProvider'))"`
   - If it now shows a non-empty array → the running instance was just stale. Skip to step 3.
   - If still `null` → trace ONE bug: confirm the fn that builds `cost` actually assigns
     `out.byProvider = series.byProvider` AND that the value returned by the cost collector is the
     one wired into `/api/data`'s `cost` key (not a second, older cost path). Fix the single wiring gap.
2. Re-restart + re-curl until `byProvider` is a non-empty `[{provider,total,...}]` array.
3. Load http://127.0.0.1:9773/ (Basic Auth admin:DW2024!) and confirm the donut + legend render in the
   "Cost to run · 30d" card, each provider shows its `$` (free/local → `$0 (local)`).
4. Commit (this lands the uncommitted server.js + index.html too):
   `git add -A && git commit -m "feat: finish per-provider cost donut (SPEC panel 3)" --author="Steve <steve@designerwallcoverings.com>"`

Do NOT deploy. Local only. If byProvider genuinely can't populate in <12 min, commit what renders
cleanly (donut with the "no provider data" fallback intact) and note the blocker — don't loop.