FN-5782: wire branch groups into merge routing
Connect branch_group metadata through planning and merge execution for grouped integration branches. - propagate `branchGroup` and `branchGroupName` through core store types, merge metadata, and CLI task lifecycle APIs - add merge coordination that computes branch-group plans and routes grouped tasks via `group-merge-coordinator` - extend finalize-plan, merger, and reliability tests to cover grouped merge routing and integration behavior - document the architecture update and add a patch changeset for `@runfusion/fusion` Files changed: .changeset/fn-5782-branch-group-merge.md | 7 + docs/architecture.md | 2 + packages/cli/src/commands/__tests__/task-lifecycle.test.ts | 64 ++++++++- packages/cli/src/commands/task-lifecycle.ts | 4 + packages/core/src/__tests__/branch-group-store.test.ts | 20 +++ packages/core/src/__tests__/task-merge.test.ts | 64 +++++++++ packages/core/src/store.ts | 22 ++- packages/core/src/task-merge.ts | 26 +++- packages/core/src/types.ts | 2 +- packages/engine/src/__tests__/experiment-finalize-plan.test.ts | 33 ++++- packages/engine/src/__tests__/group-merge-coordinator.test.ts | 62 +++++++++ packages/engine/src/__tests__/reliability-interactions/branch-group-merge-routing.test.ts | 153 +++++++++++++++++++++ packages/engine/src/experiment/finalize-plan.ts | 62 +++++++-- packages/engine/src/group-merge-coordinator.ts | 51 +++++++ packages/engine/src/index.ts | 4 + packages/engine/src/merger.ts | 47 ++++++- 16 files changed, 601 insertions(+), 22 deletions(-) Fusion-Task-Id: FN-5782 Fusion-Task-Lineage: 0a70cfaa-2379-4955-b295-64de1f3093c8
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { ExperimentSession, ExperimentSessionRecord } from "@fusion/core";
|
||||
import { buildDefaultPlan, mergePlanWithUserOverrides } from "../experiment/finalize-plan.js";
|
||||
import type { BranchGroup, ExperimentSession, ExperimentSessionRecord } from "@fusion/core";
|
||||
import { buildDefaultPlan, buildTaskGroupPlan, mergePlanWithUserOverrides } from "../experiment/finalize-plan.js";
|
||||
import { ExperimentFinalizePlanError } from "../experiment/finalize-types.js";
|
||||
|
||||
function createSession(overrides: Partial<ExperimentSession> = {}): ExperimentSession {
|
||||
@@ -139,6 +139,35 @@ describe("experiment finalize plan", () => {
|
||||
);
|
||||
});
|
||||
|
||||
it("builds a task-group finalize plan keyed to existing branch name", () => {
|
||||
const branchGroup: BranchGroup = {
|
||||
id: "BG-1",
|
||||
sourceType: "mission",
|
||||
sourceId: "SL-1",
|
||||
branchName: "fusion/groups/sl-1",
|
||||
autoMerge: false,
|
||||
prState: "none",
|
||||
status: "open",
|
||||
createdAt: Date.now(),
|
||||
updatedAt: Date.now(),
|
||||
};
|
||||
|
||||
const plan = buildTaskGroupPlan({
|
||||
branchGroup,
|
||||
memberTasks: [
|
||||
{ id: "FN-2", createdAt: "2026-01-02T00:00:00.000Z", mergeDetails: { commitSha: "c2" } },
|
||||
{ id: "FN-1", createdAt: "2026-01-01T00:00:00.000Z", mergeDetails: { commitSha: "c1" } },
|
||||
],
|
||||
integrationBranch: "main",
|
||||
mergeBaseCommit: "base",
|
||||
});
|
||||
|
||||
expect(plan.groups).toHaveLength(1);
|
||||
expect(plan.groups[0].suggestedBranchName).toBe("fusion/groups/sl-1");
|
||||
expect(plan.groups[0].runRecordIds).toEqual(["FN-1", "FN-2"]);
|
||||
expect(plan.groups[0].commits).toEqual(["c1", "c2"]);
|
||||
});
|
||||
|
||||
it("falls back baseline commit to baseline run then merge-base", () => {
|
||||
const baseline = runRecord("base", 1, 1, "keep", "baseline-commit");
|
||||
const kept = runRecord("r1", 1, 2, "keep", "c1");
|
||||
|
||||
Reference in New Issue
Block a user