Skip to content

chore(background): remove unused util helpers - #47577

Merged
georgewrmarshall merged 1 commit into
mainfrom
cursor/remove-dead-code-background-util-20261103-a4dd
Nov 3, 2026
Merged

georgewrmarshall merged 1 commit into
mainfrom
cursor/remove-dead-code-background-util-20261103-a4dd

Conversation

@georgewrmarshall

@georgewrmarshall georgewrmarshall commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Description

Remove four unused helpers from the background util module, plus the CHAIN_IDS / TEST_CHAINS import and the characters constant that only those helpers used. getPlatform stays. Owner set: (none).

No user-facing behavior change.

path removed (file / symbol / class) why dead
app/scripts/lib/util.ts checkAlarmExists unused export
app/scripts/lib/util.ts getChainType unused export
app/scripts/lib/util.ts generateRandomId unused export
app/scripts/lib/util.ts isValidDate unused export
app/scripts/lib/util.ts CHAIN_IDS / TEST_CHAINS import and characters cascade from getChainType and generateRandomId

Docs/comments updated: none

Checks that passed: yarn lint:tsc, eslint on the touched file, yarn test:unit --coverage=false including app/scripts/lib/util.test.js and app/scripts/detect-multiple-instances.test.js (31 suites, 449 tests, 5 snapshots passed, no snapshot updates). No stylesheets changed.

Changelog

CHANGELOG entry: null

Related issues

