FN-5675: add mission branch strategy and planning breakdown controls
Add mission-level branch strategy support and expose planning breakdown controls across mission flows. - Extend mission/core data models and store logic to track and persist base-branch strategy metadata. - Update mission API routes and legacy adapters to read/write new mission branch strategy fields. - Enhance MissionManager and PlanningModeModal UX to configure branch strategy and planning breakdown behavior. - Add/adjust coverage across core, dashboard, and roadmap plugin tests for mission branch and planning flow behavior. - Add a changeset and mission docs updates for the new mission branch strategy behavior. Files changed: .changeset/fn-5675-mission-branch-strategy.md | 9 + docs/missions.md | 13 ++ packages/core/src/__tests__/db-migrate.test.ts | 12 +- .../src/__tests__/db-mission-base-branch.test.ts | 14 +- packages/core/src/__tests__/db.test.ts | 34 ++-- packages/core/src/__tests__/goals-schema.test.ts | 2 +- packages/core/src/__tests__/insight-store.test.ts | 10 +- packages/core/src/__tests__/mission-store.test.ts | 148 +++++++++++++- packages/core/src/__tests__/run-audit.test.ts | 2 +- packages/core/src/__tests__/secrets-schema.test.ts | 6 +- .../core/src/__tests__/store-merge-queue.test.ts | 2 +- packages/core/src/__tests__/task-documents.test.ts | 2 +- packages/core/src/db.ts | 9 +- packages/core/src/index.ts | 1 + packages/core/src/mission-store.ts | 64 ++++-- packages/core/src/mission-types.ts | 9 + packages/dashboard/app/api/legacy.ts | 23 ++- .../dashboard/app/components/MissionManager.tsx | 226 +++++++++++++++++++-- .../dashboard/app/components/PlanningModeModal.tsx | 9 +- .../components/__tests__/MissionManager.test.tsx | 100 +++++++++ .../PlanningModeModal.planning-flow.test.tsx | 91 +++++++++ packages/dashboard/app/components/mission-types.ts | 4 + .../dashboard/src/__tests__/mission-e2e.test.ts | 49 ++++- packages/dashboard/src/mission-routes.ts | 41 +++- .../src/store/__tests__/roadmap-store.test.ts | 4 +- 25 files changed, 808 insertions(+), 76 deletions(-) Fusion-Task-Id: FN-5675 Fusion-Task-Lineage: cfd13c13-9eff-4b82-90c3-88505d51bfb2
This commit is contained in:
@@ -715,7 +715,7 @@ describe("schema migration", () => {
|
||||
|
||||
const row = db.prepare("SELECT deletedAt FROM tasks WHERE id = 'FN-legacy'").get() as { deletedAt: string | null };
|
||||
expect(row.deletedAt).toBeNull();
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
|
||||
db.close();
|
||||
});
|
||||
@@ -748,7 +748,7 @@ describe("schema migration", () => {
|
||||
{ id: "WS-001", mode: "prompt", gateMode: "advisory" },
|
||||
{ id: "WS-002", mode: "script", gateMode: "advisory" },
|
||||
]);
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
|
||||
db.close();
|
||||
});
|
||||
@@ -798,7 +798,7 @@ describe("schema migration", () => {
|
||||
reviewerContextRetryCount: 0,
|
||||
reviewerFallbackRetryCount: 0,
|
||||
});
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
|
||||
db.close();
|
||||
});
|
||||
@@ -827,7 +827,7 @@ describe("schema migration", () => {
|
||||
|
||||
const columns = db.prepare("PRAGMA table_info(milestones)").all() as Array<{ name: string }>;
|
||||
expect(columns.map((column) => column.name)).toContain("acceptanceCriteria");
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
|
||||
db.close();
|
||||
});
|
||||
@@ -868,7 +868,7 @@ describe("schema migration", () => {
|
||||
const missionColumns = db.prepare("PRAGMA table_info(missions)").all() as Array<{ name: string }>;
|
||||
expect(missionColumns.map((column) => column.name)).toContain("autoMerge");
|
||||
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
db.close();
|
||||
});
|
||||
|
||||
@@ -902,7 +902,7 @@ describe("schema migration", () => {
|
||||
{ id: "WS-002", mode: "script", enabled: 1, gateMode: "advisory" },
|
||||
{ id: "WS-003", mode: "prompt", enabled: 0, gateMode: "advisory" },
|
||||
]);
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
|
||||
db.close();
|
||||
});
|
||||
|
||||
@@ -10,7 +10,7 @@ function makeTmpDir(): string {
|
||||
return mkdtempSync(join(tmpdir(), "kb-db-mission-base-branch-"));
|
||||
}
|
||||
|
||||
describe("mission baseBranch persistence", () => {
|
||||
describe("mission branch strategy persistence", () => {
|
||||
let tmpDir: string;
|
||||
let fusionDir: string;
|
||||
let db: Database;
|
||||
@@ -29,21 +29,29 @@ describe("mission baseBranch persistence", () => {
|
||||
await rm(tmpDir, { recursive: true, force: true });
|
||||
});
|
||||
|
||||
it("creates, reads, and updates mission baseBranch", () => {
|
||||
it("creates, reads, and updates mission baseBranch and branchStrategy", () => {
|
||||
const created = store.createMission({
|
||||
title: "Mission",
|
||||
baseBranch: "develop",
|
||||
branchStrategy: { mode: "existing", branchName: "release/shared" },
|
||||
});
|
||||
|
||||
expect(created.baseBranch).toBe("develop");
|
||||
expect(created.branchStrategy).toEqual({ mode: "existing", branchName: "release/shared" });
|
||||
|
||||
const fetched = store.getMission(created.id);
|
||||
expect(fetched?.baseBranch).toBe("develop");
|
||||
expect(fetched?.branchStrategy).toEqual({ mode: "existing", branchName: "release/shared" });
|
||||
|
||||
const updated = store.updateMission(created.id, { baseBranch: "release/1.0" });
|
||||
const updated = store.updateMission(created.id, {
|
||||
baseBranch: "release/1.0",
|
||||
branchStrategy: { mode: "auto-per-task" },
|
||||
});
|
||||
expect(updated.baseBranch).toBe("release/1.0");
|
||||
expect(updated.branchStrategy).toEqual({ mode: "auto-per-task" });
|
||||
|
||||
const refetched = store.getMission(created.id);
|
||||
expect(refetched?.baseBranch).toBe("release/1.0");
|
||||
expect(refetched?.branchStrategy).toEqual({ mode: "auto-per-task" });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -330,7 +330,7 @@ describe("Database", () => {
|
||||
});
|
||||
|
||||
it("seeds schema version", () => {
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
});
|
||||
|
||||
it("includes tokenUsageCacheWriteTokens on freshly initialized tasks table", () => {
|
||||
@@ -389,7 +389,7 @@ describe("Database", () => {
|
||||
|
||||
it("is idempotent - calling init() twice does not fail", () => {
|
||||
expect(() => db.init()).not.toThrow();
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
});
|
||||
it("does not overwrite existing config on re-init", () => {
|
||||
// Update the config
|
||||
@@ -1459,7 +1459,7 @@ describe("schema migrations", () => {
|
||||
db.init();
|
||||
|
||||
// Verify version bumped to 29 (includes v1→v2 through v26→v29)
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
|
||||
// Verify new columns exist and existing data is intact
|
||||
const cols = db.prepare("PRAGMA table_info(tasks)").all() as Array<{ name: string }>;
|
||||
@@ -1484,11 +1484,11 @@ describe("schema migrations", () => {
|
||||
const db = new Database(fusionDir);
|
||||
db.init();
|
||||
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
|
||||
// Re-init should not fail
|
||||
db.init();
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
|
||||
db.close();
|
||||
});
|
||||
@@ -1523,7 +1523,7 @@ describe("schema migrations", () => {
|
||||
|
||||
db.init();
|
||||
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
|
||||
const cols = db.prepare("PRAGMA table_info(tasks)").all() as Array<{ name: string }>;
|
||||
expect(cols.map((col) => col.name)).toContain("priority");
|
||||
@@ -1564,7 +1564,7 @@ describe("schema migrations", () => {
|
||||
|
||||
db.init();
|
||||
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
|
||||
const cols = db.prepare("PRAGMA table_info(tasks)").all() as Array<{ name: string }>;
|
||||
const colNames = cols.map((col) => col.name);
|
||||
@@ -1636,7 +1636,7 @@ describe("schema migrations", () => {
|
||||
|
||||
db.init();
|
||||
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
|
||||
const cols = db.prepare("PRAGMA table_info(tasks)").all() as Array<{ name: string }>;
|
||||
const colNames = cols.map((col) => col.name);
|
||||
@@ -1876,7 +1876,7 @@ describe("schema migrations", () => {
|
||||
|
||||
db.init();
|
||||
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
|
||||
const cols = db.prepare("PRAGMA table_info(chat_messages)").all() as Array<{ name: string }>;
|
||||
expect(cols.map((col) => col.name)).toContain("attachments");
|
||||
@@ -1950,7 +1950,7 @@ describe("schema migrations", () => {
|
||||
|
||||
db.init();
|
||||
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
|
||||
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'agentRatings'").all() as Array<{ name: string }>;
|
||||
expect(tables).toEqual([{ name: "agentRatings" }]);
|
||||
@@ -1974,7 +1974,7 @@ describe("schema migrations", () => {
|
||||
|
||||
db.init();
|
||||
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
|
||||
const tables = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name = 'mission_events'").all() as Array<{ name: string }>;
|
||||
expect(tables).toEqual([{ name: "mission_events" }]);
|
||||
@@ -2078,7 +2078,7 @@ describe("schema migrations", () => {
|
||||
db.init();
|
||||
|
||||
// Verify version bumped to 29
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
|
||||
// Verify new columns exist and existing data is intact
|
||||
const cols = db.prepare("PRAGMA table_info(tasks)").all() as Array<{ name: string }>;
|
||||
@@ -2297,7 +2297,7 @@ describe("schema migrations", () => {
|
||||
|
||||
localDb.init();
|
||||
|
||||
expect(localDb.getSchemaVersion()).toBe(97);
|
||||
expect(localDb.getSchemaVersion()).toBe(98);
|
||||
const columns = localDb.prepare("PRAGMA table_info(tasks)").all() as Array<{ name: string }>;
|
||||
expect(columns.map((column) => column.name)).toContain("tokenUsageCacheWriteTokens");
|
||||
|
||||
@@ -2608,7 +2608,7 @@ describe("createDatabase factory", () => {
|
||||
const db = createDatabase(fusionDir);
|
||||
db.init();
|
||||
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
expect(db.getLastModified()).toBeGreaterThan(0);
|
||||
|
||||
db.close();
|
||||
@@ -2762,7 +2762,7 @@ describe("migration v77 task token budget columns", () => {
|
||||
|
||||
migrated = new Database(fusion);
|
||||
migrated.init();
|
||||
expect(migrated.getSchemaVersion()).toBe(97);
|
||||
expect(migrated.getSchemaVersion()).toBe(98);
|
||||
const rows = migrated.prepare("PRAGMA table_info(tasks)").all() as Array<{ name: string }>;
|
||||
const names = new Set(rows.map((row) => row.name));
|
||||
expect(names.has("tokenBudgetSoftAlertedAt")).toBe(true);
|
||||
@@ -2808,7 +2808,7 @@ describe("migration v67 drops orphan project auth tables", () => {
|
||||
|
||||
migrated = new Database(fusion);
|
||||
migrated.init();
|
||||
expect(migrated.getSchemaVersion()).toBe(97);
|
||||
expect(migrated.getSchemaVersion()).toBe(98);
|
||||
const tables = migrated
|
||||
.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name LIKE 'project_auth_%'")
|
||||
.all() as Array<{ name: string }>;
|
||||
@@ -2835,7 +2835,7 @@ describe("migration v67 drops orphan project auth tables", () => {
|
||||
|
||||
try {
|
||||
fresh.init();
|
||||
expect(fresh.getSchemaVersion()).toBe(97);
|
||||
expect(fresh.getSchemaVersion()).toBe(98);
|
||||
const tables = fresh
|
||||
.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name LIKE 'project_auth_%'")
|
||||
.all() as Array<{ name: string }>;
|
||||
|
||||
@@ -91,6 +91,6 @@ describe("goals schema", () => {
|
||||
});
|
||||
|
||||
it("reports schema version 92", () => {
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1000,7 +1000,7 @@ describe("Migration: pre-33 DB upgrade", () => {
|
||||
// Step 1: Create a fresh database at v33 (runs all migrations up to 33)
|
||||
const db1 = createDatabase(legacyDir);
|
||||
db1.init();
|
||||
expect(db1.getSchemaVersion()).toBe(97);
|
||||
expect(db1.getSchemaVersion()).toBe(98);
|
||||
db1.close();
|
||||
|
||||
// Step 2: Manually downgrade to version 32 and drop insight tables
|
||||
@@ -1035,7 +1035,7 @@ describe("Migration: pre-33 DB upgrade", () => {
|
||||
expect(tableNamesBefore).not.toContain("project_insight_runs");
|
||||
// Now run init — this triggers the v32→v33 migration
|
||||
db3.init();
|
||||
expect(db3.getSchemaVersion()).toBe(97);
|
||||
expect(db3.getSchemaVersion()).toBe(98);
|
||||
|
||||
// Step 4: Verify insight tables exist after migration
|
||||
const tablesAfter = db3.prepare(
|
||||
@@ -1066,12 +1066,12 @@ describe("Migration: pre-33 DB upgrade", () => {
|
||||
try {
|
||||
const db1 = createDatabase(testDir);
|
||||
db1.init();
|
||||
expect(db1.getSchemaVersion()).toBe(97);
|
||||
expect(db1.getSchemaVersion()).toBe(98);
|
||||
db1.close();
|
||||
|
||||
const db2 = createDatabase(testDir);
|
||||
expect(() => db2.init()).not.toThrow();
|
||||
expect(db2.getSchemaVersion()).toBe(97);
|
||||
expect(db2.getSchemaVersion()).toBe(98);
|
||||
db2.close();
|
||||
} finally {
|
||||
rmSync(testDir, { recursive: true, force: true });
|
||||
@@ -1085,7 +1085,7 @@ describe("Migration: pre-33 DB upgrade", () => {
|
||||
// Step 1: Create a fresh DB and run migrations
|
||||
const db1 = createDatabase(compatDir);
|
||||
db1.init();
|
||||
expect(db1.getSchemaVersion()).toBe(97);
|
||||
expect(db1.getSchemaVersion()).toBe(98);
|
||||
|
||||
// Step 2: Strip lifecycle and cancelledAt columns by recreating the
|
||||
// table without them. This simulates a DB that was created before the
|
||||
|
||||
@@ -97,6 +97,35 @@ describe("MissionStore", () => {
|
||||
expect(list[2].id).toBe(m1.id);
|
||||
});
|
||||
|
||||
it("round-trips mission branchStrategy on create", () => {
|
||||
const mission = store.createMission({
|
||||
title: "Branch strategy",
|
||||
branchStrategy: { mode: "custom-new", branchName: "feature/mission" },
|
||||
});
|
||||
|
||||
const fetched = store.getMission(mission.id);
|
||||
expect(fetched?.branchStrategy).toEqual({ mode: "custom-new", branchName: "feature/mission" });
|
||||
});
|
||||
|
||||
it("updates mission branchStrategy", () => {
|
||||
const mission = store.createMission({ title: "Original" });
|
||||
const updated = store.updateMission(mission.id, {
|
||||
branchStrategy: { mode: "auto-per-task" },
|
||||
});
|
||||
|
||||
expect(updated.branchStrategy).toEqual({ mode: "auto-per-task" });
|
||||
expect(store.getMission(mission.id)?.branchStrategy).toEqual({ mode: "auto-per-task" });
|
||||
});
|
||||
|
||||
it("reads undefined branchStrategy for legacy and corrupt rows", () => {
|
||||
const mission = store.createMission({ title: "Legacy row" });
|
||||
db.prepare("UPDATE missions SET branchStrategy = NULL WHERE id = ?").run(mission.id);
|
||||
expect(store.getMission(mission.id)?.branchStrategy).toBeUndefined();
|
||||
|
||||
db.prepare("UPDATE missions SET branchStrategy = ? WHERE id = ?").run("{not-json", mission.id);
|
||||
expect(store.getMission(mission.id)?.branchStrategy).toBeUndefined();
|
||||
});
|
||||
|
||||
it("updates a mission", async () => {
|
||||
const mission = store.createMission({ title: "Original" });
|
||||
await new Promise((r) => setTimeout(r, 5)); // Ensure timestamp difference
|
||||
@@ -1901,6 +1930,62 @@ describe("MissionStore", () => {
|
||||
expect(task?.baseBranch).toBe("release/1.0");
|
||||
});
|
||||
|
||||
it("uses mission branchStrategy auto-per-task when branch options are omitted", async () => {
|
||||
const { TaskStore } = await import("../store.js");
|
||||
const ts = new TaskStore(tmpDir, join(tmpDir, ".fusion-global-settings"), { inMemoryDb: true });
|
||||
const msWithTs = ts.getMissionStore();
|
||||
|
||||
const mission = msWithTs.createMission({ title: "Mission", branchStrategy: { mode: "auto-per-task" } });
|
||||
const milestone = msWithTs.addMilestone(mission.id, { title: "Milestone" });
|
||||
const slice = msWithTs.addSlice(milestone.id, { title: "Slice" });
|
||||
const feature = msWithTs.addFeature(slice.id, { title: "Original" });
|
||||
|
||||
const triaged = await msWithTs.triageFeature(feature.id);
|
||||
const task = await ts.getTask(triaged.taskId!);
|
||||
|
||||
expect(task?.branchContext?.assignmentMode).toBe("per-task-derived");
|
||||
});
|
||||
|
||||
it("uses mission branchStrategy existing branch when branch options are omitted", async () => {
|
||||
const { TaskStore } = await import("../store.js");
|
||||
const ts = new TaskStore(tmpDir, join(tmpDir, ".fusion-global-settings"), { inMemoryDb: true });
|
||||
const msWithTs = ts.getMissionStore();
|
||||
|
||||
const mission = msWithTs.createMission({
|
||||
title: "Mission",
|
||||
branchStrategy: { mode: "existing", branchName: "release/shared" },
|
||||
});
|
||||
const milestone = msWithTs.addMilestone(mission.id, { title: "Milestone" });
|
||||
const slice = msWithTs.addSlice(milestone.id, { title: "Slice" });
|
||||
const feature = msWithTs.addFeature(slice.id, { title: "Original" });
|
||||
|
||||
const triaged = await msWithTs.triageFeature(feature.id);
|
||||
const task = await ts.getTask(triaged.taskId!);
|
||||
|
||||
expect(task?.branch).toBe("release/shared");
|
||||
expect(task?.branchContext?.assignmentMode).toBe("shared");
|
||||
});
|
||||
|
||||
it("explicit branch options override mission branchStrategy defaults", async () => {
|
||||
const { TaskStore } = await import("../store.js");
|
||||
const ts = new TaskStore(tmpDir, join(tmpDir, ".fusion-global-settings"), { inMemoryDb: true });
|
||||
const msWithTs = ts.getMissionStore();
|
||||
|
||||
const mission = msWithTs.createMission({ title: "Mission", branchStrategy: { mode: "auto-per-task" } });
|
||||
const milestone = msWithTs.addMilestone(mission.id, { title: "Milestone" });
|
||||
const slice = msWithTs.addSlice(milestone.id, { title: "Slice" });
|
||||
const feature = msWithTs.addFeature(slice.id, { title: "Original" });
|
||||
|
||||
const triaged = await msWithTs.triageFeature(feature.id, undefined, undefined, {
|
||||
branch: "hotfix/shared",
|
||||
assignmentMode: "shared",
|
||||
});
|
||||
const task = await ts.getTask(triaged.taskId!);
|
||||
|
||||
expect(task?.branch).toBe("hotfix/shared");
|
||||
expect(task?.branchContext?.assignmentMode).toBe("shared");
|
||||
});
|
||||
|
||||
it("uses provided title and description overrides", async () => {
|
||||
const { TaskStore } = await import("../store.js");
|
||||
const ts = new TaskStore(tmpDir, join(tmpDir, ".fusion-global-settings"), { inMemoryDb: true });
|
||||
@@ -2080,6 +2165,52 @@ describe("MissionStore", () => {
|
||||
expect(task?.baseBranch).toBe("develop");
|
||||
});
|
||||
|
||||
it("triageSlice uses mission auto-per-task branchStrategy defaults", async () => {
|
||||
const { TaskStore } = await import("../store.js");
|
||||
const ts = new TaskStore(tmpDir, join(tmpDir, ".fusion-global-settings"), { inMemoryDb: true });
|
||||
const msWithTs = ts.getMissionStore();
|
||||
|
||||
const mission = msWithTs.createMission({
|
||||
title: "Mission",
|
||||
branchStrategy: { mode: "auto-per-task" },
|
||||
});
|
||||
const milestone = msWithTs.addMilestone(mission.id, { title: "Milestone" });
|
||||
const slice = msWithTs.addSlice(milestone.id, { title: "Slice" });
|
||||
const f1 = msWithTs.addFeature(slice.id, { title: "Feature 1" });
|
||||
|
||||
const triaged = await msWithTs.triageSlice(slice.id);
|
||||
const task = await ts.getTask(triaged[0].taskId!);
|
||||
|
||||
expect(triaged[0].id).toBe(f1.id);
|
||||
expect(task?.branchContext?.assignmentMode).toBe("per-task-derived");
|
||||
});
|
||||
|
||||
it("triageSlice respects explicit branch options over mission strategy defaults", async () => {
|
||||
const { TaskStore } = await import("../store.js");
|
||||
const ts = new TaskStore(tmpDir, join(tmpDir, ".fusion-global-settings"), { inMemoryDb: true });
|
||||
const msWithTs = ts.getMissionStore();
|
||||
|
||||
const mission = msWithTs.createMission({
|
||||
title: "Mission",
|
||||
baseBranch: "develop",
|
||||
branchStrategy: { mode: "auto-per-task" },
|
||||
});
|
||||
const milestone = msWithTs.addMilestone(mission.id, { title: "Milestone" });
|
||||
const slice = msWithTs.addSlice(milestone.id, { title: "Slice" });
|
||||
msWithTs.addFeature(slice.id, { title: "Feature 1" });
|
||||
|
||||
const triaged = await msWithTs.triageSlice(slice.id, {
|
||||
branch: "feature/manual",
|
||||
assignmentMode: "shared",
|
||||
baseBranch: "release",
|
||||
});
|
||||
const task = await ts.getTask(triaged[0].taskId!);
|
||||
|
||||
expect(task?.branch).toBe("feature/manual");
|
||||
expect(task?.baseBranch).toBe("release");
|
||||
expect(task?.branchContext?.assignmentMode).toBe("shared");
|
||||
});
|
||||
|
||||
it("triageSlice does not inject baseBranch when mission has none", async () => {
|
||||
const { TaskStore } = await import("../store.js");
|
||||
const ts = new TaskStore(tmpDir, join(tmpDir, ".fusion-global-settings"), { inMemoryDb: true });
|
||||
@@ -2159,6 +2290,21 @@ describe("MissionStore", () => {
|
||||
expect(task2!.missionId).toBe(mission.id);
|
||||
});
|
||||
|
||||
it("auto-triage uses mission branchStrategy defaults", async () => {
|
||||
const { ts, ms } = await createStoreWithTaskStore();
|
||||
|
||||
const mission = ms.createMission({ title: "Mission", branchStrategy: { mode: "auto-per-task" } });
|
||||
ms.updateMission(mission.id, { autoAdvance: true });
|
||||
const milestone = ms.addMilestone(mission.id, { title: "Milestone" });
|
||||
const slice = ms.addSlice(milestone.id, { title: "Slice" });
|
||||
const feature = ms.addFeature(slice.id, { title: "Feature 1" });
|
||||
|
||||
await ms.activateSlice(slice.id);
|
||||
|
||||
const task = await ts.getTask(ms.getFeature(feature.id)!.taskId!);
|
||||
expect(task?.branchContext?.assignmentMode).toBe("per-task-derived");
|
||||
});
|
||||
|
||||
it("does not triage features when autoAdvance is false", async () => {
|
||||
const { ms } = await createStoreWithTaskStore();
|
||||
|
||||
@@ -3036,7 +3182,7 @@ describe("MissionStore", () => {
|
||||
|
||||
describe("Loop State & Validator Run Schema (v31)", () => {
|
||||
it("schema version is 40 after migration", () => {
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
});
|
||||
|
||||
it("mission_features table has loop state columns", () => {
|
||||
|
||||
@@ -584,7 +584,7 @@ describe("Run Audit", () => {
|
||||
});
|
||||
|
||||
it("schema version is bumped to 40", () => {
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -42,7 +42,7 @@ describe("secrets schema migrations", () => {
|
||||
const version = db
|
||||
.prepare("SELECT value FROM __meta WHERE key = 'schemaVersion'")
|
||||
.get() as { value: string };
|
||||
expect(version.value).toBe("97");
|
||||
expect(version.value).toBe("98");
|
||||
} finally {
|
||||
db.close();
|
||||
rmSync(dir, { recursive: true, force: true });
|
||||
@@ -105,7 +105,7 @@ describe("secrets schema migrations", () => {
|
||||
const version = db
|
||||
.prepare("SELECT value FROM __meta WHERE key = 'schemaVersion'")
|
||||
.get() as { value: string };
|
||||
expect(version.value).toBe("97");
|
||||
expect(version.value).toBe("98");
|
||||
} finally {
|
||||
db.close();
|
||||
rmSync(dir, { recursive: true, force: true });
|
||||
@@ -155,7 +155,7 @@ describe("secrets schema migrations", () => {
|
||||
.prepare("SELECT value FROM __meta WHERE key = 'schemaVersion'")
|
||||
.get() as { value: string };
|
||||
|
||||
expect(projectVersion.value).toBe("97");
|
||||
expect(projectVersion.value).toBe("98");
|
||||
expect(centralVersion.value).toBe("13");
|
||||
} finally {
|
||||
projectDb.close();
|
||||
|
||||
@@ -60,7 +60,7 @@ describe("TaskStore merge queue", () => {
|
||||
expect.arrayContaining(["idx_mergeQueue_lease_ready", "idx_mergeQueue_leaseExpiresAt"]),
|
||||
);
|
||||
|
||||
expect(store.getDatabase().getSchemaVersion()).toBe(97);
|
||||
expect(store.getDatabase().getSchemaVersion()).toBe(98);
|
||||
});
|
||||
|
||||
it("migrates a legacy v88 database and preserves task rows", async () => {
|
||||
|
||||
@@ -51,7 +51,7 @@ describe("TaskStore task documents", () => {
|
||||
|
||||
expect(tableNames.has("task_documents")).toBe(true);
|
||||
expect(tableNames.has("task_document_revisions")).toBe(true);
|
||||
expect(db.getSchemaVersion()).toBe(97);
|
||||
expect(db.getSchemaVersion()).toBe(98);
|
||||
|
||||
const index = db
|
||||
.prepare(
|
||||
|
||||
Reference in New Issue
Block a user