fix(projects): hold the connect while a Migrate delivery branch is unmerged - #398
Conversation
…merged Connecting forked `contentrain` from the pre-migration default branch. The project then opened without its content, and Migrate's later branch-present check accepted that stale branch. The connect now answers 409 until the migrate/<hash> branch is merged.
|
REVISE at d59d3b7 (t8 review). One blocker; the rest passes. Blocker (check 3, ordinary connect breaks). Checks
|
…l closed A migrate/ branch now holds the connect only when it carries .contentrain/config.json itself, so a team's own migrate/db-v2 branch no longer blocks a first connect. A GitHub error while checking now refuses the connect (502) instead of letting it fork a stale contentrain.
|
ONAY at 79d30bb (t8, delta from d59d3b7).
|
Why
Migrate delivers into a non-empty repository on its own branch (
migrate/<hash>); the default branch has no content store until the customer merges it. Connecting the repository in that window ranensureContentBranch, which forkedcontentrainfrom the pre-migration default branch. The project then opened with no migrated content, and Migrate's later "contentrain is present" check accepted that stale branch (fixed on the Migrate side in the paired PR).What
unmergedMigrationBranch(git, defaultBranch): returns themigrate/…branch when there is nocontentrainbranch, amigrate/branch exists and the default branch has no.contentrain/config.json; otherwise null.POST /workspaces/:id/projects) answers 409project.migration_not_merged("merge it into main first") before creating anything. Every other repository connects exactly as before; a failed lookup never blocks the connect.error-messages/en.json.Tests
tests/unit/ensure-content-branch.test.ts: held while unmerged; released once the default branch carries the store; not held whencontentrainalready exists; ordinary repo untouched (no file read). 10/10, eslint clean.Pairs with Contentrain/migrate (content branch "present" must hold the delivered store). Reviewer: t9 (t10 if busy).