fix(core): Show correct error messages when nodes can't be used in an expression (#16549)

This commit is contained in:
Danny Martini
2025-06-20 14:52:11 +02:00
committed by GitHub
parent 921f20a283
commit 48644ca2f8
2 changed files with 13 additions and 3 deletions

View File

@@ -519,7 +519,7 @@ describe('WorkflowExecute', () => {
// ┌───────┐1 ┌─────┐1 ┌─────┐ // ┌───────┐1 ┌─────┐1 ┌─────┐
// │trigger├──────►node1├──────►node2│ // │trigger├──────►node1├──────►node2│
// └───────┘ └─────┘ └─────┘ // └───────┘ └─────┘ └─────┘
test('removes disabled nodes from the workflow', async () => { test('removes disabled nodes from the runNodeFilter, but not the graph', async () => {
// ARRANGE // ARRANGE
const waitPromise = createDeferredPromise<IRun>(); const waitPromise = createDeferredPromise<IRun>();
const additionalData = Helpers.WorkflowExecuteAdditionalData(waitPromise); const additionalData = Helpers.WorkflowExecuteAdditionalData(waitPromise);
@@ -555,11 +555,17 @@ describe('WorkflowExecute', () => {
); );
// ASSERT // 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); expect(processRunExecutionDataSpy).toHaveBeenCalledTimes(1);
const nodes = Object.keys(processRunExecutionDataSpy.mock.calls[0][0].nodes); const nodes = Object.keys(processRunExecutionDataSpy.mock.calls[0][0].nodes);
expect(nodes).toContain(trigger.name); expect(nodes).toContain(trigger.name);
expect(nodes).toContain(node2.name); expect(nodes).toContain(node2.name);
expect(nodes).not.toContain(node1.name); expect(nodes).toContain(node1.name);
}); });
// ►► // ►►

View File

@@ -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);
} }
/** /**