Refs: proactive dead-code cleanup (extension counterpart of metamask-mobile#37948)

Manual testing steps

N/A — deletes unreachable code. There is no user-facing behavior to click through.

Screenshots/Recordings

N/A — no UI change

Before

N/A — no UI change

After

N/A — no UI change

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.

Note

Low Risk
Deletes unreachable exports only; no callers and no logic paths altered.

Overview
Proactive dead-code cleanup in app/scripts/lib/util.ts: removes four unused exports (checkAlarmExists, getChainType, generateRandomId, isValidDate) and drops the CHAIN_IDS / TEST_CHAINS import plus the characters constant that only supported those helpers.

The module’s export surface is narrowed to getPlatform among the removed batch (other existing exports in the file are unchanged). No user-facing or runtime behavior change—call sites already did not use these symbols; unit tests were run without snapshot updates.

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

Co-authored-by: George Marshall <georgewrmarshall@users.noreply.github.com>
@github-actions github-actions Bot added the size-S label Nov 3, 2026
@georgewrmarshall georgewrmarshall added team-design-system All issues relating to design system in Extension and removed size-S labels Nov 3, 2026 — with Cursor
@georgewrmarshall georgewrmarshall self-assigned this Nov 3, 2026
@metamask-ci

metamask-ci Bot commented Nov 3, 2026

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

Baseline (latest main): 171ed20 | Date: 7/28/2026 | Pipeline: 41612001647 | 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: +419%
  • ↑ loadNewAccount/total: +419%
  • ↑ loadNewAccount/inp: +14%
  • ↑ loadNewAccount/fcp: +15%
  • ↑ loadNewAccount/cls: +1195%
  • ↑ confirmTx/confirm_tx: +10%
  • ↑ confirmTx/longTaskCount: +33%
  • ↑ confirmTx/longTaskTotalDuration: +90%
  • ↑ confirmTx/longTaskMaxDuration: +123%
  • ↑ confirmTx/tbt: +153%
  • ↑ confirmTx/total: +10%
  • ↑ confirmTx/fcp: +16%
  • ↑ confirmTx/lcp: +15%
  • ↑ confirmTx/cls: +12%
  • ↑ bridgeUserActions/bridge_load_page: +163%
  • ↑ bridgeUserActions/bridge_load_asset_picker: +246%
  • ↑ bridgeUserActions/bridge_search_token: +30%
  • ↑ bridgeUserActions/longTaskCount: +122%
  • ↑ bridgeUserActions/longTaskTotalDuration: +208%
  • ↑ bridgeUserActions/longTaskMaxDuration: +59%
  • ↑ bridgeUserActions/tbt: +318%
  • ↑ bridgeUserActions/total: +51%
  • ↑ bridgeUserActions/inp: +23%
  • ↑ bridgeUserActions/fcp: +14%
  • ↑ bridgeUserActions/lcp: +20%
  • ↑ bridgeUserActions/cls: +1181%
  • ↑ loadNewAccount/load_new_account: +420%
  • ↑ loadNewAccount/total: +420%
  • ↓ loadNewAccount/inp: -17%
  • ↓ loadNewAccount/fcp: -35%
  • ↑ loadNewAccount/lcp: +1279%
  • ↓ confirmTx/longTaskCount: -100%
  • ↓ confirmTx/longTaskTotalDuration: -100%
  • ↓ confirmTx/longTaskMaxDuration: -100%
  • ↓ confirmTx/tbt: -100%
  • ↓ confirmTx/fcp: -49%
  • ↑ confirmTx/lcp: +1423%
  • ↑ bridgeUserActions/bridge_load_page: +432%
  • ↑ bridgeUserActions/bridge_load_asset_picker: +131%
  • ↓ bridgeUserActions/longTaskCount: -100%
  • ↓ bridgeUserActions/longTaskTotalDuration: -100%
  • ↓ bridgeUserActions/longTaskMaxDuration: -100%
  • ↓ bridgeUserActions/tbt: -100%
  • ↑ bridgeUserActions/total: +55%
  • ↑ bridgeUserActions/inp: +62%
  • ↓ bridgeUserActions/fcp: -35%
  • ↑ bridgeUserActions/lcp: +1290%

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

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

📈 Results compared to the previous 5 runs on main

  • ↑ startupStandardHome/domInteractive: +21%
  • ↓ startupStandardHome/firstReactRender: -98%
  • ↓ startupStandardHome/initialActions: -33%
  • ↑ startupStandardHome/setupStore: +188%
  • ↓ startupStandardHome/longTaskCount: -33%
  • ↑ startupStandardHome/domInteractive: +32%
  • ↑ startupStandardHome/backgroundConnect: +12%
  • ↓ startupStandardHome/firstReactRender: -98%
  • ↓ startupStandardHome/initialActions: -50%
  • ↑ startupStandardHome/setupStore: +163%
  • ↑ startupStandardHome/inp: +100%
  • ↑ startupStandardHome/fcp: +21%
  • ↑ startupStandardHome/lcp: +11%
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: +49%
  • ↑ onboardingImportWallet/confirmSrpToPwForm: +40%
  • ↑ onboardingImportWallet/pwFormToMetricsScreen: +37%
  • ↑ onboardingImportWallet/metricsToWalletReadyScreen: +36%
  • ↓ onboardingImportWallet/doneButtonToHomeScreen: -94%
  • ↓ onboardingImportWallet/openAccountMenuToAccountListLoaded: -75%
  • ↓ onboardingImportWallet/longTaskCount: -100%
  • ↓ onboardingImportWallet/longTaskTotalDuration: -100%
  • ↓ onboardingImportWallet/longTaskMaxDuration: -100%
  • ↓ onboardingImportWallet/tbt: -100%
  • ↓ onboardingImportWallet/total: -89%
  • ↑ onboardingNewWallet/srpButtonToPwForm: +45%
  • ↑ onboardingNewWallet/createPwToRecoveryScreen: +23%
  • ↑ onboardingNewWallet/skipBackupToMetricsScreen: +21%
  • ↑ onboardingNewWallet/agreeButtonToOnboardingSuccess: +15%
  • ↓ onboardingNewWallet/doneButtonToAssetList: -76%
  • ↓ onboardingNewWallet/longTaskCount: -69%
  • ↓ onboardingNewWallet/longTaskTotalDuration: -79%
  • ↓ onboardingNewWallet/longTaskMaxDuration: -50%
  • ↓ onboardingNewWallet/tbt: -98%
  • ↓ onboardingNewWallet/total: -73%
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: -65%
  • ↓ dappPageLoad/domContentLoaded: -18%
  • ↓ dappPageLoad/firstPaint: -50%
  • ↓ dappPageLoad/firstContentfulPaint: -50%
Bundle Size Diffs
Status Bundle Total Diff Change
✅ background 15.26 MiB +93 Bytes 0.00%
✅ ui 19.33 MiB +37 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.89 MiB +135 Bytes 0.00%
✅ zip 24.07 MiB +19 Bytes 0.00%

@sonarqubecloud

sonarqubecloud Bot commented Nov 3, 2026

Copy link
Copy Markdown

@vinnyhoward vinnyhoward left a comment

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.

No correctness problems found

@georgewrmarshall
georgewrmarshall added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit 6b0ebbb Nov 3, 2026
152 of 153 checks passed
@georgewrmarshall
georgewrmarshall deleted the cursor/remove-dead-code-background-util-20261103-a4dd branch November 3, 2026 18:34
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 3, 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 had an error being deployed

1 failed and 1 inactive deployments
segment-schema — f1f23c7e Deployed Nov 3, 2026 by georgewrmarshall via propose #2545
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-13.57.0 Issue or pull request that will be included in release 13.57.0 team-design-system All issues relating to design system in Extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants