Skip to content

refactor: convert app/scripts/lib/segment/analytics.js to TypeScript#41476

Merged
DDDDDanica merged 5 commits intomainfrom
copilot/convert-analytics-js-to-typescript
Apr 9, 2026
Merged

refactor: convert app/scripts/lib/segment/analytics.js to TypeScript#41476
DDDDDanica merged 5 commits intomainfrom
copilot/convert-analytics-js-to-typescript

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 3, 2026

[skip-e2e]
Converts app/scripts/lib/segment/analytics.js and its test file to TypeScript as part of the ongoing TS migration, removing both entries from files-to-convert.json.

Changes

  • analytics.ts — Full conversion with typed interfaces (AnalyticsMessage, AnalyticsOptions, AnalyticsCallback, QueueItem, FlushData, RetryableError). Also fixes a latent bug in flushAt initialization: the original JS relied on NaN || 20 as the undefined fallback, which breaks when naively rewritten with ??:

    // Bug: options.flushAt || Math.max(options.flushAt ?? 0, 1) || 20
    //   → Math.max(0, 1) = 1 (truthy), so default becomes 1 not 20
    // Fix:
    this.flushAt = options.flushAt === undefined ? 20 : Math.max(options.flushAt, 1);
  • analytics.test.ts — Converted test file; global.setImmediate and global.fetch overrides cast via as any to satisfy Node type constraints.

  • types/segment.d.ts — New declaration file providing module types for three untyped packages: @segment/loosely-validate-event, remove-trailing-slash, is-retry-allowed.

  • metametrics-controller.test.ts — Two mockImplementation calls required as any cast since the stub (...args: unknown[]) => void no longer matches the now-typed Analytics.track/.page return signatures.


Note

Medium Risk
Touches the in-house Segment batching client used for telemetry delivery, including default flushAt initialization and retry/timer handling, so mistakes could drop or delay metrics despite being a mostly type-focused refactor.

Overview
Converts the Segment Analytics batching client from JS to typed analytics.ts, adding explicit message/queue/flush types and fixing the flushAt defaulting logic (ensuring undefined still defaults to 20 while 0 clamps to 1). It also formalizes timer tracking (timer) and tightens retry/error typing in _sendRequest/_isErrorRetryable.

Replaces analytics.test.js with a more comprehensive analytics.test.ts covering host normalization, queue flushing behavior, timer clearing, payload normalization for non-string IDs, and retry/non-retry error paths. Updates metametrics-controller.test.ts mocks to match the now-typed Analytics.track/page signatures, adds types/segment.d.ts for untyped dependencies, and removes the converted files from files-to-convert.json.

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

Copilot AI changed the title [WIP] Convert app/scripts/lib/segment/analytics.js to TypeScript feat: convert app/scripts/lib/segment/analytics.js to TypeScript Apr 3, 2026
Copilot AI requested a review from DDDDDanica April 3, 2026 09:54
@DDDDDanica DDDDDanica changed the title feat: convert app/scripts/lib/segment/analytics.js to TypeScript refactor: convert app/scripts/lib/segment/analytics.js to TypeScript Apr 3, 2026
@github-actions github-actions bot added the size-M label Apr 3, 2026
@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Apr 3, 2026

Builds ready [d380bd7]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 12 warn · 🔴 0 fail)

Baseline (latest main): f34f804 | Date: 9/10/58222 | Pipeline: 23942224112 | Baseline logs

Interaction Benchmarks
Benchmarkchrome-browserify
loadNewAccount🟡 [Show logs]
confirmTx🟡 [Show logs]
bridgeUserActions🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • loadNewAccount/load_new_account: -12%
  • loadNewAccount/total: -12%
  • bridgeUserActions/bridge_search_token: -21%
  • bridgeUserActions/total: -13%

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

  • 🟡 loadNewAccount/FCP: p75 2.5s
  • 🟡 confirmTx/FCP: p75 2.4s
  • 🟡 bridgeUserActions/FCP: p75 2.5s
