From 48644ca2f8bb0c1c2bf85edfda8d704d92cc2fb8 Mon Sep 17 00:00:00 2001 From: Danny Martini Date: Fri, 20 Jun 2025 14:52:11 +0200 Subject: [PATCH] fix(core): Show correct error messages when nodes can't be used in an expression (#16549) --- .../__tests__/workflow-execute.test.ts | 10 ++++++++-- packages/core/src/execution-engine/workflow-execute.ts | 6 +++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/core/src/execution-engine/__tests__/workflow-execute.test.ts b/packages/core/src/execution-engine/__tests__/workflow-execute.test.ts index 8c968a123c..6b42cb68b0 100644 --- a/packages/core/src/execution-engine/__tests__/workflow-execute.test.ts +++ b/packages/core/src/execution-engine/__tests__/workflow-execute.test.ts @@ -519,7 +519,7 @@ describe('WorkflowExecute', () => { // ┌───────┐1 ┌─────┐1 ┌─────┐ // │trigger├──────►node1├──────►node2│ // └───────┘ └─────┘ └─────┘ - test('removes disabled nodes from the workflow', async () => { + test('removes disabled nodes from the runNodeFilter, but not the graph', async () => { // ARRANGE const waitPromise = createDeferredPromise(); const additionalData = Helpers.WorkflowExecuteAdditionalData(waitPromise); @@ -555,11 +555,17 @@ describe('WorkflowExecute', () => { ); // ASSERT + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const runNodeFilter: string[] = (workflowExecute as any).runExecutionData.startData + ?.runNodeFilter; + expect(runNodeFilter).toContain(trigger.name); + expect(runNodeFilter).toContain(node2.name); + expect(runNodeFilter).not.toContain(node1.name); expect(processRunExecutionDataSpy).toHaveBeenCalledTimes(1); const nodes = Object.keys(processRunExecutionDataSpy.mock.calls[0][0].nodes); expect(nodes).toContain(trigger.name); expect(nodes).toContain(node2.name); - expect(nodes).not.toContain(node1.name); + expect(nodes).toContain(node1.name); }); // ►► diff --git a/packages/core/src/execution-engine/workflow-execute.ts b/packages/core/src/execution-engine/workflow-execute.ts index 8612e31a68..3096254470 100644 --- a/packages/core/src/execution-engine/workflow-execute.ts +++ b/packages/core/src/execution-engine/workflow-execute.ts @@ -473,7 +473,11 @@ export class WorkflowExecute { }, }; - return this.processRunExecutionData(graph.toWorkflow({ ...workflow })); + // Still passing the original workflow here, because the WorkflowDataProxy + // needs it to create more useful error messages, e.g. differentiate + // between a node not being connected to the node referencing it or a node + // not existing in the workflow. + return this.processRunExecutionData(workflow); } /**