Skip to content
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): distributed maps under branches do not have necessary permissions #29913

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

curquhart
Copy link
Contributor

@curquhart curquhart commented Apr 20, 2024

Issue

Closes #29266

Reason for this change

distributed maps under branch states (i.e., Parallel) do not apply the necessary permissions to run the state.

Description of changes

this moves the bind functionality into state and calls it on both state and all child (branch) states. Previously it did not run on branch states and as such did not work for example a distributed map under a parallel state without adding the permissions out of band.

An alternative would be to have a bind method that the user calls out of band on the distributed map (or in my case, in a wrapper class, but it's clunky)

Description of how you validated changes

Unit tests

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@github-actions github-actions bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK p2 labels Apr 20, 2024
@aws-cdk-automation aws-cdk-automation requested a review from a team April 20, 2024 17:33
Copy link
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.

A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed add Clarification Request to a comment.

@curquhart
Copy link
Contributor Author

ahh re pull request validator failing for no integration test update, i will look at that later this weekend of sometime next week.

@aws-cdk-automation aws-cdk-automation dismissed their stale review April 21, 2024 15:12

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

@curquhart
Copy link
Contributor Author

added a couple integration tests and fixed the linting problems

@curquhart curquhart force-pushed the fix_distributed_map_perms branch 2 times, most recently from 1a2ed6f to 38c98b2 Compare April 21, 2024 15:35
@curquhart
Copy link
Contributor Author

curquhart commented Apr 21, 2024

i was wondering about my approach... because branches aren't exposed, i moved the policy stuff into State. however, State cannot depend on DistributedMap because of a cyclic dependency. To deal with this, I just passed isDistributedMap into the method call. This is based on the assumption that branches is hidden for a reason.

This works but could be cleaner. I was wondering about thoughts on a few alternative solutions:

  • could i expose branches in State? then this stuff could be entirely (other than that visibility change in State) be in StateGraph
  • add containsDistributedMap to State (as in, StateGraph would call state.containsDistributedState())... in the base class, this would return false, in DistributedMap this would return true
  • processorMode is already in State... it's protected but if we made it public we might be also use that to determine if distributed map (by swapping with a getter, throwing the real value in _processorMode, and then having the getter traverse any children)... i do worry about side effects on this one though since we'd be considering processorMode as distributed if any of the children are distributed

from my point of view, anything is fine, i just want to remove the manual perms from my cdk since it's weird that cdk sometimes but not always adds them (depending on how the graph is shaped) heh

anyway will update if needed!

@aws-cdk-automation aws-cdk-automation added the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Apr 21, 2024
@curquhart
Copy link
Contributor Author

👋 just wanted to touch base on this... I'm happy to make changes if yall don't like the approach!

thanks :)

@github-actions github-actions bot added bug This issue is a bug. effort/medium Medium work item – several days of effort p1 and removed p2 labels May 5, 2024
@curquhart
Copy link
Contributor Author

just saw there is also an issue reported for this - linked it in desc... just following up again though, is someone able to look at this? Thanks :)

@aws-cdk-automation aws-cdk-automation added pr/needs-maintainer-review This PR needs a review from a Core Team Member and removed pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. labels May 5, 2024
distributed maps under branch states (i.e., Parallel) do not apply the
necessary permissions to run the state.

this moves the bind functionality into state and calls it on both state
and all child states.

rather than relying on the single purpose that it is now (add
distributed map perms) and fast returning all the way out, this instead
just checks if the policy it is trying to add is in place before
proceeding and uses that condition to return immediately.
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: a820573
  • Result: SUCCEEDED
  • Build Logs (available for 30 days)

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/medium Medium work item – several days of effort p1 pr/needs-maintainer-review This PR needs a review from a Core Team Member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

stepfunctions: DistributedMap in Parallel doesn't create DistributedMapPolicy
2 participants