Startup Benchmarks
Benchmarkchrome-browserifychrome-webpackfirefox-browserifyfirefox-webpack
startupStandardHome🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]
startupPowerUserHome🟡 [Show logs]🟡 [Show logs]🟡 [Show logs]🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • startupStandardHome/uiStartup: -13%
  • startupStandardHome/load: -16%
  • startupStandardHome/domContentLoaded: -18%
  • startupStandardHome/firstReactRender: -13%
  • startupStandardHome/initialActions: -38%
  • startupStandardHome/loadScripts: -21%
  • startupPowerUserHome/backgroundConnect: +115%
  • startupPowerUserHome/numNetworkReqs: -50%
  • startupStandardHome/uiStartup: -15%
  • startupStandardHome/load: -14%
  • startupStandardHome/domContentLoaded: -14%
  • startupStandardHome/backgroundConnect: -36%
  • startupStandardHome/firstReactRender: -24%
  • startupStandardHome/loadScripts: -14%
  • startupStandardHome/setupStore: -14%
  • startupStandardHome/numNetworkReqs: -29%
  • startupPowerUserHome/domInteractive: -17%
  • startupPowerUserHome/numNetworkReqs: +48%
  • startupStandardHome/domInteractive: -57%
  • startupStandardHome/initialActions: +25%
  • startupStandardHome/setupStore: +14%
  • startupStandardHome/numNetworkReqs: -18%
  • startupPowerUserHome/uiStartup: -11%
  • startupPowerUserHome/domInteractive: +16%
  • startupPowerUserHome/backgroundConnect: -21%
  • startupStandardHome/domInteractive: -32%
  • startupStandardHome/backgroundConnect: -21%
  • startupStandardHome/initialActions: +11%
  • startupStandardHome/setupStore: -54%
  • startupPowerUserHome/backgroundConnect: -13%
  • startupPowerUserHome/firstReactRender: -11%

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

  • 🔴 startupPowerUserHome/INP: p75 664ms
  • 🔴 startupPowerUserHome/INP: p75 648ms
  • 🟡 startupPowerUserHome/LCP: p75 3.5s
  • 🟡 startupPowerUserHome/LCP: p75 3.6s
User Journey Benchmarks
Benchmarkchrome-browserify
onboardingImportWallet🟢 [Show logs]
onboardingNewWallet🟢 [Show logs]
assetDetails🟡 [Show logs]
solanaAssetDetails🟡 [Show logs]
importSrpHome🟡 [Show logs]
sendTransactions🟡 [Show logs]
swap🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • onboardingImportWallet/metricsToWalletReadyScreen: -20%
  • onboardingImportWallet/doneButtonToHomeScreen: -76%
  • onboardingImportWallet/openAccountMenuToAccountListLoaded: +42%
  • onboardingImportWallet/total: -39%
  • onboardingNewWallet/doneButtonToAssetList: -31%
  • onboardingNewWallet/total: -24%
  • assetDetails/assetClickToPriceChart: -68%
  • assetDetails/total: -68%
  • solanaAssetDetails/assetClickToPriceChart: -55%
  • solanaAssetDetails/total: -55%
  • importSrpHome/openAccountMenuAfterLogin: -71%
  • importSrpHome/homeAfterImportWithNewWallet: -40%
  • importSrpHome/total: -34%
  • sendTransactions/openSendPageFromHome: +112%
  • sendTransactions/total: +10%
  • swap/openSwapPageFromHome: -86%
  • swap/fetchAndDisplaySwapQuotes: +31%
  • swap/total: +13%

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

  • 🟡 assetDetails/INP: p75 232ms
  • 🟡 assetDetails/FCP: p75 2.5s
  • 🟡 solanaAssetDetails/FCP: p75 2.5s
  • 🟡 importSrpHome/INP: p75 208ms
  • 🟡 importSrpHome/FCP: p75 2.4s
  • 🟡 sendTransactions/FCP: p75 2.5s
  • 🟡 swap/FCP: p75 2.5s
