feat(git): coordination root cuts a Main-PM integration branch per repo (#58)

The coordination/fan-out root carries a product (cell->repo map) but no
project of its own, and was forced branchless — so a cell's parent-branch
resolution fell back to the project default (master), and cell completion
merged each cell straight to master, bypassing the Main-PM integration
point and the CEO merge gate.

Per the locked branch model (master <- feature/main_pm/{root} <- cell <-
dev), the root is now the Main-PM integration point: on claim it cuts
feature/main_pm/{root} off master in EACH distinct repo the product spans
(monorepo => 1, multi-repo => N). Cells then branch off it via the existing
ancestor-branch resolution, so cell work never targets master.

- ProductService.distinct_project_ids: enumerate the repos a product spans
- TaskService._create_branch_in_project: project-parameterized branch
  creation split out of _auto_create_branch
- TaskService._ensure_coordination_root_branches: cut the integration
  branch in each repo; graceful empty when the product has no cell map yet
- _ensure_branch_for_task routes a product-backed root here, not to no-op

Co-authored-by: Renn F <rennf93@users.noreply.github.com>
This commit is contained in:
Renzo F
2026-06-04 05:48:21 +02:00
committed by GitHub
co-authored by Renn F
parent f36fb67bec
commit 6cce556536
4 changed files with 144 additions and 12 deletions
+38
View File
@@ -102,6 +102,44 @@ async def test_shared_project_across_cells(product_setup: dict) -> None:
assert await svc.project_for(product.id, c) == shared
@pytest.mark.asyncio
async def test_distinct_project_ids_monorepo_and_multirepo(product_setup: dict) -> None:
"""One integration branch per DISTINCT repo: monorepo => 1, multi-repo => N."""
svc = product_setup["svc"]
projects = product_setup["projects"]
shared = projects[Team.BACKEND].id
mono = await svc.create(
ProductCreate(
name="Mono",
slug=f"mono-{uuid4().hex[:6]}",
cells=[
ProductCellMapping(team=c, project_id=shared)
for c in (Team.BACKEND, Team.FRONTEND, Team.UX_UI)
],
),
created_by=product_setup["creator"],
)
assert await svc.distinct_project_ids(mono.id) == [shared]
multi = await svc.create(
ProductCreate(
name="Multi",
slug=f"multi-{uuid4().hex[:6]}",
cells=[
ProductCellMapping(team=c, project_id=projects[c].id)
for c in (Team.BACKEND, Team.FRONTEND, Team.UX_UI)
],
),
created_by=product_setup["creator"],
)
assert set(await svc.distinct_project_ids(multi.id)) == {
projects[Team.BACKEND].id,
projects[Team.FRONTEND].id,
projects[Team.UX_UI].id,
}
@pytest.mark.asyncio
async def test_duplicate_slug_conflicts(product_setup: dict) -> None:
svc = product_setup["svc"]