Files
member-portal/app
inference-admin 2a77b0c988
ci/woodpecker/push/woodpecker Pipeline was canceled
spend: ONE all-time figure, computed once, for every surface that shows it
The panel's card said $941.37 and the member dashboard's said $900.51 for the
same claim. The panel used its own per-team query; the dashboard summed the
chart series IN THE BROWSER, which disagrees with the server whenever a row is
null, capped or stale.

coop_spend_totals() is now the definition: one GROUP BY over SpendLogs joined to
the team table, so
  spend_all_time      = every row (members, operators, agent teams, sandboxes) —
                        the same universe litellm_spend_by_day() sums, so the
                        cards and the money chart agree by construction
  own_all_time_spend  = the part that is the co-op's own (non-member teams, plus
                        rows with no team)
and member_all_time_spend = the rest. Exposed through /admin/overview (the
panel's boot payload), the money payload, and /broker/metrics (the dashboard's).
_coop_spend_totals_safe() returns {} rather than a zero: a failed computation
must never read as "the co-op has spent nothing".

tests/test_coop_spend_totals.py pins the arithmetic (total == member + own ==
every row) and the no-fake-zero rule.
2026-11-13 21:44:13 +00:00
..