litellm/tests/test_litellm/proxy/db
devin-ai-integration[bot] 56045503db
fix(proxy): bound tool and guardrail index create_many by the spend-log statement budgets (#40561)
* fix(proxy): bound tool and guardrail index create_many by the spend-log statement budgets

One flush drains up to MAX_LOGS_PER_INTERVAL source transactions or logs, but a
transaction fans out to one LiteLLM_SpendLogToolIndex row per tool and a log
to one LiteLLM_SpendLogGuardrailIndex row per guardrail, so the index
create_many payload was unbounded. Both index writes now go through
spend_log_write_batches(SPEND_LOG_WRITE_BATCH_MAX_BYTES, SPEND_LOG_WRITE_BATCH_MAX_ROWS).
The tool index write moves out of the rollup batch_() so the split reduces
the query-engine payload; replayed index rows are no-ops under
skip_duplicates, and the daily rollup upserts stay in one transaction

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

* test(proxy): pin the row budget in the index fan-out tests

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

---------

Co-authored-by: yucheng <yucheng@berri.ai>
Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-09-12 19:00:47 -07:00
..
db_transaction_queue fix(caching): let only the recovery probe close a half-open Redis breaker 2026-09-10 18:36:19 -07:00
mcp_server refactor(repositories): type prisma table access with one generic protocol 2026-08-25 12:14:17 +00:00
conftest.py test: count a zombie grandchild as killed in the fake prisma cli 2026-09-09 10:01:22 +00:00
test_autorouter_session_rollup.py feat(auto-router): show routed model and savings in Claude Code and Codex (#40330) 2026-09-11 12:52:42 -07:00
test_budget_window_spend_writer.py fix(proxy): keep persisted spend another pod has not incremented in the window seed 2026-08-31 15:49:03 -07:00
test_check_migration.py fix(proxy): kill the whole prisma process group when a boot migration command times out (#39509) 2026-09-08 10:06:53 -07:00
test_create_views.py fix(proxy): guard every view creation, not just the first and last 2026-08-13 14:41:59 -07:00
test_daily_spend_bulk_upsert.py feat(spend): report prompt caching savings as total and gateway-attributed (#38134) 2026-08-28 00:19:06 -07:00
test_db_spend_update_writer.py Merge pull request #39556 from BerriAI/litellm_fix_spend_log_flush_event_loop_binding 2026-09-08 15:59:11 -07:00
test_db_url_settings.py fix(db): carry DATABASE_SSLMODE/DATABASE_SSLROOTCERT into the assembled writer and reader URLs (#40815) 2026-09-12 02:14:39 +00:00
test_exception_handler.py fix(proxy): recreate the Prisma client when the writer session turns read-only (#40610) 2026-09-10 13:53:42 -07:00
test_exception_handler_reconnect_retry.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_gateway_request_tracking.py perf(proxy): collapse per-worker SGR upserts into one statement per flush (#40362) 2026-09-09 10:48:06 -07:00
test_health_check_latest.py fix(proxy): dedup latest health checks in SQL and gate the DB save per window 2026-09-03 11:33:44 +02:00
test_model_access_group_spend.py test(proxy): pass the window spend args in the access group requeue test 2026-08-29 16:36:04 -07:00
test_pgbouncer.py test(pgbouncer): stop the never-listens replacement test flaking under CI load (#40830) 2026-09-11 19:32:56 -07:00
test_prisma_client.py fix(db): carry DATABASE_SSLMODE/DATABASE_SSLROOTCERT into the assembled writer and reader URLs (#40815) 2026-09-12 02:14:39 +00:00
test_prisma_planned_engine_restart.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_prisma_self_heal.py fix(proxy): recreate the Prisma client when the writer session turns read-only (#40610) 2026-09-10 13:53:42 -07:00
test_proxy_worker_heartbeat.py fix(proxy): count worker heartbeats on the primary so replica lag cannot undercount 2026-08-14 17:23:06 -07:00
test_query_engine_reaper.py test(proxy): isolate reaper state and reap Prisma fixture children 2026-09-08 17:35:43 -07:00
test_rds_iam_token_expiry.py fix(tests): stop DATABASE_URL env pollution from read-replica tests breaking DB e2e tests (#32653) 2026-07-09 14:37:49 -07:00
test_replica_identity.py fix(proxy-extras): kill the whole Prisma process group when a command times out 2026-09-02 18:29:55 -07:00
test_routing_prisma_wrapper.py fix(db): carry DATABASE_SSLMODE/DATABASE_SSLROOTCERT into the assembled writer and reader URLs (#40815) 2026-09-12 02:14:39 +00:00
test_shadow_eval_funnel.py feat(shadow_eval): measure both arms' cost so a job reports what the router would have saved (#38631) 2026-08-28 15:13:19 -07:00
test_spend_counter_reseed.py perf(proxy): one MGET and one pipeline for post-call spend counters, no team/user/org refetch on the response path (#40841) 2026-09-12 16:05:50 +00:00
test_spend_log_batching.py fix(spend): bound each spend-log write statement by row count as well as bytes (#37758) 2026-08-21 09:49:51 -07:00
test_spend_log_tool_index.py fix(proxy): bound tool and guardrail index create_many by the spend-log statement budgets (#40561) 2026-09-12 19:00:47 -07:00
test_token_auth.py fix(proxy): keep token-auth URLs, toggles, and refresh sleeps safe 2026-08-20 12:59:58 -07:00
test_tool_registry_writer.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00