-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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(aws-cdk-lib): allow create explicitly empty trees on aws-cdk-lib core #29217
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The pull request linter has failed. See the aws-cdk-automation comment below for failure reasons. If you believe this pull request should receive an exemption, please comment and provide a justification.
A comment requesting an exemption should contain the text Exemption Request
. Additionally, if clarification is needed add Clarification Request
to a comment.
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
+1 request for this change |
+1 |
1 similar comment
+1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments, also you may need to rerun the integ tests locally with --update-on-failed
and push any changes as the snapshots in the PR may not reflect your latest changes which might explain why it's failing.
@@ -654,7 +664,6 @@ function deepMerge(target: any, ...sources: any[]) { | |||
if (key === '__proto__' || key === 'constructor') { | |||
continue; | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add back the linebreak here
// Availabe wafv2 empty objects | ||
// https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-webacl-ruleaction.html |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// Availabe wafv2 empty objects | |
// https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-webacl-ruleaction.html | |
/** | |
* Availabe WAFv2 empty objects | |
* | |
* @see https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-wafv2-webacl-ruleaction.html | |
*/ |
@@ -640,6 +640,16 @@ const MERGE_EXCLUDE_KEYS: string[] = [ | |||
'Fn::Or', | |||
]; | |||
|
|||
// Availabe wafv2 empty objects |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This description is vague and doesn't explain what these are used for, nor how "empty objects" relates to DELETE_MERGE_EXCLUDE_KEYS
. Maybe provide a short snippet of context, you can reference the description for MERGE_EXCLUDE_KEYS
on line 617
@@ -541,6 +541,44 @@ describe('resource', () => { | |||
}); | |||
}); | |||
|
|||
test('addOverride(p, {object: {object: {}}}) will respect empty trees', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer different wording like support
over respect
here
@@ -725,7 +734,20 @@ function deepMerge(target: any, ...sources: any[]) { | |||
// sibling concrete values alongside, so we can delete this tree. | |||
const output = target[key]; | |||
if (typeof(output) === 'object' && Object.keys(output).length === 0) { | |||
delete target[key]; | |||
/* | |||
* some empty trees are needed in some edge cases |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
* some empty trees are needed in some edge cases | |
* Some empty trees are needed in some edge cases |
* some empty trees are needed in some edge cases | ||
* ie: wafv2 Rules (for Action, OverrideAction, etc...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please clarify which some empty trees
and maybe combine the ie
into the some edge cases
like ... are needed when WAFv2 rule action is one of 'Action', 'Block', 'Captcha', 'Challenge' or 'Count'.
@Rondineli I have some concerns about this change breaking existing customers even behind a feature flag. Please have a look at the comments on the original issue. |
This PR has been in the BUILD FAILING state for 3 weeks, and looks abandoned. To keep this PR from being closed, please continue work on it. If not, it will automatically be closed in a week. |
Sorry, but I really dont get the backwards compatibility bit? As I am explicitly setting the keys to it ignore. And trust me, I tried the way it is right now and cloudformation broke because those missing keys on waf rules, so, my guess is if someone tried to use it, it did not work. I would be happy to change the PR for another approach, but this is definitely something broken and wont cause regression, quite the opposite. |
This PR has been deemed to be abandoned, and will be automatically closed. Please create a new PR for these changes if you think this decision has been made in error. |
Issue # (if applicable)
Closes #29165.
Reason for this change
Using
addOverride
callsdeepMerge
, and few edge cases like wafv2 rules needs Actions and other keys with objects and empty objects.Description of changes
Changing the code to be more realistic with the comment, where only null data is deleted
Description of how you validated changes
No tests, just making sure the current change would be compatible with current tests, should not break anything
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license