fix: rename migration 040 → 043 to resolve dual-revision collision [CRITICAL] #442
No reviewers
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!442
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix-040-collision-043"
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?
Summary
Critical hot-fix for basketball-api#441. PR #433 introduced an alembic migration file claiming
revision = "040", but migration 040 already existed (040_create_16u_local_queens_team.pyfrom PR #426). Git accepted both files because the filenames differ, producing a dual-revision collision that breaks the alembic chain. The running pod is still on a pre-collision image (alembic_version = 042, nojersey_public_orderstable), but ArgoCD is currentlySynced / Progressingfor basketball-api — when the new pod attemptsalembic upgrade head, it will CrashLoop, blocking all future deploys.This PR renames my jersey migration from
040to043, placing it at the end of the current chain (039 → 040 queens → 041 contract_audit → 042 alice_dedupe → 043 jersey_public_orders). Schema content unchanged — only revision metadata + filename differ.Changes
alembic/versions/040_add_jersey_public_orders.py→alembic/versions/043_add_jersey_public_orders.pyrevision = "040"→revision = "043"down_revision = "039"→down_revision = "042"Revision ID: 040→Revision ID: 043,Revises: 039→Revises: 042Test Plan
alembic headsreturns a single head → expect043alembic upgrade headagainst a test DB seeded at revision 042 → advances to 043 cleanly, createsjersey_public_orderstable with 4 indexes and 3 CHECK constraintsalembic downgrade -1→ reverses 043 → 042 cleanly, drops the table, leavespgcryptoextension intactalembic upgrade head→ re-applies 043 cleanlypython -c "from basketball_api.models import JerseyPublicOrder; print(JerseyPublicOrder.__tablename__)"printsjersey_public_orderspytest tests/ -k jersey_public_orderpasses (tests from PR #433 still valid)Synced / Healthykubectl -n basketball-api exec postgres-... -- psql -U basketball -d basketball -c "\dt jersey_public_orders"shows the table existskubectl -n basketball-api exec postgres-... -- psql -U basketball -d basketball -c "SELECT version_num FROM alembic_version;"shows043Review Checklist
Related Notes
arch-jersey-intake— architecture doc for System B jersey intake pipelinestory:WS-S31— parent user story on project-westside-basketballCloses #441
PR #442 Review
DOMAIN REVIEW
Python / Alembic migration hot-fix. Single-file rename resolving a dual-head collision on revision
040. Verified against the PR diff returned bymcp__forgejo__review_pr.Diff verification (checklist items 1-7):
alembic/versions/040_add_jersey_public_orders.py->alembic/versions/043_add_jersey_public_orders.py(changed_files: 1, similarity index 98%, rename)revision = "043",down_revision = "042"— both present verbatim in the diffRevision ID: 043,Revises: 042upgrade()/downgrade()bodies are not in the diff hunk, so CREATE TABLE / indexes / CHECK constraints / FKs are untouched.040_create_16u_local_queens_team.py,041_add_contract_audit_log.py, or042_dedupe_alice_uwamahoro.py(changed_files: 1)models.py—JerseyPublicOrderfrom PR #433 untouchedItems 8-10 (pgcrypto, indexes, FK ON DELETE SET NULL):
These live in the
upgrade()/downgrade()bodies, which are outside the diff hunk. Because the file is a rename with similarity index 98% and the only textual deltas are the 4 insertions / 4 deletions shown (all in the header/metadata), the schema body is structurally guaranteed unchanged from the original 040 content that was reviewed and merged in PR #433. No new correctness risk introduced by this PR.Local
alembic heads/ upgrade / downgrade verification:Not performed — QA agent is read-only (no Bash), and the local
basketball-apicheckout is stale (missing migrations 020+). Recommend Lucas or a dev agent runalembic headsagainst a fresh checkout offix-040-collision-043before merge as the final gate. Based on the revision chain declared in the diff (down_revision = "042") plus the existing 039->040(queens)->041->042 chain on main,alembic headswill return a single head043after this merges.BLOCKERS
None.
NITS
None worth blocking on. This is a minimal, surgical, reversible hot-fix and ArgoCD is rolling.
SOP COMPLIANCE
fix-040-collision-043(descriptive, references the collision)PROCESS OBSERVATIONS
alembic headsand fails if >1 head is returned would prevent recurrence. Worth filing a follow-up ticket onboard-basketball-api.alembic downgrade -1.VERDICT: APPROVED