Skip to content

feat: send x-mm-service-profile on token search (assets-controllers ^113.2.0) - #47655

Merged
Prithpal-Sooriya merged 2 commits into
mainfrom
fm/ext-service-profile-113-2
Nov 5, 2026
Merged

Prithpal-Sooriya merged 2 commits into
mainfrom
fm/ext-service-profile-113-2

Conversation

@Prithpal-Sooriya

@Prithpal-Sooriya Prithpal-Sooriya commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Description

Token search requests now send the x-mm-service-profile: assets--trending-search header, so backend services can identify this traffic (ASSETS-4243). This is the extension version of MetaMask/metamask-mobile#38852.

The extension makes /tokens/search requests from two places:

  1. Discover crypto search (ui/hooks/discover-search/useDiscoverCryptoSearch.ts) calls core's searchTokens. Since feat(assets-controllers): send x-mm-service-profile header in searchTokens core#11274 (released in @metamask/assets-controllers 113.2.0), core sends this header with assets--trending-search as the default. The hook now also passes serviceProfile explicitly.
  2. Token management search (ui/hooks/useTokenSearch.ts) uses a local helper, shared/lib/token-search/token-search-api.ts, that builds its own /tokens/search URL. Bumping the package alone would not tag these requests. Core's searchTokens can't replace this helper as-is: it has a different signature and response shape, and it takes no AbortSignal. So the helper's fetch now adds the header itself.

Changes:

  • Bump @metamask/assets-controllers from ^113.1.1 to ^113.2.0. Peer dependencies are the same as 113.1.1. The only transitive change is the uuid range (^14.0.1 → ^14.0.2), which still resolves to 14.0.3, so there are no LavaMoat policy changes. The lockfile is deduped.
  • Add the shared constant TOKEN_SEARCH_SERVICE_PROFILE = 'assets--trending-search', used by both paths.
  • Unit tests check the header on the local fetch, and check serviceProfile on both the first page and the next page of the Discover search.
  • The token API allows this header in CORS (access-control-allow-headers: x-client-id,x-mm-service-profile).

Note: the token-management search is tagged as assets--trending-search, the same profile core now uses by default for every searchTokens caller. If backend wants a separate profile for it, that is a one-line change to the constant.

Changelog

CHANGELOG entry: null

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/ASSETS-4243
Refs: MetaMask/core#11274, MetaMask/metamask-mobile#38852

Manual testing steps

  1. Run the extension and open DevTools on the extension UI with the Network tab open.
  2. Open Discover/Explore and search for a token (e.g. "USDC"). Check that the GET /tokens/search request includes the header x-mm-service-profile: assets--trending-search. Scroll to load more results and check that the paginated request sends the same header.
  3. Go to token management (Import tokens / Manage tokens) and type a token name in the search. Check that the /tokens/search request includes x-mm-service-profile: assets--trending-search and still includes X-Client-Id: extension.
  4. Check that search results still show up as before in both places.

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Adversarial review (adverse)

Final verdict (round 2/3): SHIP (unanimous, 3/3)
Findings: 0 critical · 1 warning · 11 info (across both rounds). Fixed: the comment wrongly said the constant "matches the core default" (round 1 warning); it now says both paths pass the constant explicitly. Declined: none. Info items were not actioned (some are notes only, e.g. that the header is not a trust boundary and that the transitive uuid range changed).
Reviewer: claude -p via adverse 0.2.1 (3 personas, 2 rounds).


Note

Low Risk
Adds a request header and bumps a dependency; no auth, signing, or response parsing changes beyond what tests cover.

Overview
Extension token search traffic is now tagged for backend analytics by sending x-mm-service-profile: assets--trending-search on every /tokens/search call, alongside the existing X-Client-Id: extension.

A shared TOKEN_SEARCH_SERVICE_PROFILE constant keeps both call paths aligned: Discover crypto search passes serviceProfile into @metamask/assets-controllers searchTokens (including paginated loads), and the local shared/lib/token-search/token-search-api helper (used for import/manage token search) sets the same header on its direct fetch. @metamask/assets-controllers is bumped to ^113.2.0 so core’s search client supports the option; tests assert the headers and serviceProfile on first and next pages.

Reviewed by Cursor Bugbot for commit 9d7e1ce. Bugbot is set up for automated code reviews on this repo. Configure here.

…113.2.0)

Bump @metamask/assets-controllers to ^113.2.0, whose searchTokens sends
x-mm-service-profile (default assets--trending-search). Pass it explicitly from
useDiscoverCryptoSearch and add the same header to the local /tokens/search
helper used by useTokenSearch so every token search request is tagged.

Refs: ASSETS-4243
@Prithpal-Sooriya Prithpal-Sooriya added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label Nov 5, 2026
@github-actions github-actions Bot added the size-S label Nov 5, 2026
@github-actions

github-actions Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@socket-security

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​metamask/​assets-controllers@​113.1.1 ⏵ 113.2.098 +110091 +1100 +1100

