feat(FN-4578): complete Step 1 — add milestone acceptance criteria schema

Fusion-Task-Id: FN-4578
Fusion-Task-Lineage: 1be0fa08-4d83-4988-a218-326225dfe4b5
This commit is contained in:
Fusion
2026-05-15 02:26:53 -07:00
committed by gsxdsm
parent 9adff3a809
commit 9415e28fbd
4 changed files with 42 additions and 1 deletions

View File

@@ -772,6 +772,35 @@ describe("schema migration", () => {
db.close();
});
it("adds milestones.acceptanceCriteria when migrating from schema version 79", () => {
const db = new Database(fusionDir);
db.exec("CREATE TABLE IF NOT EXISTS __meta (key TEXT PRIMARY KEY, value TEXT)");
db.exec(`
CREATE TABLE IF NOT EXISTS milestones (
id TEXT PRIMARY KEY,
missionId TEXT NOT NULL,
title TEXT NOT NULL,
description TEXT,
status TEXT NOT NULL,
orderIndex INTEGER NOT NULL,
interviewState TEXT NOT NULL,
dependencies TEXT DEFAULT '[]',
createdAt TEXT NOT NULL,
updatedAt TEXT NOT NULL
)
`);
db.exec("INSERT INTO __meta (key, value) VALUES ('schemaVersion', '79')");
db.exec("INSERT INTO __meta (key, value) VALUES ('lastModified', '1000')");
db.init();
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(80);
db.close();
});
it("v76 backfill preserves explicit gateMode and defaults the rest to advisory (FN-4497)", () => {
const db = new Database(fusionDir);
db.exec("CREATE TABLE IF NOT EXISTS __meta (key TEXT PRIMARY KEY, value TEXT)");

View File

@@ -119,7 +119,7 @@ export function probeFts5(db: DatabaseSync): boolean {
// ── Schema Definition ────────────────────────────────────────────────
const SCHEMA_VERSION = 79;
const SCHEMA_VERSION = 80;
function normalizeTaskComments(
steeringComments: SteeringComment[] | undefined,
@@ -700,6 +700,7 @@ CREATE TABLE IF NOT EXISTS milestones (
orderIndex INTEGER NOT NULL,
interviewState TEXT NOT NULL,
dependencies TEXT DEFAULT '[]',
acceptanceCriteria TEXT,
createdAt TEXT NOT NULL,
updatedAt TEXT NOT NULL,
FOREIGN KEY (missionId) REFERENCES missions(id) ON DELETE CASCADE
@@ -3291,6 +3292,12 @@ export class Database {
});
}
if (version < 80) {
this.applyMigration(80, () => {
this.addColumnIfMissing("milestones", "acceptanceCriteria", "TEXT");
});
}
}
/**

View File

@@ -160,6 +160,7 @@ interface MilestoneRow {
dependencies: string | null;
planningNotes: string | null;
verification: string | null;
acceptanceCriteria: string | null;
validationState: string | null;
createdAt: string;
updatedAt: string;

View File

@@ -167,6 +167,8 @@ export interface Milestone {
planningNotes?: string;
/** How to verify milestone completion */
verification?: string;
/** Acceptance criteria for completing the milestone */
acceptanceCriteria?: string;
/** Computed validation state from contract assertions (optional, always populated by MissionStore) */
validationState?: MilestoneValidationState;
/** ISO-8601 timestamp of creation */
@@ -381,6 +383,8 @@ export interface MilestoneCreateInput {
planningNotes?: string;
/** How to verify milestone completion */
verification?: string;
/** Acceptance criteria for completing the milestone */
acceptanceCriteria?: string;
}
/** Input for creating a new Slice */