feat(wallet): wire RemoteFeatureFlagController into default initialization - #8969
Merged
Merged
Conversation
sirtimid
added a commit
that referenced
this pull request
Jun 2, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid
marked this pull request as ready for review
June 2, 2026 12:01
sirtimid
added a commit
that referenced
this pull request
Jun 8, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid
force-pushed
the
sirtimid/wire-remote-feature-flag-controller
branch
from
June 8, 2026 12:03
c704d42 to
6e59aee
Compare
|
No dependency changes detected. Learn more about Socket for GitHub. 👍 No dependency changes detected in pull request |
sirtimid
added a commit
that referenced
this pull request
Jun 8, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid
force-pushed
the
sirtimid/wire-remote-feature-flag-controller
branch
from
June 8, 2026 12:04
6e59aee to
6ea8b4d
Compare
Member
Author
|
@metamaskbot publish-previews |
Member
Author
|
@SocketSecurity ignore npm/@metamask/remote-feature-flag-controller@4.2.2 |
sirtimid
added a commit
that referenced
this pull request
Jun 8, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid
force-pushed
the
sirtimid/wire-remote-feature-flag-controller
branch
from
June 8, 2026 12:18
6ea8b4d to
ae15713
Compare
sirtimid
added a commit
that referenced
this pull request
Jun 8, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid
force-pushed
the
sirtimid/wire-remote-feature-flag-controller
branch
from
June 8, 2026 13:05
ae15713 to
3989ae5
Compare
Member
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
This was referenced Jun 8, 2026
Closed
sirtimid
added a commit
to MetaMask/metamask-extension
that referenced
this pull request
Jun 8, 2026
…r [REVERT BEFORE MERGE] TEMPORARY, testing-only. Bumps the `@metamask/wallet` npm alias from the ApprovalController preview (`2.0.0-preview-ecd6b75`) to `2.0.0-preview-3989ae5`, which additionally wires `RemoteFeatureFlagController` (MetaMask/core#8969), so this draft PR can exercise CI against the real wiring before a `@metamask/wallet` release exists. Also adds the `@metamask/remote-feature-flag-controller` edge to the `@metamask/wallet` LavaMoat policy entries (the preview wallet now imports it). Revert this commit and bump `@metamask/wallet` to the published release once it includes #8969. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid
added a commit
to MetaMask/metamask-extension
that referenced
this pull request
Jun 8, 2026
…r [REVERT BEFORE MERGE] TEMPORARY, testing-only. Bumps the `@metamask/wallet` npm alias from the ApprovalController preview (`2.0.0-preview-ecd6b75`) to `2.0.0-preview-3989ae5`, which additionally wires `RemoteFeatureFlagController` (MetaMask/core#8969), so this draft PR can exercise CI against the real wiring before a `@metamask/wallet` release exists. Also adds the `@metamask/remote-feature-flag-controller` edge to the `@metamask/wallet` LavaMoat policy entries (the preview wallet now imports it). Revert this commit and bump `@metamask/wallet` to the published release once it includes #8969. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid
added a commit
to MetaMask/metamask-mobile
that referenced
this pull request
Jun 8, 2026
Construct RemoteFeatureFlagController through @metamask/wallet instead of mobile's local Engine controller-init wiring, mirroring the ApprovalController migration on the base branch and the KeyringController (#30368) and StorageService (#30922) precedents. This is the mobile counterpart to core PR MetaMask/core#8969. - Delete the local remote-feature-flag-controller init + messenger (and both tests). The remote-feature-flag-controller/ helper dir (getFeatureFlagApp* helpers + isRemoteFeatureFlagOverrideActivated) is kept and reused from the new wiring. - Drop RemoteFeatureFlagController from the controller-init registry (Engine.ts), the MESSENGER_FACTORIES map (messengers/index.ts), and the MessengerClientsToInitialize union (types.ts). It is kept in the MessengerClients type, the background state map, its Actions/Events unions, and the BACKGROUND_STATE_CHANGE_EVENT_NAMES Redux-bridge list (the wallet-owned controller emits stateChange on the same root bus). - Pass mobile's values through instanceOptions.remoteFeatureFlagController when constructing the Wallet (wallet-init/initialization.ts): clientConfigApiService (ClientType.Mobile + environment/distribution), getMetaMetricsId, clientVersion, prevClientVersion, fetchInterval, and the initial disabled value. - Preserve the client-side startup orchestration the wallet does NOT perform: the disabled/override logging and the startup updateRemoteFeatureFlags() fetch now run in the Engine constructor after the instance is resolved. - Resolve the instance via wallet.getInstance('RemoteFeatureFlagController') so RemoteFeatureFlagController:* consumers on the shared root messenger resolve the wallet-owned instance. - Add Engine integration tests for the preserved startup orchestration (disabled -> log + skip fetch; success -> "Feature flags updated"; failure -> "Feature flags update failed:"), restoring the coverage of the deleted remote-feature-flag-controller-init test. No functional changes. CHANGELOG entry: null Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid
added a commit
to MetaMask/metamask-mobile
that referenced
this pull request
Jun 8, 2026
Bumps the temporary npm-alias pin from the RFFC-free preview (ecd6b75) to the 4-controller preview (2.0.0-preview-3989ae5 = the core#8969 branch head), which wires RemoteFeatureFlagController into @metamask/wallet's default initialization. This is required for the RFFC migration in the previous commit to typecheck and to avoid a "RemoteFeatureFlagController:getState already registered" collision (the wallet now registers the controller mobile used to init locally). Kept as a direct npm alias in package.json (not the previewBuilds plugin) — the form that passes CI's immutable resolve. @metamask-previews/* is already preapproved in .yarnrc.yml, so the npm minimal-age gate does not block the fresh preview. `yarn install --immutable` exits 0 with no YN0028. Still TEMPORARY / DO NOT MERGE — revert this and pin the real @metamask/wallet release (the one including MetaMask/core#8969) before marking ready. CHANGELOG entry: null Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid
added a commit
to MetaMask/metamask-mobile
that referenced
this pull request
Jun 8, 2026
Construct RemoteFeatureFlagController through @metamask/wallet instead of mobile's local Engine controller-init wiring, mirroring the ApprovalController migration on the base branch and the KeyringController (#30368) and StorageService (#30922) precedents. This is the mobile counterpart to core PR MetaMask/core#8969. - Delete the local remote-feature-flag-controller init + messenger (and both tests). The remote-feature-flag-controller/ helper dir (getFeatureFlagApp* helpers + isRemoteFeatureFlagOverrideActivated) is kept and reused from the new wiring. - Drop RemoteFeatureFlagController from the controller-init registry (Engine.ts), the MESSENGER_FACTORIES map (messengers/index.ts), and the MessengerClientsToInitialize union (types.ts). It is kept in the MessengerClients type, the background state map, its Actions/Events unions, and the BACKGROUND_STATE_CHANGE_EVENT_NAMES Redux-bridge list (the wallet-owned controller emits stateChange on the same root bus). - Pass mobile's values through instanceOptions.remoteFeatureFlagController when constructing the Wallet (wallet-init/initialization.ts): clientConfigApiService (ClientType.Mobile + environment/distribution), getMetaMetricsId, clientVersion, prevClientVersion, fetchInterval, and the initial disabled value. - Preserve the client-side startup orchestration the wallet does NOT perform: the disabled/override logging and the startup updateRemoteFeatureFlags() fetch now run in the Engine constructor after the instance is resolved. - Resolve the instance via wallet.getInstance('RemoteFeatureFlagController') so RemoteFeatureFlagController:* consumers on the shared root messenger resolve the wallet-owned instance. - Add Engine integration tests covering all branches of the preserved startup orchestration (disabled and override -> log + skip fetch; success -> "Feature flags updated"; failure -> "Feature flags update failed:"), restoring (and extending) the coverage of the deleted remote-feature-flag-controller-init test. No functional changes. CHANGELOG entry: null Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid
added a commit
to MetaMask/metamask-mobile
that referenced
this pull request
Jun 8, 2026
Bumps the temporary npm-alias pin from the RFFC-free preview (ecd6b75) to the 4-controller preview (2.0.0-preview-3989ae5 = the core#8969 branch head), which wires RemoteFeatureFlagController into @metamask/wallet's default initialization. This is required for the RFFC migration in the previous commit to typecheck and to avoid a "RemoteFeatureFlagController:getState already registered" collision (the wallet now registers the controller mobile used to init locally). Kept as a direct npm alias in package.json (not the previewBuilds plugin) — the form that passes CI's immutable resolve. @metamask-previews/* is already preapproved in .yarnrc.yml, so the npm minimal-age gate does not block the fresh preview. `yarn install --immutable` exits 0 with no YN0028. Still TEMPORARY / DO NOT MERGE — revert this and pin the real @metamask/wallet release (the one including MetaMask/core#8969) before marking ready. CHANGELOG entry: null Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid
added a commit
that referenced
this pull request
Jun 9, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid
added a commit
that referenced
this pull request
Jun 9, 2026
…gController Address review feedback on #8969: - Require `instanceOptions.remoteFeatureFlagController.clientConfigApiService` instead of falling back to an inert default service. There is no platform-agnostic default (the service needs a client type, distribution, environment, and fetch), and silently returning no flags would mask a missing injection in production. The `remoteFeatureFlagController` slot is now required, matching the `storageService` precedent. - Mark the changelog entry as breaking. - Drop the verbose inline comments in the instance file. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid
force-pushed
the
sirtimid/wire-remote-feature-flag-controller
branch
from
June 9, 2026 10:56
3989ae5 to
005feb9
Compare
Member
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. Learn how to use preview builds in other projects. Expand for full list of packages and versions. |
sirtimid
added a commit
to MetaMask/metamask-extension
that referenced
this pull request
Jun 9, 2026
…r [REVERT BEFORE MERGE] TEMPORARY, testing-only. Bumps the `@metamask/wallet` npm alias from the ApprovalController preview (`2.0.0-preview-ecd6b75`) to `2.0.0-preview-3989ae5`, which additionally wires `RemoteFeatureFlagController` (MetaMask/core#8969), so this draft PR can exercise CI against the real wiring before a `@metamask/wallet` release exists. Also adds the `@metamask/remote-feature-flag-controller` edge to the `@metamask/wallet` LavaMoat policy entries (the preview wallet now imports it). Revert this commit and bump `@metamask/wallet` to the published release once it includes #8969. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid
added a commit
to MetaMask/metamask-extension
that referenced
this pull request
Jun 9, 2026
…r [REVERT BEFORE MERGE] TEMPORARY, testing-only. Bumps the `@metamask/wallet` npm alias from the ApprovalController preview (`2.0.0-preview-ecd6b75`) to `2.0.0-preview-e4acb70`, which additionally wires `RemoteFeatureFlagController` (MetaMask/core#8969), so this draft PR can exercise CI against the real wiring before a `@metamask/wallet` release exists. Also adds the `@metamask/remote-feature-flag-controller` edge to the `@metamask/wallet` LavaMoat policy entries (the preview wallet now imports it). Revert this commit and bump `@metamask/wallet` to the published release once it includes #8969. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid
added a commit
to MetaMask/metamask-mobile
that referenced
this pull request
Jun 9, 2026
Construct RemoteFeatureFlagController through @metamask/wallet instead of mobile's local Engine controller-init wiring, mirroring the ApprovalController migration on the base branch and the KeyringController (#30368) and StorageService (#30922) precedents. This is the mobile counterpart to core PR MetaMask/core#8969. - Delete the local remote-feature-flag-controller init + messenger (and both tests). The remote-feature-flag-controller/ helper dir (getFeatureFlagApp* helpers + isRemoteFeatureFlagOverrideActivated) is kept and reused from the new wiring. - Drop RemoteFeatureFlagController from the controller-init registry (Engine.ts), the MESSENGER_FACTORIES map (messengers/index.ts), and the MessengerClientsToInitialize union (types.ts). It is kept in the MessengerClients type, the background state map, its Actions/Events unions, and the BACKGROUND_STATE_CHANGE_EVENT_NAMES Redux-bridge list (the wallet-owned controller emits stateChange on the same root bus). - Pass mobile's values through instanceOptions.remoteFeatureFlagController when constructing the Wallet (wallet-init/initialization.ts): clientConfigApiService (ClientType.Mobile + environment/distribution), getMetaMetricsId, clientVersion, prevClientVersion, fetchInterval, and the initial disabled value. - Preserve the client-side startup orchestration the wallet does NOT perform: the disabled/override logging and the startup updateRemoteFeatureFlags() fetch now run in the Engine constructor after the instance is resolved. - Resolve the instance via wallet.getInstance('RemoteFeatureFlagController') so RemoteFeatureFlagController:* consumers on the shared root messenger resolve the wallet-owned instance. - Add Engine integration tests covering all branches of the preserved startup orchestration (disabled and override -> log + skip fetch; success -> "Feature flags updated"; failure -> "Feature flags update failed:"), restoring (and extending) the coverage of the deleted remote-feature-flag-controller-init test. No functional changes. CHANGELOG entry: null Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid
added a commit
to MetaMask/metamask-mobile
that referenced
this pull request
Jun 9, 2026
Pins @metamask/wallet to the temporary preview build 2.0.0-preview-e4acb70 (the head of MetaMask/core#8969, which wires RemoteFeatureFlagController into the wallet's default initialization). Direct npm alias in package.json; @metamask-previews/* is preapproved in .yarnrc.yml and `yarn install --immutable` passes. Still TEMPORARY / DO NOT MERGE — revert and pin the real @metamask/wallet release before marking ready. CHANGELOG entry: null Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
| - **BREAKING:** Wire `ApprovalController` into the default wallet initialization ([#8953](https://github.com/MetaMask/core/pull/8953)) | ||
| - The default `Wallet` now constructs an `ApprovalController` and registers its `ApprovalController:*` messenger actions. Consumers that pass their own `messenger` and already wire an `ApprovalController` must remove their own before upgrading, or the duplicate registration will collide. | ||
| - Adds an `approvalController` slot to `instanceOptions` with `showApprovalRequest` (the callback that surfaces pending approval requests to the user; defaults to a no-op) and `typesExcludedFromRateLimiting` (the approval types exempt from per-origin rate limiting; defaults to a baseline of EVM approval types). Both let consumers (extension, mobile, wallet-cli) inject their platform-specific values. | ||
| - **BREAKING:** Wire `RemoteFeatureFlagController` into the default wallet initialization ([#8969](https://github.com/MetaMask/core/pull/8969)) |
Member
There was a problem hiding this comment.
Since the above was merged this requires a rebase
FrederikBolding
previously approved these changes
Jun 10, 2026
…ization Adds `RemoteFeatureFlagController` to the wallet's default controller ensemble, exposing per-platform constructor values through a new `instanceOptions.remoteFeatureFlagController` slot: `clientConfigApiService`, `getMetaMetricsId`, `clientVersion`, `prevClientVersion`, `fetchInterval`, and `disabled`. Each is injectable with an inert/neutral default so the controller is usable headlessly; extension and mobile inject their own values. The controller's messenger is a plain namespaced child with no delegation. `prevClientVersion` lets consumers trigger feature-flag cache invalidation when the client version changes between sessions. Closes #8794 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…tureFlagController Migrates the RemoteFeatureFlagController instance to the per-controller directory convention (introduced by #8953, extended by #8977): `instances/remote-feature-flag-controller/` now holds the config, the colocated test, and a `RemoteFeatureFlagControllerInstanceOptions` type in its own `types.ts`. `InstanceSpecificOptions` references that type instead of an inline shape, and `instances/index.ts` + the CODEOWNERS `## Initialization` entry use the directory form. No public exports or option shapes change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…gController Address review feedback on #8969: - Require `instanceOptions.remoteFeatureFlagController.clientConfigApiService` instead of falling back to an inert default service. There is no platform-agnostic default (the service needs a client type, distribution, environment, and fetch), and silently returning no flags would mask a missing injection in production. The `remoteFeatureFlagController` slot is now required, matching the `storageService` precedent. - Mark the changelog entry as breaking. - Drop the verbose inline comments in the instance file. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…oller tests Remove inline comments that restated the test/code behavior without adding value, per review feedback. The per-controller `types.ts` JSDoc is kept, as it documents the public option contract (matching the approval-controller layout). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…e on #8924 Rebasing onto main (which released `@metamask/wallet@3.0.0` and added the `AccountsController`/`ConnectivityController` in #8924) left two artifacts that this commit resolves: - The `RemoteFeatureFlagController` changelog entry was carried into the now released `[3.0.0]` section alongside the `ApprovalController` entry it originally followed. Move it back under `[Unreleased]`, after the #8924 entry. - #8924 made `instanceOptions.connectivityController` required and added Wallet test cases that predate this branch. Pass the now-required `remoteFeatureFlagController` option to those cases, and the now-required `connectivityController` option to the RemoteFeatureFlagController test added by this branch. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
sirtimid
force-pushed
the
sirtimid/wire-remote-feature-flag-controller
branch
from
June 10, 2026 09:26
e4acb70 to
16f33fc
Compare
FrederikBolding
approved these changes
Jun 10, 2026
5 tasks
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.
Explanation
This wires
RemoteFeatureFlagControllerinto@metamask/wallet's default controller initialization, so the wallet manages remote feature flags as part of its ensemble. It exposes the controller's standard messenger surface —RemoteFeatureFlagController:getState/:stateChangeplus its method-actions (updateRemoteFeatureFlags,enable,disable,setFlagOverride,removeFlagOverride,clearAllFlagOverrides).@metamask/walletis the shared controller-integration layer formetamask-extension,metamask-mobile, andwallet-cli. The controller's constructor values that differ between those clients are therefore injectable via a newinstanceOptions.remoteFeatureFlagControllerslot rather than hardcoded.clientConfigApiServiceis required — it needs a client type, distribution, environment, andfetch, so there is no honest platform-agnostic default, and silently returning no flags would mask a missing injection in production. The remaining options default to neutral values. Values identical everywhere are not exposed.The controller's messenger is a plain namespaced child with no delegation — the controller's own messenger type only allows its own actions/events, and both clients already construct it that way. The per-client orchestration that reads
PreferencesController/OnboardingController(extension) or a basic-functionality selector (mobile) to enable/disable the controller is not part of the controller and is not delegated here: those sources aren't wallet controllers (mobile's isn't even a controller). Clients keep that orchestration in their own glue and drive it over the shared messenger via the exposedRemoteFeatureFlagController:enable/:disableactions; the wallet only takes the initialdisabledvalue and agetMetaMetricsIdcallback as injectable options.Changes verified on:
Per-environment options
clientConfigApiServicenew ClientConfigApiService({ fetch, config: { client: Extension, distribution, environment } })new ClientConfigApiService({ fetch, config: { client: Mobile, environment, distribution } })getMetaMetricsId() => MetaMetricsController:getMetaMetricsId() => analyticsId() => ''clientVersiongetBaseSemVerVersion()getBaseSemVerVersion()'0.0.0'prevClientVersionpersistedState.AppMetadataController.currentAppVersionpersistedState.AppMetadataController.currentAppVersionundefinedfetchInterval15 * 60 * 1000__DEV__ ? 1000 : DEFAULT_FETCH_INTERVALdisabled!completedOnboarding || !useExternalServices!selectBasicFunctionalityEnabled(state)false)The dynamic enable/disable toggling (subscribing to the sources above and calling
enable/disable) stays client-side; only the initialdisabledvalue is an option here.References
Current client construction sites (live
main):Closes #8794.
Checklist
🤖 Generated with Claude Code
Note
Medium Risk
Breaking API and messenger registration can break extension/mobile until they migrate; remote flags affect product behavior across clients but follow the established ApprovalController wiring pattern.
Overview
BREAKING:
@metamask/walletnow buildsRemoteFeatureFlagControllerduring default initialization and registersRemoteFeatureFlagController:*on the wallet messenger. Callers must supplyinstanceOptions.remoteFeatureFlagControllerwith a requiredclientConfigApiService; optional hooks cover metrics id, semver, cache invalidation on version change, fetch interval, and initialdisabled. Anyone who already registered this controller on a custom messenger must drop that wiring to avoid duplicate action registration.A new wallet initialization module mirrors other controllers (plain namespaced child messenger, option forwarding with sensible defaults). Wallet tests and dedicated init tests cover messenger state and injected options. The package adds
@metamask/remote-feature-flag-controller, tsconfig references, README dependency graph, CODEOWNERS for the init path, and an unreleased changelog entry.Reviewed by Cursor Bugbot for commit 16f33fc. Bugbot is set up for automated code reviews on this repo. Configure here.