Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
rfc 328 - polyglot assert #330
rfc 328 - polyglot assert #330
Changes from 4 commits
9351350
f192c8b
2a3c9e0
f1ac1f7
8512f87
85cd9fd
0aa8145
4ebf3bb
93d65ac
6e872df
955e945
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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
assert
everywhere seems a little redundant? Especially if we rename theinspect
variableassert
. How about:(And same for
assert.hasResourceBeta1
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.
Adding the
assert
prefix makes it clear that these methods will throw if the conditions are not met.I've left space, for the future, to add a
matchTemplate()
that returns true/false. Maybe premature(?).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.
Again, no need to add _BETA1 everywhere. It's sufficient that the top level type has that prefix...
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.
Let's say I wanted to change the behaviour of this enum value. With your suggestion I would need to create a new enum
ResourcePartBeta2
and then create new methods withBeta2
(or whatever) suffix everywhere this enum is used.More pragmatic to keep the suffix, no?
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 am not sure I can think of a reason you'd want to change the value of the enum member. It's normally not even needed to specify a value.
We should be consistent about these suffixes. If the entire type is "Beta", I don't see any value in actually polluting all the members with that suffix.
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.
To @nija-at point, if we only use
betaX
on the containing type (e.g class), what do we do when we want to deprecate an internal member? For example, assume theautoScalingGroup
class is in preview phase, and we only want to change the behavior offormAutScalingGroupName
method, do we need to deprecate the entireautoScalingGroup
class for that?My gut feeling is that it will be less ideal from a user experience perspective.
there are a lot of nuance here, I think we need to flush out the preview specification so we can be consistent across the code base.
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 would just deprecate
AutoScalingGroupBeta
, and introduceAutoScalingGroupBeta2
with this new method, while proxying all the deprecated methods from the deprecated type to the new type.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.
How will this work for users consuming
fromAutoScalingGroupName
? If you proxy it, you will be introducing a breaking change for users ofAutoScalingGroupBeta
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. Of course this specific method will not be proxied as-is in order to preserve the legacy behavior in the deprecated class.
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.
Agree with Elad here. Having to call
fromAutoScalingGroupName()
AutoScalingGroupBeta1.fromAutoScalingGroupNameBeta1()
on the off-chance we will want to deprecate it seems like the wrong tradeoff to me.Also, let's assume for a second we do go down this route, and call it
AutoScalingGroupBeta1.fromAutoScalingGroupNameBeta1()
. What do we call the replacement method then?AutoScalingGroupBeta1.fromAutoScalingGroupNameBeta2()
? That looks pretty bad...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 we are over indexing on how things look. Our main objective is to make sure it is clear that an API is in preview. The second objective is to make is easy for users to use preview APIs, will introducing a whole new class will make it harder for users to upgrade? It can be, as the class usage is more prevalent than a single method in a user application (more references to the
AutoScalingGroup
class in the code base than tofromAutoScalingGroupName
).I think we need to make this decision in a dedicated PR, try out a few use cases and flush out the details using code samples.
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 logic doesn't convince me.
Why can't this be a separate module that depends on
aws-cdk-lib
?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.
How would you satisfy the requirement I've identified (in the above section) if this is a separate module?
Do you disagree with that requirement?
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.
We can ship a separate experimental assert library from a module in the monorepo, re-writing it as needed at build time.
Same way as we re-write the stable modules today to package them as part of monocdk, and the same way as we plan to ship the existing experimental modules like
@aws-cdk/aws-appmesh
(which has version1.107.0
) as new modules@aws-cdk-lib-experiments/aws-appmesh
(with version0.1.0
).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'll point you again towards the requirements section and quote it here, because your reply seems to ignore it -
If we ship this as an experimental module, I believe we cannot take declare a dependency on it from any of our stable modules.
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.
Pretty sure we can, because it will be a
devDependency
.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.
Because it bloats the
aws-cdk-lib
module with test code, and forces you to use the uglyBeta1
names.I honestly don't see the problem here. We will have a module in the monorepo,
@aws-cdk/assertions
or something, which the single (v1) modules will depend on. This takes care of dogfooding. Then we re-package the module to be released with whatever name we want,@aws-cdk-lib/assertions
or something else, in version0.x.y
. It willpeerDepend
onaws-cdk-lib
.This is exactly the process we want to have for other experimental modules.
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.
Ok. Thanks for the feedback.
I'll take that into consideration before my final decision.
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.
@skinny85 I am not sure I understand your arguments against including this is the standard library (besides module size, which is not a very strong argument given this is likely to add a few KiBs).
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.
It also allows us to skip the ugly
Beta1
suffixes.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.
That's a fair argument.
If we can release this library as an experimental module without adding any further complexity, we can do so.
However, after graduating to stable, the module will be included in
aws-cdk-lib
(just like any other experimental module).