Skip to content

fix(mixins-preview): apply mixins in order - #36847

Merged
mergify[bot] merged 3 commits into
mainfrom
mrgrain/fix/mixins-preview/apply-mixins-in-order
Feb 3, 2026
Merged

mergify[bot] merged 3 commits into
mainfrom
mrgrain/fix/mixins-preview/apply-mixins-in-order

Conversation

@mrgrain

@mrgrain mrgrain commented Feb 3, 2026 •

Copy link
Copy Markdown
Collaborator

Issue # (if applicable)

Related RFC: aws/aws-cdk-rfcs#824

Reason for this change

Aligns the implementation with the latest version of the Mixins RFC.

The .with() method previously iterated over constructs first, then mixins. This meant that mixins were not guaranteed to be applied in the order they were passed to the method. Additionally, if a mixin added new constructs to the tree, subsequent mixins in the same call could unexpectedly visit those newly added constructs.

Description of changes

Changed the loop order so that mixins are applied in order. The list of constructs is now captured at the start of the call, ensuring that constructs added by a mixin will not be visited by subsequent mixins. Users who need subsequent mixins to apply to added constructs can use multiple .with() calls.

Also improved variable naming for clarity (c → construct, m → mixin).

Describe any new or updated permissions being added

N/A

Description of how you validated changes

Existing tests pass. This behavior is explicitly tested in aws/constructs#2843.

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 the p2 label Feb 3, 2026
@aws-cdk-automation
aws-cdk-automation requested a review from a team February 3, 2026 12:48
@mergify mergify Bot added the contribution/core This is a PR that came from AWS. label Feb 3, 2026

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

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

(This review is outdated)

@mrgrain mrgrain added pr-linter/exempt-test The PR linter will not require test changes pr-linter/exempt-integ-test The PR linter will not require integ test changes labels Feb 3, 2026
@aws-cdk-automation
aws-cdk-automation dismissed their stale review February 3, 2026 13:22

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

@mergify

mergify Bot commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

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 726060c into main Feb 3, 2026
32 of 33 checks passed
@mergify
mergify Bot deleted the mrgrain/fix/mixins-preview/apply-mixins-in-order branch February 3, 2026 14:01
@mergify

mergify Bot commented Feb 3, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

✅ The pull request has been merged at 6ac17b7

This pull request spent 10 seconds in the queue, with no time running CI.
The checks were run in-place.

Required conditions to merge

@github-actions

github-actions Bot commented Feb 3, 2026

Copy link
Copy Markdown
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 Feb 3, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

contribution/core This is a PR that came from AWS. p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes pr-linter/exempt-test The PR linter will not require test changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants