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 a07cb53e1d
commit 52168d7f2c
18 changed files with 387 additions and 30 deletions

View File

@@ -13,6 +13,7 @@ import { readFile, readdir, rename } from "node:fs/promises";
import { join } from "node:path";
import type { Database } from "./db.js";
import { toJson, toJsonNullable, normalizeTaskComments } from "./db.js";
import { normalizeTaskPriority } from "./task-priority.js";
import type { Task, BoardConfig, ActivityLogEntry, ArchivedTaskEntry, WorkflowStep } from "./types.js";
import type { ScheduledTask } from "./automation.js";
@@ -215,7 +216,7 @@ async function migrateTasks(fusionDir: string, db: Database): Promise<void> {
const insertStmt = db.prepare(`
INSERT OR REPLACE INTO tasks (
id, title, description, "column", status, size, reviewLevel, currentStep,
id, title, description, priority, "column", status, size, reviewLevel, currentStep,
worktree, blockedBy, paused, baseBranch, baseCommitSha, modelPresetId,
modelProvider, modelId, validatorModelProvider, validatorModelId,
mergeRetries, recoveryRetryCount, nextRecoveryAt,
@@ -224,7 +225,7 @@ async function migrateTasks(fusionDir: string, db: Database): Promise<void> {
comments, workflowStepResults, prInfo, issueInfo, mergeDetails,
breakIntoSubtasks, enabledWorkflowSteps, modifiedFiles, sliceId
) VALUES (
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?,
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
)
`);
@@ -248,6 +249,7 @@ async function migrateTasks(fusionDir: string, db: Database): Promise<void> {
task.id,
task.title ?? null,
task.description,
normalizeTaskPriority(task.priority),
task.column,
task.status ?? null,
task.size ?? null,