fix: prevent nested .fusion/.fusion dir from PluginStore path bug
PluginStore's constructor treats its rootDir arg as a project root and internally appends `.fusion` before opening the SQLite DB. Several CLI call sites were passing the already-resolved `.fusion` directory, producing a doubled `.fusion/.fusion/fusion.db` that the dashboard process kept recreating on every project load. Pass the project root instead so the DB lands in the canonical `.fusion/fusion.db` alongside the rest of the project's state. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
66
packages/dashboard/app/utils/taskProgress.ts
Normal file
66
packages/dashboard/app/utils/taskProgress.ts
Normal file
@@ -0,0 +1,66 @@
|
||||
import type { Task, WorkflowStepResult, WorkflowStepPhase, StepStatus } from "@fusion/core";
|
||||
|
||||
export type UnifiedTaskProgressStatus = StepStatus | "failed";
|
||||
|
||||
export interface UnifiedTaskProgressItem {
|
||||
id: string;
|
||||
name: string;
|
||||
status: UnifiedTaskProgressStatus;
|
||||
source: "step" | "workflow";
|
||||
phase: WorkflowStepPhase;
|
||||
}
|
||||
|
||||
export interface UnifiedTaskProgress {
|
||||
total: number;
|
||||
completed: number;
|
||||
items: UnifiedTaskProgressItem[];
|
||||
}
|
||||
|
||||
function mapWorkflowStatus(status: WorkflowStepResult["status"]): UnifiedTaskProgressStatus {
|
||||
switch (status) {
|
||||
case "passed":
|
||||
return "done";
|
||||
case "failed":
|
||||
return "failed";
|
||||
case "skipped":
|
||||
return "skipped";
|
||||
case "pending":
|
||||
default:
|
||||
return "pending";
|
||||
}
|
||||
}
|
||||
|
||||
function isCompleted(status: UnifiedTaskProgressStatus): boolean {
|
||||
return status === "done" || status === "skipped";
|
||||
}
|
||||
|
||||
export function getUnifiedTaskProgress(task: Pick<Task, "steps" | "enabledWorkflowSteps" | "workflowStepResults">): UnifiedTaskProgress {
|
||||
const stepItems: UnifiedTaskProgressItem[] = (task.steps ?? []).map((step, index) => ({
|
||||
id: `step-${index}`,
|
||||
name: step.name,
|
||||
status: step.status,
|
||||
source: "step",
|
||||
phase: "pre-merge",
|
||||
}));
|
||||
|
||||
const workflowResultsById = new Map(
|
||||
(task.workflowStepResults ?? []).map((result) => [result.workflowStepId, result] as const),
|
||||
);
|
||||
|
||||
const workflowItems: UnifiedTaskProgressItem[] = (task.enabledWorkflowSteps ?? []).map((workflowStepId) => {
|
||||
const result = workflowResultsById.get(workflowStepId);
|
||||
return {
|
||||
id: `workflow-${workflowStepId}`,
|
||||
name: result?.workflowStepName || workflowStepId,
|
||||
status: result ? mapWorkflowStatus(result.status) : "pending",
|
||||
source: "workflow",
|
||||
phase: result?.phase ?? "pre-merge",
|
||||
};
|
||||
});
|
||||
|
||||
const items = [...stepItems, ...workflowItems];
|
||||
const total = items.length;
|
||||
const completed = items.filter((item) => isCompleted(item.status)).length;
|
||||
|
||||
return { total, completed, items };
|
||||
}
|
||||
Reference in New Issue
Block a user