litellm/tests/test_litellm/proxy/guardrails
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
..
guardrail_hooks refactor(ocr): complete native lifecycle and preserve Azure auth (#40734) 2026-09-12 11:56:49 -07:00
test_auto_router_compression.py fix(router): resolve team-scoped auto-routers by their public name (#40432) 2026-09-09 15:53:05 -07:00
test_content_filter_path_traversal.py Litellm OSS Staging 010626 (#29422) 2026-06-01 21:42:51 -07:00
test_content_utils.py feat(guardrails): add inspect_embeddings toggle for AIM and Cato (#39918) 2026-09-05 17:15:46 -07:00
test_custom_code_security.py feat(guardrails): add non-blocking flag() verdict to custom code guardrails (#39728) 2026-09-05 13:08:03 -07:00
test_deferred_guardrail_logging.py fix(proxy): accept both deferred stream logging arg shapes on native routes (#40869) 2026-09-12 14:10:58 -07:00
test_guardrail_coverage.py feat(guardrails): add Lakera v2 skip-message honoring and advisory (inject_system_message) mode (#34940) 2026-08-28 14:13:49 -07:00
test_guardrail_endpoints.py fix(guardrails): accept on_violation block and alert for mcp_security (#40155) 2026-09-07 14:33:02 -07:00
test_guardrail_registry.py Merge pull request #39243 from BerriAI/litellm_fix_guardrail_event_hook_resync 2026-09-03 14:37:52 -07:00
test_init_guardrails.py feat(guardrails): add Lakera v2 skip-message honoring and advisory (inject_system_message) mode (#34940) 2026-08-28 14:13:49 -07:00
test_llm_as_a_judge.py test: require a match= on broad pytest.raises, and drop duplicate parametrize cases (#37769) 2026-08-20 20:24:49 -07:00
test_mcp_jwt_signer.py fix(mcp): JWT on tools/list and REST tools/call server resolution (#28227) 2026-05-20 13:31:44 -07:00
test_pillar_guardrails.py test: drop the cwd-relative sys.path.insert calls from the test suite (#37802) 2026-08-22 09:25:58 -07:00
test_prompt_security_guardrails.py fix(guardrails): block Prompt Security file modifications 2026-09-01 12:00:32 +03:00
test_qostodian_nexus_guardrail.py test: enforce F811 so a duplicate definition cannot silently replace the first 2026-08-21 12:06:19 -07:00
test_usage_endpoints.py Merge pull request #39853 from BerriAI/litellm_guardrail_usage_cost_ui 2026-09-05 14:41:11 -07:00
test_usage_tracking.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