feat(remote-feature-flag-controller): return threshold values directly and track threshold groups#9289
Open
asalsys wants to merge 4 commits into
Open
feat(remote-feature-flag-controller): return threshold values directly and track threshold groups#9289asalsys wants to merge 4 commits into
asalsys wants to merge 4 commits into
Conversation
…y and track threshold groups
Threshold feature flags now expose the selected value directly instead of a
{name, value} wrapper. When thresholdName is present on the selected group,
store the mapping in featureFlagThresholdGroups on controller state.
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…9289 Co-authored-by: Cursor <cursoragent@cursor.com>
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
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.
Summary
valuedirectly fromremoteFeatureFlagsinstead of a{ name, value }wrapper object.featureFlagThresholdGroupsstate field (Record<string, string>) that maps feature flag names to their selected threshold group name when the selected threshold entry includesthresholdName.normalizeThresholdValueand the legacy{ name, value }wrapper fallback for unversioned threshold entries.Motivation
Separating the processed flag value from threshold group metadata makes it easier for consumers to use threshold flags as plain values (booleans, objects, etc.) without unwrapping. The new
featureFlagThresholdGroupsfield provides explicit access to A/B group assignment when configs opt in viathresholdName.Migration
Consumers that previously read threshold group names from
remoteFeatureFlags[flagName].nameshould instead:remoteFeatureFlags[flagName].featureFlagThresholdGroups[flagName]when available (only populated when the remote config providesthresholdNameon the selected threshold entry).Before:
After:
Test plan
yarn workspace @metamask/remote-feature-flag-controller run jest --no-coverage remote-feature-flag-controller.test.ts— all 53 tests passthresholdNamereturn the value directly and leavefeatureFlagThresholdGroupsemptythresholdNamereturn the value directly and populatefeatureFlagThresholdGroupsfeatureFlagThresholdGroupsentries are cleaned up when flags are removed from the server responseMade with Cursor