🌐 Dapp Page Load Benchmarks

Current Commit: d380bd7 | Date: 4/3/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.03s (±40ms) 🟡 | historical mean value: 1.03s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 722ms (±38ms) 🟢 | historical mean value: 723ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 85ms (±9ms) 🟢 | historical mean value: 86ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.03s 40ms 1.00s 1.34s 1.06s 1.34s
domContentLoaded 722ms 38ms 698ms 1.02s 749ms 1.02s
firstPaint 85ms 9ms 68ms 160ms 92ms 160ms
firstContentfulPaint 85ms 9ms 68ms 160ms 92ms 160ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs
  • background: 58 Bytes (0%)
  • ui: 5 Bytes (0%)
  • common: 770 Bytes (0.01%)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 3, 2026

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.

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Apr 3, 2026

Builds ready [183cf0f]
⚡ Performance Benchmarks (Total: 🟢 6 pass · 🟡 12 warn · 🔴 0 fail)

Baseline (latest main): f34f804 | Date: 9/10/58222 | Pipeline: 23946324122 | Baseline logs

Interaction Benchmarks
Benchmarkchrome-browserify
loadNewAccount🟡 [Show logs]
confirmTx🟡 [Show logs]
bridgeUserActions🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • bridgeUserActions/bridge_search_token: +40%
  • bridgeUserActions/total: +23%

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

  • 🟡 loadNewAccount/FCP: p75 2.5s
  • 🟡 confirmTx/FCP: p75 2.4s
  • 🟡 bridgeUserActions/FCP: p75 2.5s
Startup Benchmarks
Benchmarkchrome-browserifychrome-webpackfirefox-browserifyfirefox-webpack
startupStandardHome🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]
startupPowerUserHome🟡 [Show logs]🟡 [Show logs]🟡 [Show logs]🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • startupStandardHome/uiStartup: -11%
  • startupStandardHome/load: -13%
  • startupStandardHome/domContentLoaded: -14%
  • startupStandardHome/domInteractive: +12%
  • startupStandardHome/backgroundConnect: +12%
  • startupStandardHome/initialActions: -38%
  • startupStandardHome/loadScripts: -17%
  • startupStandardHome/numNetworkReqs: -18%
  • startupPowerUserHome/domInteractive: -11%
  • startupPowerUserHome/backgroundConnect: +114%
  • startupPowerUserHome/setupStore: +17%
  • startupPowerUserHome/numNetworkReqs: -19%
  • startupStandardHome/uiStartup: -12%
  • startupStandardHome/load: -12%
  • startupStandardHome/domContentLoaded: -11%
  • startupStandardHome/backgroundConnect: -32%
  • startupStandardHome/firstReactRender: -24%
  • startupStandardHome/loadScripts: -11%
  • startupStandardHome/numNetworkReqs: -29%
  • startupPowerUserHome/domInteractive: -14%
  • startupPowerUserHome/numNetworkReqs: -45%
  • startupStandardHome/domInteractive: -58%
  • startupStandardHome/initialActions: +25%
  • startupStandardHome/setupStore: +14%
  • startupPowerUserHome/domInteractive: +18%
  • startupPowerUserHome/backgroundConnect: -28%
  • startupStandardHome/uiStartup: -11%
  • startupStandardHome/load: -11%
  • startupStandardHome/domContentLoaded: -11%
  • startupStandardHome/domInteractive: -52%
  • startupStandardHome/backgroundConnect: -20%
  • startupStandardHome/initialActions: -44%
  • startupStandardHome/loadScripts: -10%
  • startupStandardHome/setupStore: -60%
  • startupStandardHome/numNetworkReqs: -18%
  • startupPowerUserHome/uiStartup: -12%
  • startupPowerUserHome/backgroundConnect: -34%
  • startupPowerUserHome/firstReactRender: -11%

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

  • 🔴 startupPowerUserHome/INP: p75 624ms
  • 🔴 startupPowerUserHome/INP: p75 680ms
  • 🟡 startupPowerUserHome/LCP: p75 3.6s
  • 🟡 startupPowerUserHome/LCP: p75 3.5s
