spend: name the unattributed slice of own spend for posterity

own_all_time_spend already includes SpendLogs rows that join to no team alias,
but the remainder was unnamed, so every reader had to notice it by subtraction.
coop_spend_totals() now reports own_unattributed_spend and both payloads
(/admin/overview totals and admin/money-series totals) carry it: the gateway's
own overhead, historically the master-key audio keepalive pings (~$3.21 over
16,894 rows before the 2026-11-28 key split).

History is labelled, never rewritten: LiteLLM_SpendLogs is the system of record
and the portal keeps read-only access, so no team_id is backfilled.
This commit is contained in:
inference-admin committed 2026-11-28 14:03:47 +00:00
1 parent aba53eabb5
commit 1191bcd521
2 files changed
+20 -3

No files matched your search

+4
View File
@@ -77,6 +77,10 @@ try:
f"member side is the member: teams ($10.005 + $5.005 -> 15.01, got {t['member_all_time_spend']})")
check(t["own_all_time_spend"] == 2.59,
f"own side is everything else: agents, sandboxes, unattributed (got {t['own_all_time_spend']})")
check(t["own_unattributed_spend"] == 1.07,
f"rows that join to no team alias are named, not left as a silent remainder (got {t['own_unattributed_spend']})")
check(t["own_unattributed_spend"] <= t["own_all_time_spend"],
"unattributed is a part of own, never added on top of the total")
check(t["spend_all_time"] == round(t["member_all_time_spend"] + t["own_all_time_spend"], 2),
"total == member + own, so no dollar is counted twice or dropped")
check(t["spend_all_time"] == round(sum(r[1] for r in ROWS), 2),