Skip to content

feat(wallet): wire RemoteFeatureFlagController into default initialization - #8969

Merged
sirtimid merged 6 commits into
mainfrom
sirtimid/wire-remote-feature-flag-controller
Jun 10, 2026
Merged

feat(wallet): wire RemoteFeatureFlagController into default initialization#8969
sirtimid merged 6 commits into
mainfrom
sirtimid/wire-remote-feature-flag-controller

Conversation

@sirtimid

@sirtimid sirtimid commented Jun 2, 2026

Copy link
Copy Markdown
Member

Explanation

This wires RemoteFeatureFlagController into @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/:stateChange plus its method-actions (updateRemoteFeatureFlags, enable, disable, setFlagOverride, removeFlagOverride, clearAllFlagOverrides).

@metamask/wallet is the shared controller-integration layer for metamask-extension, metamask-mobile, and wallet-cli. The controller's constructor values that differ between those clients are therefore injectable via a new instanceOptions.remoteFeatureFlagController slot rather than hardcoded. clientConfigApiService is required — it needs a client type, distribution, environment, and fetch, 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.

BREAKING: the default Wallet now constructs a RemoteFeatureFlagController and registers its RemoteFeatureFlagController:* actions, and the new remoteFeatureFlagController slot (with required clientConfigApiService) is now a required member of instanceOptions. Consumers that pass their own messenger and already wire a RemoteFeatureFlagController must remove their own before upgrading, or the duplicate registration will collide.

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 exposed RemoteFeatureFlagController:enable/:disable actions; the wallet only takes the initial disabled value and a getMetaMetricsId callback as injectable options.

Changes verified on:

Per-environment options

Option Extension Mobile Default (e.g. wallet-cli)
clientConfigApiService new ClientConfigApiService({ fetch, config: { client: Extension, distribution, environment } }) new ClientConfigApiService({ fetch, config: { client: Mobile, environment, distribution } }) Required — no default
getMetaMetricsId () => MetaMetricsController:getMetaMetricsId () => analyticsId () => ''
clientVersion getBaseSemVerVersion() getBaseSemVerVersion() '0.0.0'
prevClientVersion persistedState.AppMetadataController.currentAppVersion persistedState.AppMetadataController.currentAppVersion undefined
fetchInterval 15 * 60 * 1000 __DEV__ ? 1000 : DEFAULT_FETCH_INTERVAL controller default (1 day)
disabled !completedOnboarding || !useExternalServices !selectBasicFunctionalityEnabled(state) controller default (false)

The dynamic enable/disable toggling (subscribing to the sources above and calling enable/disable) stays client-side; only the initial disabled value 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/wallet now builds RemoteFeatureFlagController during default initialization and registers RemoteFeatureFlagController:* on the wallet messenger. Callers must supply instanceOptions.remoteFeatureFlagController with a required clientConfigApiService; optional hooks cover metrics id, semver, cache invalidation on version change, fetch interval, and initial disabled. 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.

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
sirtimid marked this pull request as ready for review June 2, 2026 12:01
@sirtimid
sirtimid requested a review from a team as a code owner June 2, 2026 12:01
@sirtimid
sirtimid temporarily deployed to default-branch June 2, 2026 12:01 — with GitHub Actions Inactive
@sirtimid
sirtimid requested review from a team and FrederikBolding June 2, 2026 15:14
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
sirtimid force-pushed the sirtimid/wire-remote-feature-flag-controller branch from c704d42 to 6e59aee Compare June 8, 2026 12:03
@socket-security

socket-security Bot commented Jun 8, 2026

Copy link
Copy Markdown

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
sirtimid force-pushed the sirtimid/wire-remote-feature-flag-controller branch from 6e59aee to 6ea8b4d Compare June 8, 2026 12:04
@sirtimid

sirtimid commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

@metamaskbot publish-previews

@sirtimid

sirtimid commented Jun 8, 2026

Copy link
Copy Markdown
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
sirtimid force-pushed the sirtimid/wire-remote-feature-flag-controller branch from 6ea8b4d to ae15713 Compare June 8, 2026 12:18
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
sirtimid force-pushed the sirtimid/wire-remote-feature-flag-controller branch from ae15713 to 3989ae5 Compare June 8, 2026 13:05
@sirtimid

sirtimid commented Jun 8, 2026

Copy link
Copy Markdown
Member Author

@metamaskbot publish-preview

@github-actions

github-actions Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Preview builds have been published. Learn how to use preview builds in other projects.

