-
Notifications
You must be signed in to change notification settings - Fork 4k
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
chore: add enum-like updater #33500
chore: add enum-like updater #33500
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.
(This review is outdated)
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #33500 +/- ##
=======================================
Coverage 82.16% 82.16%
=======================================
Files 119 119
Lines 6857 6857
Branches 1157 1157
=======================================
Hits 5634 5634
Misses 1120 1120
Partials 103 103
Flags with carried forward coverage won't be shown. Click here to find out more.
|
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 general comments:
- Add some unit tests for the new class methods
- Where's the generated content? I don't see it in this PR. Is that expected?
- You might want to add to pr-linter to exempt changes to allow you to modify the module enums file
@@ -515,20 +516,28 @@ export class EnumsUpdater extends MetadataUpdater { | |||
|
|||
// Add to the blueprint | |||
enumBlueprint[enumName] = enumValues; | |||
moduleEnumBlueprint[sourceFile.getFilePath().split("aws-cdk/packages/")[1].replace(".ts", "") + "." + enumName] = enumValues; |
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.
Not exactly sure the format of JSON you want, but IMO, would it be more readable to split out the enum name and the module name so that we have something like
{
'aws-cdk-lib.aws-ec2.Instance': {
'EnumName': [ <values> ],
}
}
instead of
{
'aws-cdk-lib.aws-ec2.Instance'.EnumName: [ <values> ],
}
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.
Good callout, I had some discussion with Paul on this as well, JSON might be the better way to go with these moving forward. Will update with the better format
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.
Either way works, but the actual tool script will parse and format it by module anyways so it doesn't strictly have to be organized in that way here.
tools/@aws-cdk/construct-metadata-updater/lib/metadata-updater.ts
Outdated
Show resolved
Hide resolved
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 review is outdated)
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 review is outdated)
Dismissing outdated PRLinter review.
|
✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.
packages/aws-cdk-lib/core/lib/analytics-data-source/enums/module-enums.json
Outdated
Show resolved
Hide resolved
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.
Did a deep dive on the enum removals, it seems like they are all due to the recent CLI split, and they took their enums with them
@@ -224,10 +224,6 @@ export const AWS_CDK_ENUMS: { [key: string]: any } = { | |||
'objectLike', | |||
'arrayWith' | |||
], | |||
'AssetBuildTime': [ |
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.
Removed in commit 8b87a63
under these folders:
packages/@aws-cdk/toolkit/lib/actions/deploy/index.ts
packages/aws-cdk/lib/cli/cdk-toolkit.ts
@@ -896,12 +867,6 @@ export const AWS_CDK_ENUMS: { [key: string]: any } = { | |||
'CONTINUE', | |||
'ABANDON' | |||
], | |||
'DefaultSelection': [ |
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.
Removed in commit 8b87a63
under this folder:
packages/aws-cdk/lib/api/cxapp/cloud-assembly.ts
@@ -927,14 +892,6 @@ export const AWS_CDK_ENUMS: { [key: string]: any } = { | |||
'CODE_DEPLOY', | |||
'EXTERNAL' | |||
], | |||
'DeploymentState': [ |
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.
Removed in commit 8b87a63
under this folder:
packages/aws-cdk/lib/util/work-graph-types.ts
@@ -1177,11 +1133,6 @@ export const AWS_CDK_ENUMS: { [key: string]: any } = { | |||
'SUPERSEDED', | |||
'PARALLEL' | |||
], | |||
'ExtendedStackSelection': [ |
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.
Removed in commit 8b87a63
under these folders:
packages/@aws-cdk/toolkit/lib/api/cloud-assembly/stack-selector.ts
packages/aws-cdk/lib/api/cxapp/cloud-assembly.ts
@@ -2907,12 +2837,6 @@ export const AWS_CDK_ENUMS: { [key: string]: any } = { | |||
'StartsWith', | |||
'NotEqual' | |||
], | |||
'RollbackChoice': [ |
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.
Removed in commit 8b87a63
under this folder:
packages/aws-cdk/lib/api/util/cloudformation/stack-status.ts
@@ -2989,11 +2913,6 @@ export const AWS_CDK_ENUMS: { [key: string]: any } = { | |||
'AddToLoadBalancer', | |||
'InstanceRefresh' | |||
], | |||
'ScanStatus': [ |
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.
Removed in commit 8b87a63
under this folder:
packages/aws-cdk/lib/commands/migrate.ts
@@ -3138,14 +3057,6 @@ export const AWS_CDK_ENUMS: { [key: string]: any } = { | |||
'bar', | |||
'events' | |||
], | |||
'StackSelectionStrategy': [ |
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.
Removed in commit 8b87a63
under this folder:
packages/@aws-cdk/toolkit/lib/api/cloud-assembly/stack-selector.ts
@@ -3406,11 +3317,6 @@ export const AWS_CDK_ENUMS: { [key: string]: any } = { | |||
'TcpRetryEvent': [ | |||
'connection-error' | |||
], | |||
'TemplateSourceOptions': [ |
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.
Removed in commit 8b87a63
under this folder:
packages/aws-cdk/lib/commands/migrate.ts
@@ -1067,7 +1024,6 @@ export const AWS_CDK_ENUMS: { [key: string]: any } = { | |||
'ECS_AL2_NVIDIA' | |||
], | |||
'Effect': [ | |||
'Unknown', |
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.
I think what was happening here was the enum was pulling the values from:
packages/@aws-cdk/cloudformation-diff/lib/iam/statement.ts
But without it, it's now pulling from:
packages/aws-cdk-lib/aws-iam/lib/policy-statement.ts
Which has the same values minus the 'Unknown'
being removed here.
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 may be because of the issue where the old script was not separating enums by module and overwriting when it found one with the same name. @GavinZZ can you confirm if you pushed the fix for this or if it's still the old code causing this?
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.
I don't plan to fix this in enums.ts
. I intend to keep the overriden behaviour in the enums.ts
file. I believe Leo fixed this in his new generated file.
tools/@aws-cdk/construct-metadata-updater/lib/metadata-updater.ts
Outdated
Show resolved
Hide resolved
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.
Do you plan to update the PR-linter in this PR?
I can update it here, yes |
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 CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
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). |
Comments on closed issues and PRs are hard for our team to see. |
Issue # (if applicable)
N/A
Reason for this change
Adds metadata collector for CDK's enum-like classes.
Description of changes
EnumLikeUpdater
to parse out the enum-like classes and write them to a separate file to be used and updated.EnumUpdater
to also write to another file, including the module name to prevent ambiguity when updating.Describe any new or updated permissions being added
N/A
Description of how you validated changes
N/A
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license