View full report

@metamask-ci

metamask-ci Bot commented Nov 5, 2026

Copy link
Copy Markdown
Contributor
Builds ready [9d7e1ce]
⚡ Performance Benchmarks (Total: 🟢 5 pass · 🟡 5 warn · 🔴 3 fail)

Baseline (latest main): f693520 | Date: 11/3/2026 | Pipeline: 42060761999 | Baseline logs

Metricschrome-webpackfirefox-webpack
loadNewAccount
[Sentry log · main/release]
🔴 load_new_account(p95) [CI log]🔴 load_new_account(p95) [CI log]
onboardingNewWallet
[Sentry log · main/release]
🟢 [CI log]🔴 [CI log]

Regressions (🔴 3 failures)

Interaction Benchmarks · Samples: 5 🔴 2
Benchmarkchrome-webpackfirefox-webpack
loadNewAccount
[Sentry log · main/release]
🔴 [CI log]
🔴 load_new_account
🔴 [CI log]
🔴 load_new_account
confirmTx
[Sentry log · main/release]
🟡 [CI log]🟡 [CI log]
bridgeUserActions
[Sentry log · main/release]
🟡 [CI log]🟡 [CI log]

📈 Results compared to the previous 5 runs on main

  • ↑ loadNewAccount/load_new_account: +182%
  • ↑ loadNewAccount/total: +182%
  • ↓ loadNewAccount/inp: -18%
  • ↑ loadNewAccount/fcp: +13%
  • ↑ loadNewAccount/lcp: +1011%
  • ↑ loadNewAccount/cls: +238%
  • ↑ confirmTx/longTaskTotalDuration: +33%
  • ↑ confirmTx/longTaskMaxDuration: +48%
  • ↑ confirmTx/tbt: +56%
  • ↓ confirmTx/inp: -21%
  • ↑ confirmTx/fcp: +10%
  • ↑ confirmTx/lcp: +1006%
  • ↓ confirmTx/cls: -12%
  • ↑ bridgeUserActions/bridge_load_page: +77%
  • ↑ bridgeUserActions/bridge_load_asset_picker: +29%
  • ↑ bridgeUserActions/longTaskCount: +36%
  • ↑ bridgeUserActions/longTaskTotalDuration: +32%
  • ↑ bridgeUserActions/tbt: +31%
  • ↑ bridgeUserActions/lcp: +961%
  • ↑ bridgeUserActions/cls: +537%
  • ↑ loadNewAccount/load_new_account: +184%
  • ↑ loadNewAccount/total: +184%
  • ↓ loadNewAccount/fcp: -31%
  • ↑ loadNewAccount/lcp: +1751%
  • ↓ confirmTx/longTaskCount: -100%
  • ↓ confirmTx/longTaskTotalDuration: -100%
  • ↓ confirmTx/longTaskMaxDuration: -100%
  • ↓ confirmTx/tbt: -100%
  • ↓ confirmTx/inp: -21%
  • ↑ confirmTx/fcp: +21%
  • ↑ confirmTx/lcp: +1336%
  • ↑ bridgeUserActions/bridge_load_page: +341%
  • ↑ bridgeUserActions/bridge_load_asset_picker: +113%
  • ↑ bridgeUserActions/bridge_search_token: +13%
  • ↓ bridgeUserActions/longTaskCount: -100%
  • ↓ bridgeUserActions/longTaskTotalDuration: -100%
  • ↓ bridgeUserActions/longTaskMaxDuration: -100%
  • ↓ bridgeUserActions/tbt: -100%
  • ↑ bridgeUserActions/total: +54%
  • ↑ bridgeUserActions/inp: +54%
  • ↑ bridgeUserActions/fcp: +22%
  • ↑ bridgeUserActions/lcp: +1291%

🌐 Core Web Vitals — 🟢 good · 🟡 needs improvement · 🔴 poor (web.dev thresholds)

  • 🟡 loadNewAccount/FCP: p75 2.0s
  • 🟡 confirmTx/FCP: p75 1.9s
  • 🟡 bridgeUserActions/FCP: p75 1.9s
  • 🟡 loadNewAccount/LCP: p75 3.3s
  • 🟡 confirmTx/FCP: p75 2.1s
  • 🟡 bridgeUserActions/FCP: p75 2.1s
Startup Benchmarks · Samples: 100
Benchmarkchrome-webpackfirefox-webpack
startupStandardHome
[Sentry log · main/release]
🟢 [CI log]🟢 [CI log]