User Journey Benchmarks
Benchmarkchrome-browserify
onboardingImportWallet🟢 [Show logs]
onboardingNewWallet🟢 [Show logs]
assetDetails🟡 [Show logs]
solanaAssetDetails🟡 [Show logs]
importSrpHome🟡 [Show logs]
sendTransactions🟡 [Show logs]
swap🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • onboardingImportWallet/doneButtonToHomeScreen: -76%
  • onboardingImportWallet/openAccountMenuToAccountListLoaded: +33%
  • onboardingImportWallet/total: -40%
  • onboardingNewWallet/skipBackupToMetricsScreen: -10%
  • onboardingNewWallet/agreeButtonToOnboardingSuccess: -19%
  • onboardingNewWallet/doneButtonToAssetList: -26%
  • onboardingNewWallet/total: -22%
  • assetDetails/assetClickToPriceChart: -65%
  • assetDetails/total: -65%
  • solanaAssetDetails/assetClickToPriceChart: -52%
  • solanaAssetDetails/total: -52%
  • importSrpHome/openAccountMenuAfterLogin: -73%
  • importSrpHome/homeAfterImportWithNewWallet: -42%
  • importSrpHome/total: -36%
  • sendTransactions/openSendPageFromHome: +49%
  • swap/openSwapPageFromHome: -86%
  • swap/fetchAndDisplaySwapQuotes: +31%
  • swap/total: +14%

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

  • 🟡 assetDetails/INP: p75 224ms
  • 🟡 assetDetails/FCP: p75 2.5s
  • 🟡 solanaAssetDetails/FCP: p75 2.5s
  • 🟡 importSrpHome/INP: p75 208ms
  • 🟡 importSrpHome/FCP: p75 2.3s
  • 🟡 sendTransactions/INP: p75 224ms
  • 🟡 sendTransactions/FCP: p75 2.4s
  • 🟡 swap/FCP: p75 2.4s
🌐 Dapp Page Load Benchmarks

Current Commit: 183cf0f | Date: 4/3/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.02s (±38ms) 🟡 | historical mean value: 1.03s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 715ms (±36ms) 🟢 | historical mean value: 723ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 83ms (±10ms) 🟢 | historical mean value: 86ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.02s 38ms 996ms 1.31s 1.04s 1.31s
domContentLoaded 715ms 36ms 694ms 986ms 730ms 986ms
firstPaint 83ms 10ms 68ms 164ms 92ms 164ms
firstContentfulPaint 83ms 10ms 68ms 164ms 92ms 164ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs
  • background: 58 Bytes (0%)
  • ui: 5 Bytes (0%)
  • common: 770 Bytes (0.01%)

@DDDDDanica DDDDDanica marked this pull request as ready for review April 7, 2026 15:39
@DDDDDanica DDDDDanica enabled auto-merge April 7, 2026 15:39
@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Apr 7, 2026

Builds ready [160d8b1]
⚡ Performance Benchmarks (Total: 🟢 7 pass · 🟡 12 warn · 🔴 0 fail)

Baseline (latest main): f34f804 | Date: 9/10/58222 | Pipeline: 24090518719 | Baseline logs

Interaction Benchmarks · Samples: 5
Benchmarkchrome-browserify
loadNewAccount🟡 [Show logs]
confirmTx🟡 [Show logs]
bridgeUserActions🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • bridgeUserActions/bridge_load_page: +15%
  • bridgeUserActions/bridge_load_asset_picker: -47%
  • bridgeUserActions/bridge_search_token: -15%
  • bridgeUserActions/total: -19%

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

  • 🟡 loadNewAccount/FCP: p75 2.7s
  • 🟡 confirmTx/FCP: p75 2.5s
  • 🟡 bridgeUserActions/INP: p75 208ms
  • 🟡 bridgeUserActions/FCP: p75 2.4s
