[CRITICAL] Migration 040 dual-revision collision — pod will CrashLoop on alembic upgrade #441
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/basketball-api#441
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Type
Bug
Lineage
Discovered 2026-04-11 during post-merge validation of PR #433. Related to PR #426 (16U queens) and PR #428 (Alice dedupe) which merged migrations 040, 041, 042 between PR #433 scoping and merge. Regression from PR #433.
Repo
forgejo_admin/basketball-apiWhat Broke
Two files on
mainboth declarerevision = "040"withdown_revision = "039":alembic/versions/040_add_jersey_public_orders.py(from PR #433)alembic/versions/040_create_16u_local_queens_team.py(from PR #426)Alembic cannot resolve multiple heads at the same revision id. The running pod is still on a pre-#433 image (alembic_version = 042,
jersey_public_orderstable does NOT exist). ArgoCD showsSynced / Progressingfor basketball-api — it is currently rolling out the new image. When the new pod starts,alembic upgrade headwill fail because of the duplicate revision, the new pod will CrashLoop, and the rolling update will block (maxUnavailable=0 keeps old pod serving, but all future deploys are blocked).Repro Steps
kubectl -n basketball-api exec postgres-9b5b87b5-5nccx -- psql -U basketball -d basketball -c "SELECT version_num FROM alembic_version;"→042kubectl -n basketball-api exec postgres-9b5b87b5-5nccx -- psql -U basketball -d basketball -c "\dt jersey_public_orders"→Did not find any relation named "jersey_public_orders"curl -sS "$FORGEJO_URL/api/v1/repos/forgejo_admin/basketball-api/contents/alembic/versions?ref=main"→ list includes both040_add_jersey_public_orders.pyand040_create_16u_local_queens_team.pyrevision = "040"in their headersExpected Behavior
Exactly one file claims
revision = "040". The jersey_public_orders migration should occupy a unique revision number at the end of the current chain (should be 043 since 040-042 already exist).Environment
basketball-apinamespaceharbor.tail5b443a.ts.net/basketball-api/api:7ccc4b3020797c0b59544493194de837c19441fe(pre-collision), main branch HEAD4be0848a5df29213(collision present)Synced / ProgressingAcceptance Criteria
revision = "040"remains inalembic/versions/jersey_public_ordersmigration renamed to043(or next unique revision),down_revision = "042"alembic headsreturns a single headalembic upgrade headcompletes cleanly through the new revisionalembic downgrade -1reverses cleanlyjersey_public_orderstable exists in basketball-api production DB after rolloutSynced / Healthyfrom basketball_api.models import JerseyPublicOrderimports cleanlyRelated
pal-e-platform— project trackingwestside-basketball— affected product (System B production rollout blocked)forgejo_admin/basketball-api#429— PR #433 source issue (jersey_public_orders migration)alembic headsbefore build to prevent future collisions