Files
fusion/packages/core/src/node-override-guard.ts
Fusion 02ae48b0d6 feat(FN-2721): enforce node override guard across task workflows
- Add a core node-override-guard module, export it from @fusion/core, and enforce conflicts in store updates
- Add API route and CLI extension safeguards so nodeId override updates are blocked when ownership would conflict
- Wire node override routing and validation through dashboard quick-create, list, modal, settings, and task form/detail surfaces
- Add focused unit and integration tests for core guard logic, workflow routes, and dashboard node override UX
2026-04-28 14:25:55 -07:00

27 lines
830 B
TypeScript

export type NodeOverrideBlockReason = "task-in-progress";
export interface NodeOverrideValidationResult {
allowed: boolean;
reason?: NodeOverrideBlockReason;
message?: string;
}
export function validateNodeOverrideChange(
task: { column: string; nodeId?: string; id: string },
newNodeId: string | null | undefined,
): NodeOverrideValidationResult {
if (newNodeId === undefined) {
return { allowed: true };
}
if (task.column === "in-progress") {
return {
allowed: false,
reason: "task-in-progress",
message: `Cannot change node override for ${task.id} while it is in progress. The task is currently executing and routing cannot be changed mid-flight. Wait for the task to complete, or pause/stop it first before changing the node assignment.`,
};
}
return { allowed: true };
}