feat(FN-2383): persist task priority across core storage

- Add task-priority contract, normalization helpers, and exports in @fusion/core types/index
- Store task priority in SQLite and migrate existing databases with default values
- Update task store behavior and sorting tests to preserve and order by persisted priority
- Add migration/regression coverage for archived tasks and refresh storage/task-management docs
This commit is contained in:
Fusion
2026-04-24 03:48:37 -07:00
committed by gsxdsm
parent 79cd34db47
commit 189fe189f4
18 changed files with 387 additions and 30 deletions

View File

@@ -86,7 +86,7 @@ export function probeFts5(db: DatabaseSync): boolean {
// ── Schema Definition ────────────────────────────────────────────────
const SCHEMA_VERSION = 42;
const SCHEMA_VERSION = 43;
function normalizeTaskComments(
steeringComments: SteeringComment[] | undefined,
@@ -152,6 +152,7 @@ CREATE TABLE IF NOT EXISTS tasks (
id TEXT PRIMARY KEY,
title TEXT,
description TEXT NOT NULL,
priority TEXT DEFAULT 'normal',
"column" TEXT NOT NULL,
status TEXT,
size TEXT,
@@ -1700,6 +1701,19 @@ export class Database {
});
}
// Task priority contract (FN-2383)
// Adds priority column and normalizes legacy/missing values to 'normal'.
if (version < 43) {
this.applyMigration(43, () => {
this.addColumnIfMissing("tasks", "priority", "TEXT DEFAULT 'normal'");
this.db.exec(`
UPDATE tasks
SET priority = 'normal'
WHERE priority IS NULL OR priority = '' OR priority NOT IN ('low', 'normal', 'high', 'urgent')
`);
});
}
}
/**