Skip to content

feat(core): introducing CDK Mixins#37055

Merged
mergify[bot] merged 1 commit intomainfrom
mrgrain/feat/core/move-mixins-to-ga
Feb 27, 2026
Merged

feat(core): introducing CDK Mixins#37055
mergify[bot] merged 1 commit intomainfrom
mrgrain/feat/core/move-mixins-to-ga

Conversation

@mrgrain
Copy link
Contributor

@mrgrain mrgrain commented Feb 23, 2026

Reason for this change

Mixins enable composable, reusable functionality that attaches to constructs without inheritance. A mixin author implements supports() and applyTo(), and consumers apply mixins to any scope using Mixins.of(scope).apply(myMixin). Construct selectors narrow the target set by resource type, path pattern, or ID glob. This composability is the key differentiator from Aspects: where Aspects visit every node in the tree, Mixins give authors fine-grained control over which constructs receive which behavior.

Description of changes

The core Mixins types (Mixins, Mixin, IMixin, MixinApplicator, ConstructSelector, and related interfaces) now live in @aws-cdk-lib/core/lib. The MIXIN_SYMBOL identifier changes from the preview value to @aws-cdk/core.Mixin, which deliberately breaks cross-version compatibility checks so that preview mixins and GA mixins remain distinct.

The @aws-cdk/mixins-preview package re-exports these types from aws-cdk-lib/core instead of bundling its own copies. Existing code that imports from @aws-cdk/mixins-preview continues to work without changes. The preview package keeps its additional features like built-in mixins and EventBridge event patterns.

A new "Mixins" section in the aws-cdk-lib README documents the Mixins.of() entry point, custom mixin creation, construct selection, and error handling with requireAny() / requireAll(). It sits right before the existing "Aspects" section because the two features are conceptually related.

Analytics metadata tracks mixin usage via aws:cdk:analytics:mixin node metadata. The FQN of first-party mixins (those with allowed package prefixes) is recorded; third-party or unidentified mixins are redacted to *.

Describe any new or updated permissions being added

N/A

Description of how you validated changes

aws-cdk-lib compiles cleanly with tsc --noEmit. Unit tests cover the Mixin base class, MixinApplicator (including requireAny/requireAll semantics and ordering guarantees), ConstructSelector variants, and metadata recording with FQN redaction.

Checklist


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

@mrgrain mrgrain requested a review from a team as a code owner February 23, 2026 11:24
@github-actions github-actions bot added the p2 label Feb 23, 2026
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Feb 23, 2026
@mrgrain mrgrain changed the title feat(core): move Mixins mechanism to aws-cdk-lib for GA feat(core): GA Mixins mechanism in aws-cdk-lib Feb 23, 2026
@mrgrain mrgrain changed the title feat(core): GA Mixins mechanism in aws-cdk-lib feat(core): introducing CDK Mixins Feb 23, 2026
@mrgrain mrgrain force-pushed the mrgrain/feat/core/move-mixins-to-ga branch 2 times, most recently from 3933a40 to ff408b2 Compare February 25, 2026 18:30
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)

@aws-cdk-automation aws-cdk-automation added the pr/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. label Feb 25, 2026
@mrgrain mrgrain force-pushed the mrgrain/feat/core/move-mixins-to-ga branch 2 times, most recently from 8ceca5a to e7cb42f Compare February 25, 2026 18:43
@mrgrain mrgrain added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Feb 25, 2026
@aws-cdk-automation aws-cdk-automation dismissed their stale review February 25, 2026 21:04

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

@mrgrain mrgrain force-pushed the mrgrain/feat/core/move-mixins-to-ga branch from e7cb42f to a627b6d Compare February 26, 2026 10:13
@mrgrain mrgrain force-pushed the mrgrain/feat/core/move-mixins-to-ga branch 3 times, most recently from cbe0be6 to 2b6e158 Compare February 26, 2026 13:37
@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Feb 26, 2026
@mrgrain mrgrain added the pr/do-not-merge This PR should not be merged at this time. label Feb 26, 2026
@mrgrain mrgrain force-pushed the mrgrain/feat/core/move-mixins-to-ga branch 2 times, most recently from 34e7cba to 04315cb Compare February 27, 2026 09:32
@mrgrain mrgrain added the priority-pr push the PR to priority squash queue label Feb 27, 2026
@aws-cdk-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Feb 27, 2026
@mrgrain mrgrain force-pushed the mrgrain/feat/core/move-mixins-to-ga branch from 04315cb to d76de56 Compare February 27, 2026 10:44
Move the core Mixins mechanism (Mixins, Mixin, IMixin, MixinApplicator,
ConstructSelector) from @aws-cdk/mixins-preview to aws-cdk-lib/core.
@mrgrain mrgrain force-pushed the mrgrain/feat/core/move-mixins-to-ga branch from d76de56 to d8b76c6 Compare February 27, 2026 11:11
@mrgrain mrgrain removed the pr/do-not-merge This PR should not be merged at this time. label Feb 27, 2026
@mergify
Copy link
Contributor

mergify bot commented Feb 27, 2026

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 cda96cb into main Feb 27, 2026
22 of 23 checks passed
@mergify
Copy link
Contributor

mergify bot commented Feb 27, 2026

Merge Queue Status

Rule: priority-squash


  • Entered queue2026-02-27 11:41 UTC
  • Checks passed · in-place
  • Merged2026-02-27 11:41 UTC · at d8b76c68adf73974ba9643cbb1215d6060cddd7e

This pull request spent 5 seconds in the queue, with no time running CI.

Required conditions to merge
  • #approved-reviews-by >= 1 [🛡 GitHub branch protection]
  • #changes-requested-reviews-by = 0 [🛡 GitHub branch protection]
  • any of [🛡 GitHub branch protection]:
    • check-success = validate-pr
    • check-neutral = validate-pr
    • check-skipped = validate-pr
  • any of [🛡 GitHub branch protection]:
    • check-success = build
    • check-neutral = build
    • check-skipped = build

@mergify mergify bot deleted the mrgrain/feat/core/move-mixins-to-ga branch February 27, 2026 11:41
@github-actions
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 Feb 27, 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/needs-further-review PR requires additional review from our team specialists due to the scope or complexity of changes. pr-linter/exempt-integ-test The PR linter will not require integ test changes priority-pr push the PR to priority squash queue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants