mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-23 00:41:40 +00:00
Three review points, one theme: state that was true in the tests but not expressed in the code. `autorouter_savings_spend` was a required key on `BaseDailySpendTransaction` while every reader coalesces a missing value to zero and the aggregation is explicitly tested against rows that omit it. Rows queued by a pod on the previous release, or replayed from the Redis buffer across an upgrade, carry no such key, so the honest declaration is NotRequired. Requiring it also made every construction site outside this PR a type error for no gain. The derived baseline was cached behind a value plus a separate "have we derived yet" flag, so a baseline of None was indistinguishable from an uncomputed one until the flag was consulted. `cached_property` already stores None as a real cached value, so both attributes and the flag collapse into one declaration and the ambiguity is gone by construction rather than by discipline. `_baseline_usage` moves the cache-creation tokens into the cached count and drops the creation charge, which is the whole point of the counterfactual and was readable only to someone who had absorbed the PR description. It now says so where it happens. The pairing test that enumerates additive metrics now unwraps NotRequired, so a metric declared that way is still covered rather than silently skipped. |
||
|---|---|---|
| .. | ||
| db_transaction_queue | ||
| mcp_server | ||
| conftest.py | ||
| test_check_migration.py | ||
| test_create_views.py | ||
| test_db_spend_update_writer.py | ||
| test_db_url_settings.py | ||
| test_exception_handler.py | ||
| test_exception_handler_reconnect_retry.py | ||
| test_prisma_client.py | ||
| test_prisma_planned_engine_restart.py | ||
| test_prisma_self_heal.py | ||
| test_query_engine_reaper.py | ||
| test_rds_iam_token_expiry.py | ||
| test_replica_identity.py | ||
| test_routing_prisma_wrapper.py | ||
| test_spend_log_tool_index.py | ||
| test_tool_registry_writer.py | ||