Commit 6693243
authored
fix(cli): flag report is inconsistent with warnings (#967)
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.
---
By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache-2.0 license1 parent 33464fc commit 6693243
File tree
6 files changed
+117
-587
lines changed- packages/aws-cdk
- lib
- cli
- commands
- flags
- test/commands
6 files changed
+117
-587
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
58 | 57 | | |
59 | 58 | | |
60 | 59 | | |
| |||
68 | 67 | | |
69 | 68 | | |
70 | 69 | | |
| 70 | + | |
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| |||
2128 | 2128 | | |
2129 | 2129 | | |
2130 | 2130 | | |
2131 | | - | |
2132 | | - | |
2133 | | - | |
2134 | | - | |
2135 | | - | |
| 2131 | + | |
2136 | 2132 | | |
| 2133 | + | |
2137 | 2134 | | |
2138 | 2135 | | |
2139 | 2136 | | |
| |||
0 commit comments