Skip to content

feat(stepfunctions): add support for custom WriterConfig fields for ResultWriter in Distributed Map (#33772) and (#33601) #33831

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

Merged

Conversation

vishalsatam
Copy link
Contributor

@vishalsatam vishalsatam commented Mar 19, 2025

feat(stepfunctions): Create a new ResultWriterV2 class to support WriterConfig in ResultWriter object in Distributed Map

Closes #33772 and #33601.

Reason for making this change:
A new property WriterConfig was added under ResultWriter property of Distributed Map.
WriterConfig contains OutputType and Transformation

Ref: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-resultwriter.html#input-output-resultwriter-field-contents

ItemReader also supports "JSONL" as the InputType. It's currently missing in the enum.
Ref: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-itemreader.html#itemreader-field-contents

Changes:

  • Created a copy of ResultWriter as ResultWriterV2 to avoid introducing a breaking change to ResultWriter.
  • Consumers will need to set feature@aws-cdk/aws-stepfunctions:useDistributedMapResultWriterV2 to true in the context.
  • Create new class WriterConfig and add writerConfig property under ResultWriterV2 in Distributed Map.
  • Add OutputType and Transformation properties under WriterConfig.
  • Add Warning when ResultWriter is empty.
  • Add the missing JSONL type which is a part of InputType ItemReader of Distributed Map.
  • Permissions - No additions. But removed the permission to put object when just writerConfig is specified.
  • Also added the missing JSONL from InputType in the ItemReader of Distributed Map.
  • Add a unit test and an integ test.

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 effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2 labels Mar 19, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team March 19, 2025 16:41
@github-actions github-actions bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Mar 19, 2025
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.

(This review is outdated)

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.

(This review is outdated)

@vishalsatam
Copy link
Contributor Author

aws-cdk-automation says add a README , but I don't think this needs one.

@aws-cdk-automation aws-cdk-automation dismissed their stale review March 26, 2025 20:56

Dismissing outdated PRLinter review.

@vishalsatam vishalsatam force-pushed the feature-dmap-result-writer-with-writer-config branch from bedf8c8 to 8197a0a Compare March 26, 2025 21:03
@aws-cdk-automation aws-cdk-automation dismissed their stale review March 26, 2025 23:45

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

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.

(This review is outdated)

@vishalsatam
Copy link
Contributor Author

vishalsatam commented Mar 26, 2025

Exemption Request

Need to add this to allowed-breaking-changes.txt.

# bucket property will become optional after StepFunctions introduced writerConfig.
# Either writerConfig or the bucket and prefix needs to be specified
changed-type:aws-cdk-lib.aws_stepfunctions.ResultWriter.bucket

Example: below is perfectly valid now

      resultWriter: new sfn.ResultWriter({
        writerConfig: {
          outputType: sfn.OutputType.JSONL,
          transformation: sfn.Transformation.COMPACT,
        },
      }),

@aws-cdk-automation aws-cdk-automation added the pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. label Mar 26, 2025
@vishalsatam vishalsatam force-pushed the feature-dmap-result-writer-with-writer-config branch from df4b617 to 1caa53d Compare March 26, 2025 23:55
@shikha372 shikha372 self-assigned this Apr 3, 2025
@SimonCMoore SimonCMoore added p1 and removed p2 labels Apr 3, 2025
Copy link
Contributor

@shikha372 shikha372 left a comment

Choose a reason for hiding this comment

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

Hi @vishalsatam , Thank you contributing this pull request, we don't accept any breaking changes to the stable library module, please see below how changing a prop type from required to optional can break customers

https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md#breaking-changes

what's recommended in such cases is we add a new type with v2 and mark the existing one as deprecated.

@shikha372 shikha372 added pr-linter/no-exemption The requested exemption will not be granted to the PR linter result and removed pr-linter/exemption-requested The contributor has requested an exemption to the PR Linter feedback. labels Apr 7, 2025
@github-actions github-actions bot added p2 and removed p1 labels Apr 8, 2025
@aws-cdk-automation aws-cdk-automation dismissed their stale review April 8, 2025 21:57

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

@vishalsatam vishalsatam force-pushed the feature-dmap-result-writer-with-writer-config branch from cfaaa3c to 3324f5f Compare April 9, 2025 19:14
@vishalsatam vishalsatam force-pushed the feature-dmap-result-writer-with-writer-config branch from da0d82e to 5901805 Compare April 11, 2025 03:58
…terConfig in ResultWriter object in Distributed Map

Closes #33772 and #33601.

Reason for making this change:
A new property `WriterConfig` was added under ResultWriter property of Distributed Map.
`WriterConfig` contains OutputType and Transformation

Ref: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-resultwriter.html#input-output-resultwriter-field-contents

`ItemReader` also supports "JSONL" as the `InputType`. It's currently missing in the enum.
Ref: https://docs.aws.amazon.com/step-functions/latest/dg/input-output-itemreader.html#itemreader-field-contents

Changes:
* Created a copy of ResultWriter as ResultWriterV2 to avoid introducing a breaking change to ResultWriter.
* Consumers will need to set feature`@aws-cdk/aws-stepfunctions:useDistributedMapResultWriterV2` to true in the context.
* Create new class `WriterConfig` and add `writerConfig` property under `ResultWriterV2` in Distributed Map.
* Add `OutputType` and `Transformation` properties under `WriterConfig`.
* Add Warning when ResultWriter is empty.
* Add the missing `JSONL` type which is a part of `InputType` `ItemReader` of Distributed Map.
* Permissions - No additions. But removed the permission to put object when just `writerConfig` is specified.
* Also added the missing `JSONL` from `InputType` in the `ItemReader` of Distributed Map.
* Add a unit test and an integ test.

- [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md)

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@vishalsatam vishalsatam force-pushed the feature-dmap-result-writer-with-writer-config branch from 5901805 to 2efc8af Compare April 11, 2025 16:45
shikha372
shikha372 previously approved these changes Apr 11, 2025
@vishalsatam
Copy link
Contributor Author

vishalsatam commented Apr 11, 2025

@shikha372 , Thank you for your patience with this pull request. Really appreciate the review and the comments..

@mergify mergify bot dismissed shikha372’s stale review April 11, 2025 18:45

Pull request has been modified.

@shikha372 shikha372 removed the pr-linter/no-exemption The requested exemption will not be granted to the PR linter result label Apr 14, 2025
@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Apr 14, 2025
@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 14, 2025
shikha372
shikha372 previously approved these changes Apr 14, 2025
Copy link
Contributor

mergify bot commented Apr 14, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

Copy link
Contributor

mergify bot commented Apr 14, 2025

This pull request has been removed from the queue for the following reason: pull request branch update failed.

The pull request can't be updated.

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, you can requeue the pull request, without updating it, by posting a @mergifyio requeue comment.

@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Apr 14, 2025
Copy link
Contributor

mergify bot commented Apr 14, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@shikha372
Copy link
Contributor

@Mergifyio update

Copy link
Contributor

mergify bot commented Apr 15, 2025

update

❌ Mergify doesn't have permission to update

For security reasons, Mergify can't update this pull request. Try updating locally.
GitHub response: refusing to allow a GitHub App to create or update workflow .github/workflows/enum-auto-updater.yml without workflows permission

@mergify mergify bot dismissed shikha372’s stale review April 15, 2025 05:43

Pull request has been modified.

@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 15, 2025
@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

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

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

Copy link
Contributor

mergify bot commented Apr 15, 2025

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

@mergify mergify bot merged commit 78af355 into aws:main Apr 15, 2025
15 of 16 checks passed
Copy link
Contributor

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 15, 2025
@aws-cdk-automation aws-cdk-automation removed the pr/needs-community-review This PR needs a review from a Trusted Community Member or Core Team Member. label Apr 15, 2025
@vishalsatam vishalsatam deleted the feature-dmap-result-writer-with-writer-config branch April 21, 2025 16:55
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(aws-stepfunctions): Add support for new fields WriterConfig in the ResultWriter for DistributedMap
6 participants