Startup Benchmarks · Samples: 100
Benchmarkchrome-browserifychrome-webpackfirefox-browserifyfirefox-webpack
startupStandardHome🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]
startupPowerUserHome
🟡 uiStartup
[Show logs]
🟡 [Show logs]🟡 [Show logs]🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • startupStandardHome/load: -12%
  • startupStandardHome/domContentLoaded: -14%
  • startupStandardHome/domInteractive: +19%
  • startupStandardHome/backgroundConnect: +12%
  • startupStandardHome/initialActions: -38%
  • startupStandardHome/loadScripts: -17%
  • startupStandardHome/numNetworkReqs: -13%
  • startupPowerUserHome/backgroundConnect: +173%
  • startupPowerUserHome/setupStore: +17%
  • startupPowerUserHome/numNetworkReqs: -13%
  • startupStandardHome/domInteractive: +16%
  • startupStandardHome/firstPaint: +11%
  • startupStandardHome/backgroundConnect: -27%
  • startupStandardHome/firstReactRender: -13%
  • startupStandardHome/numNetworkReqs: -19%
  • startupPowerUserHome/domInteractive: -13%
  • startupPowerUserHome/numNetworkReqs: -25%
  • startupStandardHome/domInteractive: -59%
  • startupStandardHome/initialActions: -38%
  • startupStandardHome/numNetworkReqs: -18%
  • startupPowerUserHome/uiStartup: -14%
  • startupPowerUserHome/backgroundConnect: -40%
  • startupPowerUserHome/setupStore: -35%
  • startupStandardHome/domInteractive: -29%
  • startupStandardHome/backgroundConnect: -19%
  • startupStandardHome/initialActions: -44%
  • startupStandardHome/setupStore: -57%
  • startupStandardHome/numNetworkReqs: -13%
  • startupPowerUserHome/domInteractive: -20%
  • startupPowerUserHome/backgroundConnect: -31%
  • startupPowerUserHome/setupStore: +12%

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

  • 🔴 startupPowerUserHome/INP: p75 672ms
  • 🔴 startupPowerUserHome/INP: p75 632ms
  • 🟡 startupPowerUserHome/LCP: p75 3.4s
  • 🟡 startupPowerUserHome/LCP: p75 3.7s
User Journey Benchmarks · Samples: 5 · mock API
Benchmarkchrome-browserify
onboardingImportWallet🟢 [Show logs]
onboardingNewWallet🟢 [Show logs]
assetDetails🟡 [Show logs]
solanaAssetDetails🟡 [Show logs]
importSrpHome🟡 [Show logs]
sendTransactions🟡 [Show logs]
swap🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • onboardingImportWallet/srpButtonToSrpForm: -85%
  • onboardingImportWallet/metricsToWalletReadyScreen: -30%
  • onboardingImportWallet/doneButtonToHomeScreen: -73%
  • onboardingImportWallet/openAccountMenuToAccountListLoaded: +23%
  • onboardingImportWallet/total: -41%
  • onboardingNewWallet/srpButtonToPwForm: -77%
  • onboardingNewWallet/skipBackupToMetricsScreen: -67%
  • onboardingNewWallet/doneButtonToAssetList: -39%
  • onboardingNewWallet/total: -37%
  • assetDetails/assetClickToPriceChart: -77%
  • assetDetails/total: -77%
  • solanaAssetDetails/assetClickToPriceChart: -69%
  • solanaAssetDetails/total: -69%
  • importSrpHome/openAccountMenuAfterLogin: -58%
  • importSrpHome/homeAfterImportWithNewWallet: -38%
  • importSrpHome/total: -31%
  • sendTransactions/openSendPageFromHome: -12%
  • sendTransactions/selectTokenToSendFormLoaded: -28%
  • sendTransactions/reviewTransactionToConfirmationPage: +12%
  • sendTransactions/total: +10%
  • swap/openSwapPageFromHome: -96%
  • swap/fetchAndDisplaySwapQuotes: +31%
  • swap/total: +11%

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

  • 🟡 assetDetails/INP: p75 208ms
  • 🟡 assetDetails/FCP: p75 2.5s
  • 🟡 solanaAssetDetails/FCP: p75 2.5s
  • 🟡 importSrpHome/INP: p75 216ms
  • 🟡 importSrpHome/FCP: p75 2.6s
  • 🟡 sendTransactions/FCP: p75 2.5s
  • 🟡 swap/FCP: p75 2.5s