Expand for full list of packages and versions.
@metamask-previews/account-tree-controller@7.5.1-preview-3989ae5
@metamask-previews/accounts-controller@39.0.0-preview-3989ae5
@metamask-previews/address-book-controller@7.1.2-preview-3989ae5
@metamask-previews/ai-controllers@0.7.0-preview-3989ae5
@metamask-previews/analytics-controller@1.1.1-preview-3989ae5
@metamask-previews/analytics-data-regulation-controller@0.0.0-preview-3989ae5
@metamask-previews/announcement-controller@8.1.0-preview-3989ae5
@metamask-previews/app-metadata-controller@2.0.1-preview-3989ae5
@metamask-previews/approval-controller@9.0.1-preview-3989ae5
@metamask-previews/assets-controller@8.3.2-preview-3989ae5
@metamask-previews/assets-controllers@108.5.0-preview-3989ae5
@metamask-previews/authenticated-user-storage@2.0.0-preview-3989ae5
@metamask-previews/base-controller@9.1.0-preview-3989ae5
@metamask-previews/base-data-service@0.1.3-preview-3989ae5
@metamask-previews/bridge-controller@73.2.1-preview-3989ae5
@metamask-previews/bridge-status-controller@72.0.2-preview-3989ae5
@metamask-previews/build-utils@3.0.4-preview-3989ae5
@metamask-previews/chain-agnostic-permission@1.6.1-preview-3989ae5
@metamask-previews/chomp-api-service@3.1.0-preview-3989ae5
@metamask-previews/claims-controller@0.5.2-preview-3989ae5
@metamask-previews/client-controller@1.0.1-preview-3989ae5
@metamask-previews/compliance-controller@2.1.0-preview-3989ae5
@metamask-previews/composable-controller@12.0.1-preview-3989ae5
@metamask-previews/config-registry-controller@0.4.0-preview-3989ae5
@metamask-previews/connectivity-controller@0.2.0-preview-3989ae5
@metamask-previews/controller-utils@12.1.0-preview-3989ae5
@metamask-previews/core-backend@6.3.2-preview-3989ae5
@metamask-previews/delegation-controller@3.0.1-preview-3989ae5
@metamask-previews/earn-controller@12.2.0-preview-3989ae5
@metamask-previews/eip-5792-middleware@3.0.4-preview-3989ae5
@metamask-previews/eip-7702-internal-rpc-middleware@0.1.1-preview-3989ae5
@metamask-previews/eip1193-permission-middleware@2.0.1-preview-3989ae5
@metamask-previews/ens-controller@19.1.3-preview-3989ae5
@metamask-previews/eth-block-tracker@15.0.1-preview-3989ae5
@metamask-previews/eth-json-rpc-middleware@23.1.3-preview-3989ae5
@metamask-previews/eth-json-rpc-provider@6.0.1-preview-3989ae5
@metamask-previews/foundryup@1.0.1-preview-3989ae5
@metamask-previews/gas-fee-controller@26.2.2-preview-3989ae5
@metamask-previews/gator-permissions-controller@4.2.0-preview-3989ae5
@metamask-previews/geolocation-controller@0.1.3-preview-3989ae5
@metamask-previews/json-rpc-engine@10.5.0-preview-3989ae5
@metamask-previews/json-rpc-middleware-stream@8.0.8-preview-3989ae5
@metamask-previews/keyring-controller@26.0.0-preview-3989ae5
@metamask-previews/logging-controller@8.0.2-preview-3989ae5
@metamask-previews/message-manager@14.1.2-preview-3989ae5
@metamask-previews/messenger@1.2.0-preview-3989ae5
@metamask-previews/messenger-cli@0.2.0-preview-3989ae5
@metamask-previews/money-account-balance-service@1.0.2-preview-3989ae5
@metamask-previews/money-account-controller@0.3.2-preview-3989ae5
@metamask-previews/money-account-upgrade-controller@2.0.3-preview-3989ae5
@metamask-previews/multichain-account-service@10.0.2-preview-3989ae5
@metamask-previews/multichain-api-middleware@3.1.3-preview-3989ae5
@metamask-previews/multichain-network-controller@3.1.3-preview-3989ae5
@metamask-previews/multichain-transactions-controller@7.1.1-preview-3989ae5
@metamask-previews/name-controller@9.1.2-preview-3989ae5
@metamask-previews/network-controller@32.0.0-preview-3989ae5
@metamask-previews/network-enablement-controller@5.3.0-preview-3989ae5
@metamask-previews/notification-services-controller@24.1.2-preview-3989ae5
@metamask-previews/passkey-controller@2.0.1-preview-3989ae5
@metamask-previews/permission-controller@13.1.1-preview-3989ae5
@metamask-previews/permission-log-controller@5.1.0-preview-3989ae5
@metamask-previews/perps-controller@7.0.0-preview-3989ae5
@metamask-previews/phishing-controller@17.2.0-preview-3989ae5
@metamask-previews/polling-controller@16.0.6-preview-3989ae5
@metamask-previews/preferences-controller@23.1.0-preview-3989ae5
@metamask-previews/profile-metrics-controller@3.1.6-preview-3989ae5
@metamask-previews/profile-sync-controller@28.1.1-preview-3989ae5
@metamask-previews/ramps-controller@14.1.1-preview-3989ae5
@metamask-previews/rate-limit-controller@7.0.1-preview-3989ae5
@metamask-previews/react-data-query@0.2.1-preview-3989ae5
@metamask-previews/remote-feature-flag-controller@4.2.2-preview-3989ae5
@metamask-previews/sample-controllers@5.0.1-preview-3989ae5
@metamask-previews/seedless-onboarding-controller@10.0.0-preview-3989ae5
@metamask-previews/selected-network-controller@26.1.3-preview-3989ae5
@metamask-previews/shield-controller@5.1.2-preview-3989ae5
@metamask-previews/signature-controller@39.2.4-preview-3989ae5
@metamask-previews/snap-account-service@0.3.0-preview-3989ae5
@metamask-previews/social-controllers@2.2.1-preview-3989ae5
@metamask-previews/storage-service@1.0.1-preview-3989ae5
@metamask-previews/subscription-controller@6.1.3-preview-3989ae5
@metamask-previews/transaction-controller@67.0.0-preview-3989ae5
@metamask-previews/transaction-pay-controller@23.2.0-preview-3989ae5
@metamask-previews/user-operation-controller@41.2.3-preview-3989ae5
@metamask-previews/wallet@2.0.0-preview-3989ae5

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
sirtimid removed request for a team June 8, 2026 20:13
Comment thread packages/wallet/src/Wallet.test.ts Outdated
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
sirtimid force-pushed the sirtimid/wire-remote-feature-flag-controller branch from 3989ae5 to 005feb9 Compare June 9, 2026 10:56
@sirtimid

