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(core): wrong priority for tag aspects #33460

Merged
merged 11 commits into from
Feb 25, 2025

Conversation

hwwi
Copy link
Contributor

@hwwi hwwi commented Feb 15, 2025

❗Important❗

This change is to fix behavior that was always wrong, starting in this commit released in CDK v2.172.0. In doing so, the order of your aspect execution may change. If you are inadvertently depending on an aspect ordering that was previously wrong (tagging was previously not prioritized as a mutating aspect), you could need to change your CDK code. We are not treating this as a breaking change because the previous order was always wrong.

Reason for this change

Priority was not applied in #32333

Description of changes

Fix missing priority

Checklist


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

@hwwi hwwi requested a review from a team as a code owner February 15, 2025 07:59
@aws-cdk-automation aws-cdk-automation requested a review from a team February 15, 2025 07:59
@github-actions github-actions bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK p2 labels Feb 15, 2025
@kaizencc kaizencc changed the title chore(aspects): fix missing default priorities fix(core): tag aspect missing default priority Feb 18, 2025
@kaizencc kaizencc added the pr-linter/exempt-integ-test The PR linter will not require integ test changes label Feb 18, 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
Contributor

@kaizencc kaizencc left a comment

Choose a reason for hiding this comment

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

Hi @hwwi thanks for this PR! good catch. we need a unit test to merge this PR, though. are you willing to add a unit test to get this across the finish line?

@aws-cdk-automation aws-cdk-automation dismissed their stale review February 20, 2025 07:37

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

@hwwi
Copy link
Contributor Author

hwwi commented Feb 20, 2025

Hi @kaizencc, sorry, i missed that. I added a unit test.

@mergify mergify bot dismissed kaizencc’s stale review February 20, 2025 08:39

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 Feb 20, 2025
@kaizencc kaizencc changed the title fix(core): tag aspect missing default priority fix(core): wrong priority for tag aspects Feb 24, 2025
Copy link
Contributor

@dsilbergleithcu-godaddy dsilbergleithcu-godaddy left a comment

Choose a reason for hiding this comment

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

Just my thoughts because @kaizencc sent me the PR and I read it. Figured I'd throw in my $0.02. Please feel free to ignore.

Comment on lines +229 to +232
// THEN - check that Tags Aspect is applied to stack with mutating priority
let aspectApplications = Aspects.of(stack).applied;
expect(aspectApplications.length).toEqual(2);
expect(aspectApplications[1].priority).toEqual(AspectPriority.DEFAULT);
expect(aspectApplications[1].priority).toEqual(AspectPriority.MUTATING);
Copy link
Contributor

Choose a reason for hiding this comment

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

Interesting. It looks like the test was written to the code instead of the code to the test. Otherwise the test would have called out the priority as mutating, and the code with the typeo would have failed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I get the general your suggestion, but I’d like to understand it more clearly. Could you share a code snippet to illustrate your point?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think in this case it was an error on the original authors part to simply get the tests to pass, and so its ok to change it here.

@dsilbergleithcu-godaddy do you have any suggestions for how to make sure this kind of human error doesn't happen in the future? otherwise i'm just kind of chalking it up to an oversight.

Copy link
Contributor

@kaizencc kaizencc left a comment

Choose a reason for hiding this comment

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

Thanks @hwwi. I'm approving and this PR should be included in CDK v2.181.0. We've decided against adding a notice since it's unlikely that many users are affected and such a notice will be more confusing than helpful. Instead I've documented the PR description to alert anyone who stumbles upon this PR that there is a small chance that changing your CDK code is necessary, if you are depending on the previously wrong order of aspect execution.

@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 Feb 25, 2025
Copy link
Contributor

mergify bot commented Feb 25, 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).

@aws-cdk-automation
Copy link
Collaborator

AWS CodeBuild CI Report

  • CodeBuild project: AutoBuildv2Project1C6BFA3F-wQm2hXv2jqQv
  • Commit ID: 67bbbbc
  • 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 Feb 25, 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 0b9ffeb into aws:main Feb 25, 2025
14 checks passed
Copy link

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 25, 2025
@hwwi hwwi deleted the hwwi/aspects/fix-missing-default-priority branch February 26, 2025 02:18
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 p2 pr-linter/exempt-integ-test The PR linter will not require integ test changes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants