Skip to content

Conversation

rix0rrr
Copy link
Contributor

@rix0rrr rix0rrr commented Apr 14, 2025

See CHANGELOG


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

rix0rrr added 2 commits April 14, 2025 16:11
… applications (#34132)

Some CDK methods apply mutating Aspects on behalf of users. Since #32333, these Aspects have a priority of `MUTATING` to classify their behavior.

If a user-applied Aspect (priority `DEFAULT`) now configures the same property as an implicitly added Aspect:

* Before that change, the relative execution order depended on the location of the Aspects in the construct tree.
* After that change, the user Aspect always "wins" (executes last) because its priority is higher.

In this change, we roll back to the behavior from pre-2.172.0, and introduce a feature flag which gives the Aspects a priority only if the feature flag is enabled. This introduces the feature flag:

```json
{
  "context": {
    "@aws-cdk/core:aspectPrioritiesMutating": true
  }
}
```

Which sets the priority of Aspects added on your behalf a priority of `MUTATING` (200) (instead of the default `DEFAULT`, 500).

* If you have given your own Aspect a priority of `MUTATING` already to make sure it can get overridden by another Aspect  of priority `MUTATING`, this current change will not affect you (either with or without feature flag).
* If you have come to rely on the new default priority being low already, you can set the above feature flag to re-enable the new behavior.

-----------

Did not touch the following Aspects:

- In `integ-tests-alpha`: overriding logical IDs in assertions stacks does not affect production infrastructure.
- Tags: tags are exclusively manipulated through the official APIs, so there no conflict between custom and implicit Aspects.
- CDK Pipelines: there cannot be a conflict because the customer can't create a default pipeline before the implicit Aspect.

This PR also introduces some slight rendering and documentation changes to the feature flags to improve clarity of the purpose of certain fields and the produced report.
@rix0rrr rix0rrr added pr/no-squash This PR should be merged instead of squash-merging it pr-linter/analytics-metadata-change labels Apr 14, 2025
@rix0rrr rix0rrr requested a review from a team as a code owner April 14, 2025 14:14
@aws-cdk-automation aws-cdk-automation requested a review from a team April 14, 2025 14:14
@github-actions github-actions bot added the p2 label Apr 14, 2025
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Apr 14, 2025
@@ -50,7 +51,9 @@ export class ApplicationAssociator extends Construct {
this.associateCrossAccountStacks = targetBindResult.associateCrossAccountStacks;
cdk.Aspects.of(scope).add(new CheckedStageStackAssociator(this, {
associateCrossAccountStacks: this.associateCrossAccountStacks,
}), { priority: cdk.AspectPriority.MUTATING });
}), {
priority: cdk.FeatureFlags.of(this).isEnabled(cxapi.ASPECT_PRIORITIES_MUTATING) ? cdk.AspectPriority.MUTATING : undefined,
Copy link
Contributor

Choose a reason for hiding this comment

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

Ha, this doesn't use the mutatingAspectPrio32333 function.

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: e7432ee
  • 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 14, 2025

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

@mergify mergify bot merged commit 824634e into v2-release Apr 14, 2025
33 checks passed
@mergify mergify bot deleted the patch/v2.189.1 branch April 14, 2025 14:44
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 14, 2025
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/no-squash This PR should be merged instead of squash-merging it pr-linter/analytics-metadata-change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants