From 78cae1522ac36aee5bb2f2f4f4aef50f57cc25ee Mon Sep 17 00:00:00 2001 From: nicosammito Date: Tue, 14 Apr 2026 17:31:53 +0200 Subject: [PATCH 1/2] test: add startingNodeId to flow validation tests for improved context --- test/flowValidation.test.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/test/flowValidation.test.ts b/test/flowValidation.test.ts index 772c7ea..f0394f7 100644 --- a/test/flowValidation.test.ts +++ b/test/flowValidation.test.ts @@ -8,6 +8,7 @@ describe('getFlowValidation - Integrationstest', () => { it('1', () => { const flow: Flow = { + startingNodeId: "gid://sagittarius/NodeFunction/1", nodes: { nodes: [ { @@ -51,7 +52,7 @@ describe('getFlowValidation - Integrationstest', () => { __typename: "ReferenceValue", nodeFunctionId: "gid://sagittarius/NodeFunction/2", parameterIndex: 1, - inputIndex: 0, //TODO: Das wird gerade einfach nicht berücksichtigt + inputIndex: 0, referencePath: [{path: "test"}] } }, @@ -149,6 +150,7 @@ describe('getFlowValidation - Integrationstest', () => { it('4', () => { const flow: Flow = { + startingNodeId: "gid://sagittarius/NodeFunction/1", nodes: { nodes: [ { @@ -198,6 +200,7 @@ describe('getFlowValidation - Integrationstest', () => { it('5', () => { const flow: Flow = { + startingNodeId: "gid://sagittarius/NodeFunction/2", nodes: { nodes: [ { From b32a2a285f53bf9528730f3e4d8765c89d9ce13a Mon Sep 17 00:00:00 2001 From: nicosammito Date: Tue, 14 Apr 2026 17:31:58 +0200 Subject: [PATCH 2/2] refactor: add validation for startingNodeId in flow execution to ensure proper flow connectivity --- src/validation/getFlowValidation.ts | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/validation/getFlowValidation.ts b/src/validation/getFlowValidation.ts index 90fd67a..67fc36d 100644 --- a/src/validation/getFlowValidation.ts +++ b/src/validation/getFlowValidation.ts @@ -12,6 +12,34 @@ export const getFlowValidation = ( ): ValidationResult => { + if (!flow?.startingNodeId) { + return { + isValid: false, + returnType: "void", + diagnostics: [{ + nodeId: null, + parameterIndex: null, + code: 0, + message: "You need to provide a starting node to be able to execute this flow.", + severity: "error", + }] + } + } + + if (!flow.nodes?.nodes?.find(n => n?.id == flow.startingNodeId)) { + return { + isValid: false, + returnType: "void", + diagnostics: [{ + nodeId: null, + parameterIndex: null, + code: 0, + message: "The starting node is not linked within the flow. Please make sure the starting node is connected to the rest of the flow.", + severity: "error", + }] + } + } + const sourceCode = generateFlowSourceCode(flow, functions, dataTypes); // 3. Virtual TypeScript Compilation