fix: resume distributed task ID counter past existing IDs; extract plugin view types

The dashboard task-create route now uses the distributed task ID allocator
(FN-3450). On projects whose tasks had been allocated through the legacy
config.nextId counter, the allocator's `ensureStateRow` was seeding a fresh
prefix at sequence 1, so new tasks restarted at FN-001 even when FN-3700
already existed. ensureStateRow now seeds past:

- the legacy config.nextId counter (when configured taskPrefix matches), and
- one past the highest numeric suffix on any existing tasks/archivedTasks row
  for the prefix.

A regression test seeds FN-3700 in a fresh DB and asserts the next reservation
returns FN-3701, not FN-001.

Plugin dashboard view contracts are now exposed via a slim type-only module
(`@fusion/dashboard/app/plugins/types`). External plugin tsc builds previously
imported `pluginViewRegistry`, transitively pulling in dashboard runtime
sources (React components, CSS, lucide-react). The dependency-graph plugin's
import + path mapping is updated to use the new module.

Schema housekeeping: drop unused scaffolding tables left over from an earlier
migration via a new idempotent migration (v67). Fresh DBs see no change;
existing DBs that ran the older migration get the orphan tables dropped on
next init.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
gsxdsm
2026-05-07 09:41:42 -07:00
parent e7deab16b8
commit e3f2e4c3be
21 changed files with 201 additions and 453 deletions

View File

@@ -0,0 +1,27 @@
/**
* Slim types-only module for plugin dashboard view contracts.
*
* External plugins (and their `tsc` builds) import `PluginDashboardViewContext`
* from here so they don't transitively pull in dashboard runtime sources
* (React components, CSS, lucide-react, etc.) through `pluginViewRegistry.tsx`.
*
* Keep imports here limited to type-only references from `@fusion/core`
* and `react`. Do NOT import dashboard components, hooks, or CSS here.
*/
import type { ReactNode } from "react";
import type { Task, TaskDetail, WorkflowStep } from "@fusion/core";
/** Tab identifiers for the task detail modal. Mirrors the dashboard's local enum. */
export type DetailTaskTab = "definition" | "logs" | "changes" | "comments" | "model" | "workflow";
/** Runtime context passed to a plugin dashboard view component. */
export interface PluginDashboardViewContext {
projectId?: string;
tasks: Task[];
workflowSteps: WorkflowStep[];
openTaskDetail: (task: Task | TaskDetail, initialTab?: DetailTaskTab) => void;
renderTaskCard?: (task: Task | TaskDetail) => ReactNode;
}
/** Composite view ID format: `plugin:{pluginId}:{viewId}`. */
export type PluginTaskView = `plugin:${string}:${string}`;