Skip to content

Commit 17315f9

Browse files
committed
chore(flags): feature flag report contains feature info for all library versions
This change goes together with aws/aws-cdk-cli#782, to undo some decisions made in https://github.com/aws/aws-cdk/pull/35108/files and aws/aws-cdk-cli#742. We used to store `unconfiguredBehavesLike` values for both `v1` and `v2` (and `v3`, `v4`, etc) into the feature flag report, but we only needed to store the value for the *current* library version. We are now defining the "v2" field to hold the current version information, and are updating the feature flag generation code to not emit `v1` data, and stay correct if we ever start releasing `v3`.
1 parent 88f3e04 commit 17315f9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/aws-cdk-lib/core/lib/private/feature-flag-report.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,15 @@ function parseFeatureFlagInfo(flagName: string, info: FlagInfo, root: IConstruct
1414
userValue: userValue,
1515
recommendedValue: info.recommendedValue,
1616
explanation: info.summary,
17-
unconfiguredBehavesLike: info.unconfiguredBehavesLike,
17+
18+
// This is a historical accident. We used to copy all `unconfiguredBehavesLike` data
19+
// into the feature flag report, but we only needed to copy the behavior of the current library version.
20+
// In order to not break existing reports, we keep the same structure, but we baptize the 'v2' field as
21+
// the canonical name of the "current version" field, even for v3, v4, etc.
22+
// It looks weird, but it's safe & backwards compatible.
23+
unconfiguredBehavesLike: info.unconfiguredBehavesLike?.[feats.CURRENT_MV] ? {
24+
v2: info.unconfiguredBehavesLike?.[feats.CURRENT_MV],
25+
} : undefined,
1826
};
1927

2028
return parsedFlag;

0 commit comments

Comments
 (0)