Dapp Page Load Benchmarks · Samples: 100
Benchmarkchrome-browserify
dappPageLoad🟢 [Show logs]
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 58 Bytes (0%)
  • ui: 13.75 KiB (0.16%)
  • common: 6.56 KiB (0.05%)

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud bot commented Apr 7, 2026

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Apr 7, 2026

Builds ready [8565b08]
⚡ Performance Benchmarks (Total: 🟢 7 pass · 🟡 12 warn · 🔴 0 fail)

Baseline (latest main): f34f804 | Date: 9/10/58222 | Pipeline: 24108730534 | Baseline logs

Interaction Benchmarks · Samples: 5
Benchmarkchrome-browserify
loadNewAccount🟡 [Show logs]
confirmTx🟡 [Show logs]
bridgeUserActions🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • loadNewAccount/load_new_account: -17%
  • loadNewAccount/total: -17%
  • bridgeUserActions/bridge_load_asset_picker: -52%
  • bridgeUserActions/bridge_search_token: -15%
  • bridgeUserActions/total: -19%

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

  • 🟡 loadNewAccount/FCP: p75 2.4s
  • 🟡 confirmTx/FCP: p75 2.5s
  • 🟡 bridgeUserActions/FCP: p75 2.5s
Startup Benchmarks · Samples: 100
Benchmarkchrome-browserifychrome-webpackfirefox-browserifyfirefox-webpack
startupStandardHome🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]🟢 [Show logs]
startupPowerUserHome🟡 [Show logs]🟡 [Show logs]🟡 [Show logs]🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • startupStandardHome/load: -10%
  • startupStandardHome/domContentLoaded: -12%
  • startupStandardHome/backgroundConnect: +14%
  • startupStandardHome/firstReactRender: -17%
  • startupStandardHome/initialActions: -38%
  • startupStandardHome/loadScripts: -15%
  • startupStandardHome/numNetworkReqs: -21%
  • startupPowerUserHome/domInteractive: -15%
  • startupPowerUserHome/backgroundConnect: +122%
  • startupPowerUserHome/setupStore: +22%
  • startupStandardHome/uiStartup: -16%
  • startupStandardHome/load: -15%
  • startupStandardHome/domContentLoaded: -14%
  • startupStandardHome/firstPaint: +16%
  • startupStandardHome/backgroundConnect: -36%
  • startupStandardHome/firstReactRender: -20%
  • startupStandardHome/loadScripts: -14%
  • startupStandardHome/numNetworkReqs: -29%
  • startupPowerUserHome/domInteractive: -14%
  • startupPowerUserHome/numNetworkReqs: -45%
  • startupStandardHome/domInteractive: -58%
  • startupStandardHome/initialActions: +25%
  • startupStandardHome/setupStore: +14%
  • startupStandardHome/numNetworkReqs: -18%
  • startupPowerUserHome/uiStartup: -12%
  • startupPowerUserHome/backgroundConnect: -33%
  • startupPowerUserHome/setupStore: +14%
  • startupStandardHome/uiStartup: -10%
  • startupStandardHome/domInteractive: -30%
  • startupStandardHome/backgroundConnect: -16%
  • startupStandardHome/initialActions: -44%
  • startupStandardHome/setupStore: -63%
  • startupStandardHome/numNetworkReqs: -16%
  • startupPowerUserHome/uiStartup: -12%
  • startupPowerUserHome/load: -11%
  • startupPowerUserHome/domContentLoaded: -11%
  • startupPowerUserHome/backgroundConnect: -40%
  • startupPowerUserHome/setupStore: +26%

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

  • 🔴 startupPowerUserHome/INP: p75 680ms
  • 🔴 startupPowerUserHome/INP: p75 672ms
  • 🟡 startupPowerUserHome/LCP: p75 3.3s
  • 🟡 startupPowerUserHome/LCP: p75 3.3s
