The migrations Job entrypoint (migrations/run.py) has defaulted to v2 with
USE_V2_MIGRATION_RESOLVER=false as the opt-out, and the Helm chart documents
that knob. Proxy startup still defaulted to v1, so the two paths disagreed
about which resolver a deployment runs.
Proxy startup now resolves the same way: v2 unless USE_V2_MIGRATION_RESOLVER
is false or --use_legacy_migration_resolver is passed.
- --use_v2_migration_resolver stays accepted as a no-op that warns, so
existing commands and Helm values do not fail on an unknown option.
- The dedicated Postgres smoke-test job is repointed at the legacy resolver
so v1 keeps real-DB proxy-boot coverage, and the two jobs that deselected
it by name are updated to match the rename.
BerriAI#39178 reverted an earlier flip because two replicas sharing a database
deadlocked (40P01 / P3018) with neither answering /health/liveliness. That
contention is what BerriAI#40932 coordinates, which is why this builds on it.
TLDR
Problem this solves:
How it solves it:
User Flow
Before: two waiting replicas fail while the migration owner remains alive
/health/readinessendpoints fail to connectAfter: contention delays startup until the migration completes
/health/readinessreturns healthy with the database connectedRelevant issues
Related to #39178
Pre-Submission checklist
make checkpassScreenshots / Proof of Fix
Real Docker containers, PostgreSQL, packaged migration SQL and HTTP endpoints; no provider credentials or model calls needed. A database advisory gate holds one test migration for 120 seconds. The same test image dependency set is used for the base and changed resolver
Before (d565031)
While the SQL gate remains held for 120 seconds:
Release the gate and request each readiness endpoint:
After (a37f0b4)
While the SQL gate remains held for 120 seconds:
Release the gate and request each readiness endpoint:
Type
Bug Fix · Test · Infrastructure
Caveats
Severe
Medium
QA runbook
Use disposable PostgreSQL databases and the built database image. Core scenarios use three regular proxy containers directly connected to PostgreSQL; PgBouncer is confined to its own compatibility cases. Successful startup means every replica reports healthy database readiness, can generate a management key and read it back, and has the expected persisted database state. Failure cases require nonzero exit, no ready endpoint, and the specific migration error. Gates synchronize on observed PostgreSQL state; automatic test retries are disabled
tests/e2e/migrations/test_startup.py::TestMigrationStartup::test_fresh_database- Fresh v2 (one/three replicas) and v1 (one replica)tests/e2e/migrations/test_startup.py::TestMigrationStartup::test_concurrent_upgrade- One execution across three replicastests/e2e/migrations/test_startup.py::TestMigrationStartup::test_waiters_survive_prolonged_contention- Contention does not exhaust ordinary retriestests/e2e/migrations/test_startup.py::TestMigrationStartup::test_lock_deadline_then_restart- Bounded wait fails loudly and restart succeedstests/e2e/migrations/test_startup.py::TestMigrationStartup::test_fatal_sql- Real SQL failure stops every new replicatests/e2e/migrations/test_startup.py::TestMigrationStartup::test_duplicate_object_does_not_hide_incomplete_sql- Duplicate objects do not prove later SQL completedtests/e2e/migrations/test_startup.py::TestMigrationStartup::test_restart_preserves_history_and_data- No-op restarts preserve v1/v2 historytests/e2e/migrations/test_startup.py::TestMigrationStartup::test_disabled_migrations- Explicitly disabled migration behavior is preservedtests/e2e/migrations/test_startup.py::TestMigrationStartup::test_insufficient_privileges- Permissions failures do not silently succeedtests/e2e/migrations/test_recovery.py::TestMigrationRecovery::test_owner_and_database_session_crash- Recovery depends on durable SQL prooftests/e2e/migrations/test_recovery.py::TestMigrationRecovery::test_container_owner_crash- Container-only death uses the recorded outcometests/e2e/migrations/test_recovery.py::TestMigrationRecovery::test_remaining_migrations_after_recovery- No readiness before subsequent migrations finishtests/e2e/migrations/test_recovery.py::TestMigrationRecovery::test_second_crash_during_recovery_is_atomic- A second interruption cannot erase completion prooftests/e2e/migrations/test_recovery.py::TestMigrationRecovery::test_competing_recovery_rechecks_stale_failures- Competing repairs recheck database statetests/e2e/migrations/test_recovery.py::TestMigrationRecovery::test_unproven_history_is_never_repaired- Six ambiguous history variants reject startuptests/e2e/migrations/test_recovery.py::TestMigrationRecovery::test_coordinator_timeout_preserves_proof- Coordinator timeout is recoverabletests/e2e/migrations/test_legacy.py::TestLegacyMigrations::test_matching_schema_warns_and_starts- Matching legacy schema starts with an honest warningtests/e2e/migrations/test_legacy.py::TestLegacyMigrations::test_unrecognized_legacy_state_is_not_baselined- Unrecognized schemas are not silently adoptedtests/e2e/migrations/test_legacy.py::TestLegacyMigrations::test_non_default_schema- Schema selection survives all recovery pathstests/e2e/migrations/test_pooling.py::TestMigrationPooling::test_direct_migrations_with_one_application_backend- Optional pooling does not become the migration routeValidation
The complete local Docker suite passed 38 cases without retries in 668.89 seconds. Production and container-test behavior is unchanged by the final formatting and unit-boundary cleanup, verified through parsed-code comparison. The latest image also passed the three-container, 120-second startup proof above. The focused unit/selector/CI-runner checks passed 145 cases, and make check passed
All eight selected deliberately broken images were rejected by their targeted assertions. These checks cover stale lock-contention behavior, checksum and SQL-step evidence, error logs, pending migrations, direct database selection, original history preservation, and legacy warnings
CircleCI pipeline 89544 passed all 38 cases at the latest commit: startup 12, recovery 15, and legacy/pooling 11. All three uploaded verdicts identify source a37f0b4 and the same immutable image, sha256:135066e44390d5cee3553a5b8b424d48ef2d59f357cac2be228e1bae4b269cac. Test-result uploads, diagnostic uploads, and teardown passed. The release verifier accepted this complete result and rejected the earlier canceled workflow. The full release-gate dispatch and verification repeat also passed all 38 cases without retries in pipeline 89545, taking 17 minutes 32 seconds including its shared image build. The real release-gate code dispatched and polled that run, downloaded the private verdicts, and accepted all three suites. Independently inspected JUnit results contain exactly 12/15/11 cases with no failures, errors or skips, and all artifact uploads and cleanup steps succeeded. That repeat rebuilt the same source and used image sha256:5f832b25f9323227a794c973cad2e7f9ee3e5d27a0096798d1da5225861892a6 across all three suites. The prior in-progress pipeline was superseded during iteration; it is not counted as a complete pass. Greptile posted 5/5 for the current head. All required GitHub checks passed, and the shared access-control/JWT canaries passed 28 cases in each of three runs
The six-hour workflow is separate from the normal PR test graph. Release publication is gated by companion project-releaser #239; activation requires merging both changes and provisioning CIRCLECI_API_TOKEN in that repository
Final Attestation
The listed scenarios and deliberate regression checks passed as reported. These checks do not guarantee that every possible production regression is impossible