fix(alembic): linearize two migration heads onto 3f9a1c7b2e04#12978
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Linearizes the Manager Alembic migration chain to restore a single head.
Changes:
- Reparents
a1c4e7b93f22ontob988f01b17a1. - Updates the migration docstring accordingly.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
agatha197
added a commit
that referenced
this pull request
Jul 21, 2026
Satisfies the timeline-check towncrier gate on #12978. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fregataa
reviewed
Jul 21, 2026
fregataa
left a comment
Member
There was a problem hiding this comment.
please add a new merge revision rather than changing an existing revision
PRs #12818 (b988f01b17a1) and #12869 (a1c4e7b93f22) each branched a migration off 3f9a1c7b2e04 and merged independently, leaving two alembic heads and failing scripts/check-multiple-alembic-heads.py. Per the alembic README (keep a single linear head; never merge), reparent the later-merged a1c4e7b93f22 (kernel history perms) onto the earlier b988f01b17a1 (fair-share uniqueness). The two migrations are independent, so ordering is safe. Chain is now: 3f9a1c7b2e04 -> b988f01b17a1 -> a1c4e7b93f22 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Satisfies the timeline-check towncrier gate on #12978. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Revert the earlier reparent of a1c4e7b93f22 (its down_revision goes back to 3f9a1c7b2e04) and instead add an empty merge migration 577c7a215934 whose down_revision is the tuple of the two heads. Per the alembic guardrails, when main itself has two or more heads the correct fix is an empty merge migration, not editing the diverged (possibly already-released) migrations' down_revision. Chain is now: 3f9a1c7b2e04 -> b988f01b17a1 -> 577c7a215934 3f9a1c7b2e04 -> a1c4e7b93f22 -> 577c7a215934 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
fregataa
force-pushed
the
fix/alembic-multiple-heads-3f9a1c7b
branch
from
July 21, 2026 04:53
b049721 to
314cb3b
Compare
fregataa
approved these changes
Jul 21, 2026
fregataa
enabled auto-merge (squash)
July 21, 2026 04:54
6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
mainhas two alembic heads, soscripts/check-multiple-alembic-heads.pyexits 1:Both migrations branched off the same parent
3f9a1c7b2e04and merged independently:b988f01b17a1(fair-share uniqueness)a1c4e7b93f22(kernel history read perms)Fix
Per
src/ai/backend/manager/models/alembic/README.md— keep a single linear head, never create merge migrations, fixdown_revisionpointers instead.Reparent the later-merged
a1c4e7b93f22onto the earlierb988f01b17a1. The two migrations are independent (an RBAC permission seed vs. a uniqueness-constraint change), so reordering is safe.Test plan
python3 scripts/check-multiple-alembic-heads.py→Detected head revisions: a1c4e7b93f22, exit 0pants fmt lint --changed-since=HEADclean🤖 Generated with Claude Code