generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 62
fix(cli): flag report is inconsistent with warnings #967
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The default flag report (showing the unconfigured flags) was basing its entries on a different filter than the message that says "N flags are unconfigured". This is confusing. Currently, init-ing a project and then upgrading to the latest library shows: ``` 2 feature flags are not configured. Run 'cdk flags --unstable=flags' to learn more. ``` But then running that commands shows 15 flags: ``` $ cdk flags --unstable=flags ┌─────────────────────────────────────────────────────────────────────────────────────┬─────────────┬─────────┬───────────┐ │ Feature Flag Name │ Recommended │ User │ Effective │ ├─────────────────────────────────────────────────────────────────────────────────────┼─────────────┼─────────┼───────────┤ │ Module: aws-cdk-lib │ │ │ │ │ @aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId │ true │ <unset> │ true │ │ @aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021 │ true │ <unset> │ true │ │ @aws-cdk/aws-ec2-alpha:useResourceIdForVpcV2Migration │ false │ <unset> │ false │ │ @aws-cdk/aws-ecs-patterns:uniqueTargetGroupId │ true │ <unset> │ false │ │ @aws-cdk/aws-elasticloadbalancingv2:networkLoadBalancerWithSecurityGroupByDefault │ true │ <unset> │ false │ │ @aws-cdk/aws-lambda:recognizeVersionProps │ true │ <unset> │ true │ │ @aws-cdk/aws-rds:lowercaseDbIdentifier │ true │ <unset> │ true │ │ @aws-cdk/aws-stepfunctions-tasks:httpInvokeDynamicJsonPathEndpoint │ true │ <unset> │ true │ ...etc... ``` The reason is those 2 bits of code used different filtering. Specifically, the warning excluded flags for which the default value is equal to the recommended value (i.e., flags that don't need to be configured at all because the default value is good enough), while the table was looking strictly for "unconfigured" flags. The `default == recommended` pattern crops up in a couple of situations: - Security-related fixes that we want to force on people, but want to give them a flag to back out of the changes if they really need to. - Flags that changed their default value in the most recent major version. - Flags that we've introduced at some point in the past, but have gone back on. In this PR, make both bits of code use the same logic so discrepancies like these can't happen anymore. Also add a header to the table so it's clear what you're currently looking at. Also in this PR: remove a dead `flags.ts` code, that had been fully refactored to other files but had accidentally been left in.
mrgrain
approved these changes
Nov 28, 2025
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #967 +/- ##
==========================================
+ Coverage 84.37% 85.95% +1.57%
==========================================
Files 72 71 -1
Lines 10467 10001 -466
Branches 1347 1269 -78
==========================================
- Hits 8832 8596 -236
+ Misses 1594 1385 -209
+ Partials 41 20 -21
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The default flag report (showing the unconfigured flags) was basing its entries on a different filter than the message that says "N flags are unconfigured". This is confusing.
Currently, init-ing a project and then upgrading to the latest library shows:
But then running that commands shows 15 flags:
The reason is those 2 bits of code used different filtering. Specifically, the warning excluded flags for which the default value is equal to the recommended value (i.e., flags that don't need to be configured at all because the default value is good enough), while the table was looking strictly for "unconfigured" flags.
The
default == recommendedpattern crops up in a couple of situations:In this PR, make both bits of code use the same logic so discrepancies like these can't happen anymore. Also add a header to the table so it's clear what you're currently looking at.
Also in this PR: remove a dead
flags.tscode, that had been fully refactored to other files but had accidentally been left in.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license