fix(FN-7233): preserve workflow optional step phase

This commit is contained in:
gsxdsm
2026-06-29 12:47:21 -07:00
parent 50f8807037
commit a84afc178f
3 changed files with 22 additions and 4 deletions

View File

@@ -0,0 +1,7 @@
---
"@runfusion/fusion": patch
---
summary: Show post-merge verification as a post-merge optional workflow step.
category: fix
dev: Preserves optional-group `config.phase` when resolving workflow optional steps.

View File

@@ -110,9 +110,9 @@ describe("resolveWorkflowOptionalSteps (optional-group nodes)", () => {
});
it("resolves the built-in coding/stepwise optional-groups in execution order", () => {
// Legacy/default/stepwise engineering workflows expose the same three toggles
// Legacy/default/stepwise engineering workflows expose the same toggles
// in execution order: plan review before execution, then browser verification
// and code review after implementation.
// and code review after implementation, then post-merge verification after merge proof.
const engineeringExpected = [
{
templateId: "plan-review",
@@ -135,6 +135,13 @@ describe("resolveWorkflowOptionalSteps (optional-group nodes)", () => {
phase: "pre-merge" as const,
defaultOn: true,
},
{
templateId: "post-merge-verification",
name: "Post-merge verification",
description: "",
phase: "post-merge" as const,
defaultOn: false,
},
];
expect(resolveWorkflowOptionalSteps(BUILTIN_CODING_WORKFLOW_IR)).toEqual(engineeringExpected);
expect(resolveWorkflowOptionalSteps(BUILTIN_STEPWISE_CODING_WORKFLOW_IR)).toEqual(engineeringExpected);

View File

@@ -18,7 +18,7 @@ export interface ResolvedWorkflowOptionalStep {
FNXC:WorkflowOptionalGroup 2026-06-21-14:05:
Re-pointed the per-task optional-step toggle SOURCE from the execution-inert `ir.optionalSteps` declaration to v2 `optional-group` NODES (one resolved entry per group). The legacy `WorkflowOptionalStep` type + `optionalSteps` IR field are now REMOVED (FNXC:WorkflowOptionalGroup 2026-06-21-18:00); a legacy persisted `optionalSteps` key on an old v2 row is tolerated/ignored at parse.
KEYING: the resolved entry is keyed by the group node `id`. The output field is still named `templateId` (not renamed) so the four consuming UI surfaces — inline quick-create card, New Task modal/TaskForm, task-detail Workflow tab, and the optional-steps dropdown — keep reading the same shape unchanged; they now toggle group ids into `enabledWorkflowSteps` instead of template ids. Renaming/recreating a group resets per-task state, identical to the prior `templateId` keying.
Display metadata: `name` comes from `config.name` (falling back to the node id), `defaultOn` from `config.defaultOn ?? false`. The group node carries no description/icon/phase, so `description` is "" and `phase` defaults to "pre-merge" — keeping every field the consumers read populated and non-blank.
Display metadata: `name` comes from `config.name` (falling back to the node id), `defaultOn` from `config.defaultOn ?? false`, and `phase` from `config.phase ?? "pre-merge"`. `description` remains "" because optional-group nodes do not carry display copy for it.
*/
function isOptionalGroupNode(
@@ -93,7 +93,11 @@ export function resolveWorkflowOptionalSteps(
templateId: node.id,
name: typeof config.name === "string" && config.name.trim() ? config.name : node.id,
description: "",
phase: "pre-merge",
/*
FNXC:WorkflowOptionalSteps 2026-06-29-12:47:
Post-merge verification is now a graph-native optional group. Task creation and detail surfaces need the resolver to preserve `config.phase` so post-merge toggles do not look like pre-merge gates.
*/
phase: config.phase === "post-merge" ? "post-merge" : "pre-merge",
defaultOn: config.defaultOn === true,
/*
FNXC:WorkflowDefinitionSteps 2026-06-29-00:41: