litellm/tests/unit/accounting
moe-berri 701639ea22
feat(alerts): detect daily changes in recorded usage (#50666)
* feat(alerts): detect daily changes in usage for gateway, models, teams, users and keys

* fix(alerts): drop unused suppressions

* fix(alerts): satisfy strict lint for model usage timing

* fix(alerts): skip only resources that time out or hold invalid data

* fix(alerts): log an unfinished daily sweep at info level

* fix(alerts): keep the deployment-wide run every five minutes

* fix(alerts): record alert and sweep timestamps in UTC

* fix(alerts): repair detector tests and tracing

* refactor(alerts): build the key index in a migration instead of after startup

* refactor(alerts): build the key index after startup again

A concurrent index build inside the boot migration can exceed the 600 second migrate deploy deadline on a large LiteLLM_DailyUserSpend and stop the proxy from starting. This reverts 393db6e4e0.

* fix(alerts): keep keys pending, bound the accounting wait, resume unfinished scopes

Keys waiting for their index no longer mark the day complete. Only deliveries created during the evaluated day hold back its sweep. A day that did not finish restarts the next day from where it stopped instead of a hash boundary that never rotated non-hex IDs.

* refactor(alerts): drop the pending delivery wait, alerts are best effort on flushed usage

* test(alerts): cover detector persistence and recovery

* fix(alerts): recognize Prisma statement timeouts
2026-11-11 18:23:02 -08:00
..
__init__.py feat(accounting): add accounting contracts, PricingSnapshot and ledger schema (LIT-10193) (#48862) 2026-10-28 14:39:25 -07:00
test_delivery_projection.py feat(accounting): add opt-in SpendLogs ledger (#49856) 2026-11-04 17:49:15 -08:00
test_metrics.py fix(accounting): stop delivery metrics from scanning retained receipts on every flush (#50565) 2026-11-07 18:21:32 -08:00
test_projection.py feat(alerts): detect daily changes in recorded usage (#50666) 2026-11-11 18:23:02 -08:00
test_worker.py fix(accounting): keep delivering spend when another worker's maintenance lock is orphaned (#50774) 2026-11-09 18:53:51 -08:00