FN-5678: add branch-group data model foundation
Establish per-mission/per-planning branch-group persistence and task metadata plumbing for shared auto-merge behavior. - add `branch_groups` schema, indexes, exports, and store types for mission/planning branch assignment - wire task source metadata branch-context helpers and branch-group row handling into core store flows - add branch-group and migration coverage plus roadmap schema-version assertion wording fix - add published changeset and storage doc note for the new branch-group persistence layer - preserve forward-only migration safety by advancing schema to 96 and gating branch-group migration at `< 96` Files changed: .changeset/per-mission-automerge-foundation.md | 11 ++ docs/storage.md | 1 + packages/core/src/__tests__/backup.test.ts | 32 ++++ .../core/src/__tests__/branch-group-store.test.ts | 148 ++++++++++++++++++ packages/core/src/__tests__/db-migrate.test.ts | 40 +++++ packages/core/src/__tests__/db.test.ts | 16 ++ packages/core/src/__tests__/mission-store.test.ts | 16 ++ packages/core/src/db.ts | 52 ++++++- packages/core/src/index.ts | 2 +- packages/core/src/mission-store.ts | 19 ++- packages/core/src/mission-types.ts | 4 + packages/core/src/store.ts | 171 ++++++++++++++++++++- packages/core/src/types.ts | 59 +++++++ 13 files changed, 556 insertions(+), 15 deletions(-) Fusion-Task-Id: FN-5678 Fusion-Task-Lineage: cd6e5312-a9c5-475f-a0de-1d3090395bdd
This commit is contained in:
@@ -322,6 +322,7 @@ Backups in `.fusion/backups/` now capture the project DB and (when present) the
|
||||
| Table | Purpose |
|
||||
|---|---|
|
||||
| `tasks` | Core task metadata and JSON-backed nested fields (priority, dependencies, steps, log, attachments, comments, model overrides, workflow results, merge details, assignment, mission linkage). |
|
||||
| `branch_groups` | Durable shared-branch group records keyed by `BG-*` id with source linkage (`mission`/`planning`), branch/worktree metadata, optional PR tracking fields, lifecycle status, and per-group `autoMerge` override. |
|
||||
| `mergeQueue` | Durable merge handoff queue keyed by `taskId`. Stores enqueue ordering (`enqueuedAt`, mirrored `priority`), single-owner lease state (`leasedBy`, `leasedAt`, `leaseExpiresAt`), and retry diagnostics (`attemptCount`, `lastError`). Leasing is priority-first + FIFO within priority, and expired leases are recoverable without incrementing attempts. FN-5242 adds the persistence/lease primitive; FN-5241 and FN-5243 wire executor enqueue + merger consumption. |
|
||||
|
||||
FN-5240/FN-5241/FN-5242 establish the handoff invariant: the only legal executor/self-healing path into `in-review` after execution finishes is `TaskStore.handoffToReview(...)`. That helper runs the column move, `mergeQueue` insert, and handoff audit fan-out inside one `BEGIN IMMEDIATE` transaction so observers never see `column = "in-review"` without the matching queue row. Direct `moveTask(taskId, "in-review")` writes remain allowed for explicit non-handoff/test paths but emit `task:handoff-invariant-violation` run-audit events unless the caller opts into the narrow allowlist flag.
|
||||
|
||||
Reference in New Issue
Block a user