litellm/tests/test_litellm/proxy/utils
mateo-berri 2863559ba8 fix(proxy): wait for the spend-log table before creating startup views
On a fresh database where the migrations run in a separate job while the
proxy boots with DISABLE_SCHEMA_UPDATE=true, the startup view check ran
as a fire-and-forget task, used up its three 10 second retries before
LiteLLM_SpendLogs existed, and died with an unretrieved exception. The
spend views were never created, so the /global/spend routes returned 500
until the pod was restarted

PrismaClient now holds a view setup task. It polls to_regclass for the
spend-log table every 5 seconds, creates the views and loads the spend
log row count once the table is there, keeps polling if an attempt raises
while the schema is still settling, and logs an ERROR with the last
failure if nothing worked after 15 minutes. Proxy shutdown cancels the
task

The spend route e2e tests for the five view-backed routes are no longer
skipped and wait for the views through the harness convergence helper
2026-09-19 08:36:22 -07:00
..
helpers fix(proxy): keep litellm_call_id on shaped errors and list_batches failure hook 2026-09-16 03:02:50 +00:00
prisma_and_spend fix(proxy): wait for the spend-log table before creating startup views 2026-09-19 08:36:22 -07:00
proxy_logging fix(policy_engine): keep the per-choice rebuilt response's choices a list so legacy hook rewrites survive the model_dump round-trip 2026-09-18 23:53:02 -07:00
__init__.py test(proxy/utils): pin bottom-of-file helper behavior (#29509) 2026-06-02 17:45:19 -07:00