📈 Results compared to the previous 5 runs on main

  • ↑ startupStandardHome/uiStartup: +21%
  • ↑ startupStandardHome/load: +40%
  • ↑ startupStandardHome/domContentLoaded: +40%
  • ↓ startupStandardHome/domInteractive: -14%
  • ↓ startupStandardHome/firstPaint: -50%
  • ↓ startupStandardHome/backgroundConnect: -26%
  • ↓ startupStandardHome/firstReactRender: -98%
  • ↓ startupStandardHome/initialActions: -64%
  • ↑ startupStandardHome/loadScripts: +39%
  • ↑ startupStandardHome/setupStore: +49%
  • ↑ startupStandardHome/longTaskTotalDuration: +36%
  • ↑ startupStandardHome/longTaskMaxDuration: +56%
  • ↑ startupStandardHome/tbt: +46%
  • ↓ startupStandardHome/inp: -30%
  • ↑ startupStandardHome/fcp: +33%
  • ↑ startupStandardHome/lcp: +495%
  • ↓ startupStandardHome/cls: -72%
  • ↓ startupStandardHome/uiStartup: -22%
  • ↓ startupStandardHome/load: -16%
  • ↓ startupStandardHome/domContentLoaded: -18%
  • ↓ startupStandardHome/domInteractive: -34%
  • ↓ startupStandardHome/firstReactRender: -99%
  • ↓ startupStandardHome/initialActions: -50%
  • ↓ startupStandardHome/loadScripts: -17%
  • ↓ startupStandardHome/setupStore: -19%
  • ↓ startupStandardHome/fcp: -23%
  • ↓ startupStandardHome/lcp: -12%
User Journey Benchmarks · Samples: 5 · mock API 🔴 1
Benchmarkchrome-webpackfirefox-webpack
onboardingImportWallet
[Sentry log · main/release]
🟢 [CI log]🟡 [CI log]
🟡 total
onboardingNewWallet
[Sentry log · main/release]
🟢 [CI log]🔴 [CI log]
🔴 total

📈 Results compared to the previous 5 runs on main

  • ↓ onboardingImportWallet/srpButtonToSrpForm: -17%
  • ↓ onboardingImportWallet/doneButtonToHomeScreen: -92%
  • ↓ onboardingImportWallet/openAccountMenuToAccountListLoaded: -74%
  • ↓ onboardingImportWallet/longTaskCount: -100%
  • ↓ onboardingImportWallet/longTaskTotalDuration: -100%
  • ↓ onboardingImportWallet/longTaskMaxDuration: -100%
  • ↓ onboardingImportWallet/tbt: -100%
  • ↓ onboardingImportWallet/total: -86%
  • ↓ onboardingNewWallet/createWalletToSocialScreen: -12%
  • ↓ onboardingNewWallet/srpButtonToPwForm: -31%
  • ↓ onboardingNewWallet/createPwToRecoveryScreen: -20%
  • ↓ onboardingNewWallet/agreeButtonToOnboardingSuccess: -53%
  • ↓ onboardingNewWallet/doneButtonToAssetList: -77%
  • ↓ onboardingNewWallet/longTaskCount: -100%
  • ↓ onboardingNewWallet/longTaskTotalDuration: -100%
  • ↓ onboardingNewWallet/longTaskMaxDuration: -100%
  • ↓ onboardingNewWallet/tbt: -100%
  • ↓ onboardingNewWallet/total: -74%
Dapp Page Load Benchmarks · Samples: 100
Benchmarkchrome-webpack
dappPageLoad
[Sentry log · main/release]
🟢 [CI log]

📈 Results compared to the previous 5 runs on main

  • ↓ dappPageLoad/pageLoadTime: -70%
  • ↓ dappPageLoad/domContentLoaded: -38%
  • ↓ dappPageLoad/firstPaint: -52%
  • ↓ dappPageLoad/firstContentfulPaint: -52%
Bundle Size Diffs
Status Bundle Total Diff Change
✅ background 15.25 MiB +130 Bytes 0.00%
✅ ui 19.39 MiB +231 Bytes 0.00%
✅ common 0 Bytes 0 Bytes 0.00%
✅ other 4.44 MiB 0 Bytes 0.00%
✅ content scripts 3.23 MiB 0 Bytes 0.00%
✅ unzipped 79.72 MiB +366 Bytes 0.00%
✅ zip 23.83 MiB +152 Bytes 0.00%

@sonarqubecloud

sonarqubecloud Bot commented Nov 5, 2026

Copy link
Copy Markdown

@Prithpal-Sooriya
Prithpal-Sooriya added this pull request to the merge queue Nov 5, 2026
Merged via the queue into main with commit 2659ea1 Nov 5, 2026
151 checks passed
@Prithpal-Sooriya
Prithpal-Sooriya deleted the fm/ext-service-profile-113-2 branch November 5, 2026 18:43
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 5, 2026
@metamaskbot metamaskbot added the release-13.57.0 Issue or pull request that will be included in release 13.57.0 label Nov 9, 2026
@gauthierpetetin

Copy link
Copy Markdown
Contributor

No release label on PR. Adding release label release-13.57.0 on PR, as PR was added to branch 13.57.0 when release was cut.

This branch was previously deployed

1 inactive deployment
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed release-13.57.0 Issue or pull request that will be included in release 13.57.0 size-S team-assets

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants