Skip to content

fix(migrations): merge split migration heads - #559

Merged
abdulrafey1 merged 1 commit into
mainfrom
rafey/fix/merge-migration-heads
Jul 27, 2026
Merged

fix(migrations): merge split migration heads#559
abdulrafey1 merged 1 commit into
mainfrom
rafey/fix/merge-migration-heads

Conversation

@abdulrafey1

Copy link
Copy Markdown
Contributor

What

Restores a single alembic head on main: PR #541 merged with its migration cd057b1ef056 still parented on 29952e6a4b1b (its branch forked before 4aac177b2327 landed), so main now carries two heads and every alembic upgrade head — CI playwright jobs, make migrations, fresh deploys — fails with "Multiple head revisions are present".

Changes

  • fix(migrations): empty merge revision b5bf23a5f00e joining heads 4aac177b2327 + cd057b1ef056

How to Test

  1. uv run alembic heads — exactly one head (b5bf23a5f00e (head)).
  2. On a fresh PostgreSQL database, alembic upgrade head walks both branches and finishes at the mergepoint (verified against a scratch database before pushing).
  3. Any open PR's playwright job passes its "Run database migrations" step again once this is merged in.

Notes

This PR description was written with the assistance of an LLM (Claude).

PR #541 merged with its migration (cd057b1ef056) still parented on 29952e6a4b1b,
forked before 4aac177b2327 landed — leaving main with two alembic heads. Every CI job
and deploy running 'alembic upgrade head' fails with 'Multiple head revisions'. This
empty merge revision joins the two lines back into a single head.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@abdulrafey1 abdulrafey1 self-assigned this Jul 27, 2026
@abdulrafey1
abdulrafey1 merged commit 9906e7d into main Jul 27, 2026
6 checks passed
@abdulrafey1
abdulrafey1 deleted the rafey/fix/merge-migration-heads branch July 27, 2026 12:40
abdulrafey1 added a commit that referenced this pull request Jul 27, 2026
Main gained the b5bf23a5f00e merge revision (#559); this in-flight migration forked from
4aac177b2327 in parallel, which would split heads again the moment main is merged in.
Repointing down_revision to the merge revision keeps the lineage linear, per the
split-heads guidance in CLAUDE.md for unmerged branches.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
abdulrafey1 added a commit that referenced this pull request Jul 31, 2026
* refactor(core): reshape permission checks around granted-role-id subqueries

Splits the scope-chain matching from the assignee matching so a second assignee source
(group role assignments, issue #519) can reuse the same scope clause. Behaviour-preserving:
checks now test role_id IN (granted role ids) instead of joining role_assignment directly.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(core): add group tables for bulk role grants

A group is a flat named set of users; group_role_assignment carries (role, scope,
scope_object_id) grants that every active member inherits (issue #519). Membership rows
carry a source column ('manual') so future rule-driven membership can own its rows without
a schema change.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(core): resolve permissions through group role assignments

can()/has_role() now hold when the role is granted to a group the user actively
belongs to, matched against the same scope chain as direct assignments (issue #519).
has_role() counting group grants keeps is_admin accurate for admin-via-group.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* feat(core): add group engine functions

Group CRUD, membership, and group-role-grant management mirroring the role engine:
idempotent race-safe writes, soft-deleted membership/assignment history, delete refused
while active role assignments exist (GroupInUse).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(migrations): repoint group tables migration to merged head

Main gained the b5bf23a5f00e merge revision (#559); this in-flight migration forked from
4aac177b2327 in parallel, which would split heads again the moment main is merged in.
Repointing down_revision to the merge revision keeps the lineage linear, per the
split-heads guidance in CLAUDE.md for unmerged branches.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* fix(core): address group engine review feedback

- translate the unique-name IntegrityError into GroupAlreadyExists in
  create_group and update_group so a concurrent create/rename surfaces
  as a domain conflict (409) instead of a raw IntegrityError (500)
- delete group memberships and assignments in bulk (two statements)
  instead of one DELETE per loaded row in delete_group
- rename GroupNotFound.group to GroupNotFound.name so the group
  exceptions share one attribute name
- update the stale "Revises:" docstring header in the group tables
  migration left behind by the down_revision repoint

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant