Skip to content

Commit 384062e

Browse files
committed
subflow results output extraction
1 parent 02e5224 commit 384062e

3 files changed

Lines changed: 15 additions & 15 deletions

File tree

apps/sim/executor/orchestrators/node.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,14 +234,15 @@ describe('NodeExecutionOrchestrator parallel sentinel batching', () => {
234234

235235
await orchestrator.handleNodeCompletion(ctx, endNode.id, {
236236
results: ['loop-result'],
237+
shouldExit: true,
237238
selectedRoute: EDGE.LOOP_EXIT,
238239
})
239240

240241
expect(parallelOrchestrator.handleParallelBranchCompletion).toHaveBeenCalledWith(
241242
ctx,
242243
'parent-parallel',
243244
endNode.id,
244-
{ results: ['loop-result'], selectedRoute: EDGE.LOOP_EXIT },
245+
{ results: ['loop-result'] },
245246
3
246247
)
247248
})
@@ -273,14 +274,15 @@ describe('NodeExecutionOrchestrator parallel sentinel batching', () => {
273274

274275
await orchestrator.handleNodeCompletion(ctx, endNode.id, {
275276
results: ['parallel-result'],
277+
sentinelEnd: true,
276278
selectedRoute: EDGE.PARALLEL_EXIT,
277279
})
278280

279281
expect(loopOrchestrator.storeLoopNodeOutput).toHaveBeenCalledWith(
280282
ctx,
281283
'parent-loop',
282284
'nested-parallel',
283-
{ results: ['parallel-result'], selectedRoute: EDGE.PARALLEL_EXIT }
285+
{ results: ['parallel-result'] }
284286
)
285287
})
286288
})

apps/sim/executor/orchestrators/node.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ function getResultCount(value: unknown): number {
2424
return Array.isArray(value) ? value.length : 0
2525
}
2626

27+
function getSubflowResultOutput(output: NormalizedBlockOutput): NormalizedBlockOutput {
28+
return { results: output.results ?? [] }
29+
}
30+
2731
export interface NodeExecutionResult {
2832
nodeId: string
2933
output: NormalizedBlockOutput
@@ -311,13 +315,18 @@ export class NodeExecutionOrchestrator {
311315
ctx,
312316
parentEntry.parentId,
313317
node.id,
314-
output,
318+
getSubflowResultOutput(output),
315319
parentEntry.branchIndex
316320
)
317321
return
318322
}
319323

320-
this.loopOrchestrator.storeLoopNodeOutput(ctx, parentEntry.parentId, subflowId, output)
324+
this.loopOrchestrator.storeLoopNodeOutput(
325+
ctx,
326+
parentEntry.parentId,
327+
subflowId,
328+
getSubflowResultOutput(output)
329+
)
321330
}
322331

323332
private handleRegularNodeCompletion(

apps/sim/executor/orchestrators/parallel.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import type { EdgeManager } from '@/executor/execution/edge-manager'
77
import type { ParallelScope } from '@/executor/execution/state'
88
import type { BlockStateWriter, ContextExtensions } from '@/executor/execution/types'
99
import type { ExecutionContext, NormalizedBlockOutput } from '@/executor/types'
10-
import type { ParallelConfigWithNodes } from '@/executor/types/parallel'
1110
import { type ClonedSubflowInfo, ParallelExpander } from '@/executor/utils/parallel-expansion'
1211
import {
1312
addSubflowErrorLog,
@@ -587,14 +586,4 @@ export class ParallelOrchestrator {
587586
getParallelScope(ctx: ExecutionContext, parallelId: string): ParallelScope | undefined {
588587
return ctx.parallelExecutions?.get(parallelId)
589588
}
590-
591-
findParallelIdForNode(baseNodeId: string): string | undefined {
592-
for (const [parallelId, config] of this.dag.parallelConfigs) {
593-
const parallelConfig = config as ParallelConfigWithNodes
594-
if (parallelConfig.nodes?.includes(baseNodeId)) {
595-
return parallelId
596-
}
597-
}
598-
return undefined
599-
}
600589
}

0 commit comments

Comments
 (0)