fix(core): Consider pinned data as valid paths for single node execution (#17959)

This commit is contained in:
Csaba Tuncsik
2025-08-06 15:23:21 +02:00
committed by GitHub
parent a1682e8fe4
commit 32f47948d6
2 changed files with 58 additions and 0 deletions

View File

@@ -11,6 +11,7 @@ import type {
INode,
INodeExecutionData,
INodeParameters,
IPinData,
IRunExecutionData,
NodeParameterValueType,
} from '../src/interfaces';
@@ -3583,5 +3584,56 @@ describe('Workflow', () => {
expect(workflow.hasPath('Node1', 'Node2')).toBe(false);
expect(workflow.hasPath('Node2', 'Node1')).toBe(false);
});
it('should return true when source node has pinned data (virtual path)', () => {
const nodes: INode[] = [
{
id: '1',
name: 'Trigger',
type: 'n8n-nodes-base.executeWorkflowTrigger',
typeVersion: 1,
position: [0, 0],
parameters: {},
},
{
id: '2',
name: 'EditFields',
type: 'n8n-nodes-base.set',
typeVersion: 1,
position: [200, 0],
parameters: {},
},
];
const connections: IConnections = {
Trigger: {
main: [[{ node: 'EditFields', type: 'main', index: 0 }]],
},
};
const pinData: IPinData = {
Trigger: [
{
json: {
name: 'Test item',
value: 123,
},
},
],
};
const workflow = new Workflow({
nodes,
connections,
active: false,
nodeTypes,
pinData,
});
// Should return true because Trigger has pinned data, creating a virtual path
expect(workflow.hasPath('Trigger', 'EditFields')).toBe(true);
// Should also work for self-reference with pinned data
expect(workflow.hasPath('Trigger', 'Trigger')).toBe(true);
});
});
});