feat(flow): add subflow() DSL node for nested flow composition#405
Merged
feat(flow): add subflow() DSL node for nested flow composition#405
Conversation
Add a first-class 'subflow' node kind to the flow DSL that delegates execution to a child FlowDefinition. This eliminates the need to manually instantiate FlowRunner inside a step's run() function. - FlowSubflowNode type with flow, contextMap, and runnerOptions - subflow() DSL builder function - Runner executeNode handler with abort signal propagation - Opaque child scope (child step IDs don't collide with parent) - Supports static FlowDefinition or lazy thunk resolution - 8 integration tests + 3 DSL unit tests - Updated flow-dsl.md documentation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #405 +/- ##
==========================================
+ Coverage 91.12% 91.25% +0.12%
==========================================
Files 212 213 +1
Lines 22250 22531 +281
Branches 3502 3528 +26
==========================================
+ Hits 20275 20560 +285
+ Misses 1928 1923 -5
- Partials 47 48 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a first-class
subflow()DSL node to@cadre-dev/framework/flowthat allows composing a childFlowDefinitionas a single node in a parent flow. This eliminates the need to manually instantiateFlowRunnerinside a step'srun()function.Usage
Changes
FlowSubflowNodeinterface withflow,contextMap, and optionalrunnerOptions; added toFlowNodeunionsubflow()builder functioncase 'subflow'handler that delegates to a childFlowRunner, propagates abort signals, returns{ flowId, status, outputs }; updatedindexNodes,validateDependsOnRefs(subflow nodes are opaque)indexFlow— subflow nodes are opaque to parent contract validationsubflowandFlowSubflowNodeDesign Decisions
{ flowId, status, outputs }. No ID collisions.contextMap: Explicit bridge from parent to child context — no implicit sharing.flowacceptsFlowDefinition | (ctx) => FlowDefinitionfor lazy/dynamic resolution.Tests
subflow.test.tsdsl.test.ts