Skip to content

POC: Alembic merge heads for git-flow migration reconciliation#7976

Draft
galvana wants to merge 1 commit intomainfrom
demo/alembic-merge-heads-poc
Draft

POC: Alembic merge heads for git-flow migration reconciliation#7976
galvana wants to merge 1 commit intomainfrom
demo/alembic-merge-heads-poc

Conversation

@galvana
Copy link
Copy Markdown
Contributor

@galvana galvana commented Apr 20, 2026

Summary

Proof-of-concept demonstrating that divergent alembic migrations are resolvable when adopting git-flow.

The scenario:

  • A hotfix migration lands on main (aaaa11112222)
  • A feature migration develops independently on dev (bbbb33334444)
  • Both share the same down_revision, creating two alembic heads

The resolution:

  • alembic merge heads generates a merge migration (cccc55556666) with down_revision = ("aaaa11112222", "bbbb33334444")
  • Single head restored, no data loss, no conflicts

Migration chain:

d6e7f8a9b0c1 (previous head)
     |
     +---> aaaa11112222 (hotfix on main)
     |
     +---> bbbb33334444 (feature on dev)
             \       /
              v     v
        cccc55556666 (merge migration)

Key takeaway: This is a standard alembic feature. The merge migration has no schema changes — it just unifies the revision graph. Can be automated in CI by detecting alembic heads returning >1 result.

⚠️ Not intended to merge. Demo only for the git-flow branching proposal.

Test plan

  • Python parses all three migrations correctly
  • Chain visualization confirms single head after merge
  • (optional) Run alembic upgrade head in a test DB to confirm execution order

🤖 Generated with Claude Code

Demonstrates that divergent alembic migrations (hotfix on main vs
feature on dev) are resolvable via `alembic merge heads`. Three
demo migrations show the problem and solution:

1. aaaa11112222 - hotfix migration (landed on main)
2. bbbb33334444 - feature migration (developed on dev)
3. cccc55556666 - merge migration (resolves both heads)

This is a proof-of-concept for the git-flow branching proposal.
Not intended to merge — just demonstrates the pattern.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
fides-plus-nightly Ignored Ignored Apr 20, 2026 11:27pm
fides-privacy-center Ignored Ignored Apr 20, 2026 11:27pm

Request Review

@galvana galvana added the do not merge Please don't merge yet, bad things will happen if you do label Apr 20, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.05%. Comparing base (b5b98e6) to head (5dffccc).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7976   +/-   ##
=======================================
  Coverage   85.04%   85.05%           
=======================================
  Files         631      631           
  Lines       41213    41213           
  Branches     4807     4807           
=======================================
+ Hits        35049    35053    +4     
+ Misses       5070     5067    -3     
+ Partials     1094     1093    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do not merge Please don't merge yet, bad things will happen if you do

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant