feat(FN-3064): add todo planning entrypoint with peer exchange shutdown imp

This merge introduces a new Todo Planning mode for task creation, wiring the entrypoint through the dashboard and CLI, accompanied by a new `PlanningModeModal` component and associated tests. It also makes peer exchange shutdown deterministic in the engine, improves rate limiting for the planning fl

Fusion-Task-Id: FN-3064
This commit is contained in:
Fusion
2026-05-01 13:43:25 -07:00
committed by gsxdsm
parent bdfbcb3039
commit 6f2632f990
18 changed files with 709 additions and 27 deletions

View File

@@ -132,7 +132,7 @@ describe("Database", () => {
});
it("seeds schema version", () => {
expect(db.getSchemaVersion()).toBe(57);
expect(db.getSchemaVersion()).toBe(58);
});
it("seeds lastModified", () => {
@@ -155,7 +155,7 @@ describe("Database", () => {
it("is idempotent - calling init() twice does not fail", () => {
expect(() => db.init()).not.toThrow();
expect(db.getSchemaVersion()).toBe(57);
expect(db.getSchemaVersion()).toBe(58);
});
it("does not overwrite existing config on re-init", () => {
@@ -762,7 +762,7 @@ describe("schema migrations", () => {
db.init();
// Verify version bumped to 29 (includes v1→v2 through v26→v29)
expect(db.getSchemaVersion()).toBe(57);
expect(db.getSchemaVersion()).toBe(58);
// Verify new columns exist and existing data is intact
const cols = db.prepare("PRAGMA table_info(tasks)").all() as Array<{ name: string }>;
@@ -787,11 +787,11 @@ describe("schema migrations", () => {
const db = new Database(fusionDir);
db.init();
expect(db.getSchemaVersion()).toBe(57);
expect(db.getSchemaVersion()).toBe(58);
// Re-init should not fail
db.init();
expect(db.getSchemaVersion()).toBe(57);
expect(db.getSchemaVersion()).toBe(58);
db.close();
});
@@ -826,7 +826,7 @@ describe("schema migrations", () => {
db.init();
expect(db.getSchemaVersion()).toBe(57);
expect(db.getSchemaVersion()).toBe(58);
const cols = db.prepare("PRAGMA table_info(tasks)").all() as Array<{ name: string }>;
expect(cols.map((col) => col.name)).toContain("priority");
@@ -867,7 +867,7 @@ describe("schema migrations", () => {
db.init();
expect(db.getSchemaVersion()).toBe(57);
expect(db.getSchemaVersion()).toBe(58);
const cols = db.prepare("PRAGMA table_info(tasks)").all() as Array<{ name: string }>;
const colNames = cols.map((col) => col.name);
@@ -936,7 +936,7 @@ describe("schema migrations", () => {
db.init();
expect(db.getSchemaVersion()).toBe(57);
expect(db.getSchemaVersion()).toBe(58);
const cols = db.prepare("PRAGMA table_info(tasks)").all() as Array<{ name: string }>;
const colNames = cols.map((col) => col.name);
@@ -1039,7 +1039,7 @@ describe("schema migrations", () => {
db.init();
expect(db.getSchemaVersion()).toBe(57);
expect(db.getSchemaVersion()).toBe(58);
const cols = db.prepare("PRAGMA table_info(chat_messages)").all() as Array<{ name: string }>;
expect(cols.map((col) => col.name)).toContain("attachments");
@@ -1113,7 +1113,7 @@ describe("schema migrations", () => {
db.init();
expect(db.getSchemaVersion()).toBe(57);
expect(db.getSchemaVersion()).toBe(58);
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" }]);
@@ -1137,7 +1137,7 @@ describe("schema migrations", () => {
db.init();
expect(db.getSchemaVersion()).toBe(57);
expect(db.getSchemaVersion()).toBe(58);
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" }]);
@@ -1241,7 +1241,7 @@ describe("schema migrations", () => {
db.init();
// Verify version bumped to 29
expect(db.getSchemaVersion()).toBe(57);
expect(db.getSchemaVersion()).toBe(58);
// Verify new columns exist and existing data is intact
const cols = db.prepare("PRAGMA table_info(tasks)").all() as Array<{ name: string }>;
@@ -1710,7 +1710,7 @@ describe("createDatabase factory", () => {
const db = createDatabase(fusionDir);
db.init();
expect(db.getSchemaVersion()).toBe(57);
expect(db.getSchemaVersion()).toBe(58);
expect(db.getLastModified()).toBeGreaterThan(0);
db.close();

View File

@@ -779,7 +779,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(57);
expect(db1.getSchemaVersion()).toBe(58);
db1.close();
// Step 2: Manually downgrade to version 32 and drop insight tables
@@ -814,7 +814,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(57);
expect(db3.getSchemaVersion()).toBe(58);
// Step 4: Verify insight tables exist after migration
const tablesAfter = db3.prepare(
@@ -845,12 +845,12 @@ describe("Migration: pre-33 DB upgrade", () => {
try {
const db1 = createDatabase(testDir);
db1.init();
expect(db1.getSchemaVersion()).toBe(57);
expect(db1.getSchemaVersion()).toBe(58);
db1.close();
const db2 = createDatabase(testDir);
expect(() => db2.init()).not.toThrow();
expect(db2.getSchemaVersion()).toBe(57);
expect(db2.getSchemaVersion()).toBe(58);
db2.close();
} finally {
rmSync(testDir, { recursive: true, force: true });

View File

@@ -2629,7 +2629,7 @@ describe("MissionStore", () => {
describe("Loop State & Validator Run Schema (v31)", () => {
it("schema version is 40 after migration", () => {
expect(db.getSchemaVersion()).toBe(57);
expect(db.getSchemaVersion()).toBe(58);
});
it("mission_features table has loop state columns", () => {

View File

@@ -742,7 +742,7 @@ describe("RoadmapStore", () => {
describe("schema version", () => {
it("schema version is 40 after init", () => {
expect(db.getSchemaVersion()).toBe(57);
expect(db.getSchemaVersion()).toBe(58);
});
});

View File

@@ -465,7 +465,7 @@ describe("Run Audit", () => {
});
it("schema version is bumped to 40", () => {
expect(db.getSchemaVersion()).toBe(57);
expect(db.getSchemaVersion()).toBe(58);
});
});
});

View File

@@ -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(57);
expect(db.getSchemaVersion()).toBe(58);
const index = db
.prepare(