You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(aws-cdk): use recommended value for a single unconfigured flag - #2050
When exactly one feature flag is unconfigured, modifyValues takes the manual single-flag branch even though --value was not provided. It interprets undefined as false, so cdk.json receives false after the preview displayed the recommended value true.
Description of changes
Use the manual single-flag branch only when params.value is defined. This keeps the write behavior aligned with buildUpdateObject and preserves explicit single-flag values. Add a regression test for one unconfigured flag whose recommended value is true.
No dependency or IAM permission changes are included.
Validation
Red/green regression: before the fix, the preview showed true while cdk.json received false; after the fix, the test passes.
This PR fixes a one-line logic bug in the experimental cdk flags command: when exactly one unconfigured boolean feature flag remained, cdk flags --set --unconfigured --recommended previewed the correct recommended value but wrote the wrong one to cdk.json. The fix adds params.value !== undefined to the single-flag guard in FlagOperations.modifyValues, so the manual --value branch only applies when a value was explicitly supplied; the --unconfigured single-flag case now falls through to the branch that writes flag.recommendedValue, matching the preview logic in the sibling buildUpdateObject. A targeted regression test reproduces the original scenario and asserts the correct persisted value. The change is minimal, well-scoped, and confirmed against the source. No issues found on this change.
🔴 0 blocking · 🟡 0 recommended · ⚪ 0 optional
Generated automatically. React 👍 or 👎 to tell us whether this review helped, so we can improve these reviews.
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
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.
Fixes #2048
Reason for this change
When exactly one feature flag is unconfigured,
modifyValuestakes the manual single-flag branch even though--valuewas not provided. It interpretsundefinedasfalse, socdk.jsonreceivesfalseafter the preview displayed the recommended valuetrue.Description of changes
Use the manual single-flag branch only when
params.valueis defined. This keeps the write behavior aligned withbuildUpdateObjectand preserves explicit single-flag values. Add a regression test for one unconfigured flag whose recommended value istrue.No dependency or IAM permission changes are included.
Validation
truewhilecdk.jsonreceivedfalse; after the fix, the test passes.corepack yarn@4.17.1 jest --config jest.config.json --runInBand test/commands/flag-operations.test.ts --coverage=false— 59 tests passed.corepack yarn@4.17.1 nx run aws-cdk:compile— passed foraws-cdkand its 9 compile dependencies.git diff --checkand strict UTF-8 validation passed.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license