sirtimid commented Jun 9, 2026

Copy link
Copy Markdown
Member Author

@metamaskbot publish-preview

@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Preview builds have been published. Learn how to use preview builds in other projects.

Expand for full list of packages and versions.
@metamask-previews/account-tree-controller@7.5.1-preview-e4acb70
@metamask-previews/accounts-controller@39.0.0-preview-e4acb70
@metamask-previews/address-book-controller@7.1.2-preview-e4acb70
@metamask-previews/ai-controllers@0.7.0-preview-e4acb70
@metamask-previews/analytics-controller@1.1.1-preview-e4acb70
@metamask-previews/analytics-data-regulation-controller@0.0.0-preview-e4acb70
@metamask-previews/announcement-controller@8.1.0-preview-e4acb70
@metamask-previews/app-metadata-controller@2.0.1-preview-e4acb70
@metamask-previews/approval-controller@9.0.1-preview-e4acb70
@metamask-previews/assets-controller@8.3.2-preview-e4acb70
@metamask-previews/assets-controllers@108.5.0-preview-e4acb70
@metamask-previews/authenticated-user-storage@2.0.0-preview-e4acb70
@metamask-previews/base-controller@9.1.0-preview-e4acb70
@metamask-previews/base-data-service@0.1.3-preview-e4acb70
@metamask-previews/bridge-controller@74.0.0-preview-e4acb70
@metamask-previews/bridge-status-controller@72.0.2-preview-e4acb70
@metamask-previews/build-utils@3.0.4-preview-e4acb70
@metamask-previews/chain-agnostic-permission@1.6.1-preview-e4acb70
@metamask-previews/chomp-api-service@3.1.0-preview-e4acb70
@metamask-previews/claims-controller@0.5.2-preview-e4acb70
@metamask-previews/client-controller@1.0.1-preview-e4acb70
@metamask-previews/compliance-controller@2.1.0-preview-e4acb70
@metamask-previews/composable-controller@12.0.1-preview-e4acb70
@metamask-previews/config-registry-controller@0.4.0-preview-e4acb70
@metamask-previews/connectivity-controller@0.2.0-preview-e4acb70
@metamask-previews/controller-utils@12.1.0-preview-e4acb70
@metamask-previews/core-backend@6.3.2-preview-e4acb70
@metamask-previews/delegation-controller@3.0.1-preview-e4acb70
@metamask-previews/earn-controller@12.2.0-preview-e4acb70
@metamask-previews/eip-5792-middleware@3.0.4-preview-e4acb70
@metamask-previews/eip-7702-internal-rpc-middleware@0.1.1-preview-e4acb70
@metamask-previews/eip1193-permission-middleware@2.0.1-preview-e4acb70
@metamask-previews/ens-controller@19.1.3-preview-e4acb70
@metamask-previews/eth-block-tracker@15.0.1-preview-e4acb70
@metamask-previews/eth-json-rpc-middleware@23.1.3-preview-e4acb70
@metamask-previews/eth-json-rpc-provider@6.0.1-preview-e4acb70
@metamask-previews/foundryup@1.0.1-preview-e4acb70
@metamask-previews/gas-fee-controller@26.2.2-preview-e4acb70
@metamask-previews/gator-permissions-controller@4.2.0-preview-e4acb70
@metamask-previews/geolocation-controller@0.1.3-preview-e4acb70
@metamask-previews/json-rpc-engine@10.5.0-preview-e4acb70
@metamask-previews/json-rpc-middleware-stream@8.0.8-preview-e4acb70
@metamask-previews/keyring-controller@26.0.0-preview-e4acb70
@metamask-previews/logging-controller@8.0.2-preview-e4acb70
@metamask-previews/message-manager@14.1.2-preview-e4acb70
@metamask-previews/messenger@1.2.0-preview-e4acb70
@metamask-previews/messenger-cli@0.2.0-preview-e4acb70
@metamask-previews/money-account-balance-service@1.0.2-preview-e4acb70
@metamask-previews/money-account-controller@0.3.2-preview-e4acb70
@metamask-previews/money-account-upgrade-controller@2.0.3-preview-e4acb70
@metamask-previews/multichain-account-service@10.0.2-preview-e4acb70
@metamask-previews/multichain-api-middleware@3.1.3-preview-e4acb70
@metamask-previews/multichain-network-controller@3.1.3-preview-e4acb70
@metamask-previews/multichain-transactions-controller@7.1.1-preview-e4acb70
@metamask-previews/name-controller@9.1.2-preview-e4acb70
@metamask-previews/network-controller@32.0.0-preview-e4acb70
@metamask-previews/network-enablement-controller@5.3.0-preview-e4acb70
@metamask-previews/notification-services-controller@24.1.2-preview-e4acb70
@metamask-previews/passkey-controller@2.0.1-preview-e4acb70
@metamask-previews/permission-controller@13.1.1-preview-e4acb70
@metamask-previews/permission-log-controller@5.1.0-preview-e4acb70
@metamask-previews/perps-controller@8.0.0-preview-e4acb70
@metamask-previews/phishing-controller@17.2.0-preview-e4acb70
@metamask-previews/polling-controller@16.0.6-preview-e4acb70
@metamask-previews/preferences-controller@23.1.0-preview-e4acb70
@metamask-previews/profile-metrics-controller@3.1.6-preview-e4acb70
@metamask-previews/profile-sync-controller@28.1.1-preview-e4acb70
@metamask-previews/ramps-controller@14.1.1-preview-e4acb70
@metamask-previews/rate-limit-controller@7.0.1-preview-e4acb70
@metamask-previews/react-data-query@0.2.1-preview-e4acb70
@metamask-previews/remote-feature-flag-controller@4.2.2-preview-e4acb70
@metamask-previews/sample-controllers@5.0.1-preview-e4acb70
@metamask-previews/seedless-onboarding-controller@10.0.1-preview-e4acb70
@metamask-previews/selected-network-controller@26.1.3-preview-e4acb70
@metamask-previews/shield-controller@5.1.2-preview-e4acb70
@metamask-previews/signature-controller@39.2.4-preview-e4acb70
@metamask-previews/snap-account-service@0.3.0-preview-e4acb70
@metamask-previews/social-controllers@2.2.1-preview-e4acb70
@metamask-previews/storage-service@1.0.1-preview-e4acb70
@metamask-previews/subscription-controller@6.1.3-preview-e4acb70
@metamask-previews/transaction-controller@67.0.0-preview-e4acb70
@metamask-previews/transaction-pay-controller@23.3.0-preview-e4acb70
@metamask-previews/user-operation-controller@41.2.3-preview-e4acb70
@metamask-previews/wallet@2.0.0-preview-e4acb70

@sirtimid
sirtimid requested a review from FrederikBolding June 9, 2026 11:22
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))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the above was merged this requires a rebase

sirtimid and others added 6 commits June 10, 2026 10:10
…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
sirtimid force-pushed the sirtimid/wire-remote-feature-flag-controller branch from e4acb70 to 16f33fc Compare June 10, 2026 09:26
@sirtimid
sirtimid requested a review from FrederikBolding June 10, 2026 09:30
@sirtimid
sirtimid added this pull request to the merge queue Jun 10, 2026
Merged via the queue into main with commit e5fce4b Jun 10, 2026
370 checks passed
@sirtimid
sirtimid deleted the sirtimid/wire-remote-feature-flag-controller branch June 10, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wallet: Pass prevClientVersion to RemoteFeatureFlagController

2 participants