-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(stepfunctions): prefixes not appended to states in parallel branches #17806
Conversation
packages/@aws-cdk/aws-stepfunctions/test/state-machine-fragment.test.ts
Outdated
Show resolved
Hide resolved
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
Thank you for contributing! Your pull request will be updated from master and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
…hes (aws#17806) There is an order mismatch issue when calling `Parallel.branch()`. `branch` used to immediately create the state graph of the branch which locks in the `stateIds` of the branch states. This fails to take into account the following scenario: ```ts class ParallelMachineFragment extends stepfunctions.StateMachineFragment { public readonly startState: stepfunctions.State; public readonly endStates: stepfunctions.INextable[]; constructor(scope: Construct, id: string) { super(scope, id); const step1 = new stepfunctions.Pass(this, 'Step 1'); const parallelState = new stepfunctions.Parallel(this, 'Parallel State'); const chain = parallelState.branch(step1); this.startState = parallelState; this.endStates = [chain]; } } class MyStack extends Stack { constructor(scope: Construct, id: string) { const fragment1 = new ParallelMachineFragment(this, 'Fragment 1').prefixStates(); const fragment2 = new ParallelMachineFragment(this, 'Fragment 2').prefixStates(); new stepfunctions.StateMachine(stack, 'State Machine', { definition: fragment1.next(fragment2), }); } } ``` Here, the branches in the `parallelState` do not get prefixes before they are evaluated, causing an error since they have the same `stateId`. The fix is to make the state graph creation late-bound; it now happens when we call `Parallel.bindToGraph()`. At this point, it will know of any prefixes. Fixes aws#17354. ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
There is an order mismatch issue when calling
Parallel.branch()
.branch
used to immediately create the state graph of the branch which locks in thestateIds
of the branch states. This fails to take into account the following scenario:Here, the branches in the
parallelState
do not get prefixes before they are evaluated, causing an error since they have the samestateId
.The fix is to make the state graph creation late-bound; it now happens when we call
Parallel.bindToGraph()
. At this point, it will know of any prefixes.Fixes #17354.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license