Uh oh!
There was an error while loading. Please reload this page.
feat(remote-feature-flag-controller): segment threshold flags by metaMetricsFlags with canonical ID default - #9325
Conversation
…y and support canonical id segmentation Threshold flags now expose selected values directly, track group names in featureFlagThresholdGroups, and can use getCanonicalId when idType is canonical. Co-authored-by: Cursor <cursoragent@cursor.com>
Uh oh!
There was an error while loading. Please reload this page.
…nd changelog links Default threshold segmentation to canonical ID, link changelog entries to PR #9325, add wallet changelog entry, and fix ESLint violations. Co-authored-by: Cursor <cursoragent@cursor.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Prioritize breaking logs on top Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
…g-controller.ts Use has property util instead Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Update changelog to state optional Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
davidmurdoch
left a comment
There was a problem hiding this comment.
I don't really understand why this change is needed, but have left a comment about the API anyway.
Uh oh!
There was an error while loading. Please reload this page.
…hub.com:MetaMask/core into feat/remote-feature-flag-threshold-groups-clean
…ure-flag-threshold-groups-clean
davidmurdoch
left a comment
There was a problem hiding this comment.
I don't understand the reason for this. but from a code and api standpoint, it looks good.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 09b141f. Configure here.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.

Summary
getCanonicalProfileIdconstructor callback andmetaMetricsFlagsmap for threshold flag segmentation.metaMetricsFlagsuse MetaMetrics ID instead.@metamask/walletremote feature flag controller initialization.Segmentation Behavior
metaMetricsFlagsgetCanonicalProfileId()metaMetricsFlagsgetMetaMetricsId()If the selected identifier is empty, threshold arrays are preserved as-is and not processed.
Example threshold config using canonical segmentation by default:
{ "myCanonicalFlag": [ { "name": "groupA", "scope": { "type": "threshold", "value": 0.5 }, "value": "valueA" }, { "name": "groupB", "scope": { "type": "threshold", "value": 1.0 }, "value": "valueB" } ] }Example controller setup for a flag that should keep MetaMetrics segmentation:
Migration
Consumers must pass
getCanonicalProfileIdfor threshold flags that should use canonical profile segmentation, which is now the default for flags absent frommetaMetricsFlags.Existing threshold flags that must keep MetaMetrics-based bucketing should be listed in
metaMetricsFlagsand continue to providegetMetaMetricsId.Test plan
yarn workspace @metamask/remote-feature-flag-controller run jest --no-coverage src/utils/user-segmentation-utils.test.ts src/remote-feature-flag-controller.test.tsmetaMetricsFlagsusegetCanonicalProfileIdfor segmentationmetaMetricsFlagsusegetMetaMetricsIdfor segmentationRelated
Note
Medium Risk
Breaking constructor and experiment-assignment change: existing threshold flags will re-bucket unless listed in
metaMetricsFlags. Not auth or payment logic, but it can change live A/B group membership.Overview
Breaking: threshold flags now bucket by canonical profile ID by default instead of MetaMetrics ID.
RemoteFeatureFlagControllerrequiresgetCanonicalProfileId; flags listed in optionalmetaMetricsFlagsstill usegetMetaMetricsId.Hash-based assignment hashes the chosen segmentation ID. If that ID is empty, the threshold array is left unprocessed. Explicit MetaMetrics ID targeting is unchanged. Threshold cache keys and stale-entry cleanup cover both identifiers.
@metamask/walletforwards the new options (optional; empty-string default for canonical ID). Consumers that need the old MetaMetrics bucketing must list those flag names inmetaMetricsFlags.Reviewed by Cursor Bugbot for commit 09b141f. Bugbot is set up for automated code reviews on this repo. Configure here.