litellm/tests/unit/litellm_proxy_extras
Kerry Lu 22667fb0a8
fix(proxy-extras): roll back a migration killed at the deploy time limit (#54284)
* fix(proxy-extras): roll back a migration killed at the deploy time limit

When prisma migrate deploy hits LITELLM_PRISMA_MIGRATE_DEPLOY_TIMEOUT the runner kills
Prisma, which left a started-but-unfinished ledger row and a Postgres session that
could still commit the migration later. Every later boot then stopped on P3009.

Each deploy attempt now names its Postgres sessions. After a kill the runner ends
those sessions, waits until they are gone, and marks the row the attempt left
rolled back, so the next attempt or the next boot can apply the migration again.

* fix(proxy-extras): only roll back a killed migration that is proven not to have committed

Roll the row back only when the killed deploy's session was seen still running its statement and its
open transaction is recorded as aborted after the session is ended. Measure the row's age from the
start of the deploy, and redact the database error before logging it.

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

* fix(proxy-extras): roll back every migration killed at the deploy time limit

Once the killed deploy's sessions are ended and gone, its row is rolled back without also requiring
proof that the migration had not committed.

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

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
2026-11-24 23:52:42 +00:00
..
__init__.py
conftest.py fix(proxy): tolerate unavailable psycopg during migrations (#53146) 2026-11-20 11:29:41 -08:00
test_litellm_proxy_extras_logging.py
test_litellm_proxy_extras_utils.py fix(proxy-extras): roll back a migration killed at the deploy time limit (#54284) 2026-11-24 23:52:42 +00:00
test_migration_data_checks.py feat(proxy): replace the pre-migration row check with a rolled-back dry run of the pending migrations (#48961) 2026-10-29 09:39:26 -07:00
test_migration_dry_run.py feat(proxy): replace the pre-migration row check with a rolled-back dry run of the pending migrations (#48961) 2026-10-29 09:39:26 -07:00
test_prisma_toolchain.py test: migrate proxy security, schema migration and MCP legacy tests (#45937) 2026-10-11 16:17:24 -07:00
test_request_log_indexes.py fix(proxy-extras): build the remaining request-log indexes in the migration job instead of in migrations (#49667) 2026-11-23 10:15:35 -08:00