User Journey Benchmarks · Samples: 5 · mock API
Benchmarkchrome-browserify
onboardingImportWallet🟢 [Show logs]
onboardingNewWallet🟢 [Show logs]
assetDetails🟡 [Show logs]
solanaAssetDetails🟡 [Show logs]
importSrpHome🟡 [Show logs]
sendTransactions🟡 [Show logs]
swap🟡 [Show logs]

📈 Results compared to the previous 5 runs on main

  • onboardingImportWallet/srpButtonToSrpForm: -85%
  • onboardingImportWallet/metricsToWalletReadyScreen: -48%
  • onboardingImportWallet/doneButtonToHomeScreen: -77%
  • onboardingImportWallet/openAccountMenuToAccountListLoaded: +23%
  • onboardingImportWallet/total: -42%
  • onboardingNewWallet/srpButtonToPwForm: -79%
  • onboardingNewWallet/skipBackupToMetricsScreen: -69%
  • onboardingNewWallet/agreeButtonToOnboardingSuccess: -28%
  • onboardingNewWallet/doneButtonToAssetList: -35%
  • onboardingNewWallet/total: -33%
  • assetDetails/assetClickToPriceChart: -74%
  • assetDetails/total: -74%
  • solanaAssetDetails/assetClickToPriceChart: -74%
  • solanaAssetDetails/total: -74%
  • importSrpHome/openAccountMenuAfterLogin: -75%
  • importSrpHome/homeAfterImportWithNewWallet: -69%
  • importSrpHome/total: -60%
  • sendTransactions/openSendPageFromHome: +11%
  • sendTransactions/selectTokenToSendFormLoaded: -26%
  • sendTransactions/reviewTransactionToConfirmationPage: +37%
  • sendTransactions/total: +34%
  • swap/openSwapPageFromHome: -96%
  • swap/fetchAndDisplaySwapQuotes: +32%
  • swap/total: +12%

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

  • 🟡 assetDetails/FCP: p75 2.5s
  • 🟡 solanaAssetDetails/FCP: p75 2.5s
  • 🟡 importSrpHome/INP: p75 208ms
  • 🟡 importSrpHome/FCP: p75 2.5s
  • 🟡 sendTransactions/INP: p75 280ms
  • 🟡 sendTransactions/FCP: p75 2.6s
  • 🟡 swap/FCP: p75 2.6s
Dapp Page Load Benchmarks · Samples: 100
Benchmarkchrome-browserify
dappPageLoad🟢 [Show logs]
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: -24 Bytes (0%)
  • ui: 16.6 KiB (0.2%)
  • common: 7.63 KiB (0.06%)

* @property {number} [flushAt] (default: 20)
* @property {number} [flushInterval] (default: 10000)
* @property {string} [host] (default: 'https://api.segment.io')
* @param writeKey - The Segment project write key.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Q: still need JSDocs with these?

@DDDDDanica DDDDDanica added this pull request to the merge queue Apr 9, 2026
Merged via the queue into main with commit 662f132 Apr 9, 2026
397 of 402 checks passed
@DDDDDanica DDDDDanica deleted the copilot/convert-analytics-js-to-typescript branch April 9, 2026 15:27
@github-actions github-actions bot locked and limited conversation to collaborators Apr 9, 2026
@metamaskbot metamaskbot added the release-13.27.0 Issue or pull request that will be included in release 13.27.0 label Apr 9, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants