Skip to content

fix: handle missing TransactionController in migration 187 gracefully#40765

Merged
cryptotavares merged 2 commits intomainfrom
claude/fix-metamask-39609-WNe5K
Mar 17, 2026
Merged

fix: handle missing TransactionController in migration 187 gracefully#40765
cryptotavares merged 2 commits intomainfrom
claude/fix-metamask-39609-WNe5K

Conversation

@cryptotavares
Copy link
Copy Markdown
Contributor

@cryptotavares cryptotavares commented Mar 10, 2026

Description

Users upgrading from older extension versions may not have a TransactionController in their stored state. Migration 187 previously threw a Sentry error (Migration 187: state.TransactionController is not defined) when encountering this case, which caused noise in error tracking and could block initialization.

This PR removes the sentry.captureException call for the missing TransactionController case and instead lets the migration skip silently (returning false), consistent with how the migration already handles a missing transactions property. A regression test is added to verify state is left unchanged when TransactionController is absent.

Open in GitHub Codespaces

Changelog

CHANGELOG entry: Fixed a Sentry error during startup for users upgrading from older versions without TransactionController state

Related issues

Fixes: #39609

Manual testing steps

  1. Run the migration 187 unit tests: yarn jest app/scripts/migrations/187.test.ts
  2. Verify the new test case skips migration with warning if TransactionController is missing from state passes
  3. Verify all existing migration 187 tests still pass

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.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 10, 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.

@metamaskbot metamaskbot added the team-product-safety Push issues to Product Safety team label Mar 10, 2026
@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Mar 10, 2026

Builds ready [8c575fd]
⚡ Performance Benchmarks
👆 Interaction Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Load New Accountload_new_account29226133731321337
total29226133731321337
Confirm Txconfirm_tx6076605160991860886099
total6076605160991860886099
Bridge User Actionsbridge_load_page2232102349226234
bridge_load_asset_picker18615820217200202
bridge_search_token7337307373737737
total115811511164511641164
🔌 Startup Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Standard HomeuiStartup14491227185011715031657
load120099114539412431357
domContentLoaded119298614269212291349
domInteractive2817106182579
firstPaint175691358172214283
backgroundConnect21619729216220250
firstReactRender21137882234
initialActions1010124
loadScripts99278812269010211151
setupStore1364061524
numNetworkReqs362791192884
Power User HomeuiStartup37272054137732726326312123
load12971104202915813171640
domContentLoaded12771086201715512961607
domInteractive3819184273496
firstPaint1978844487271376
backgroundConnect1178283781818567006723
firstReactRender28175273042
initialActions106114
loadScripts1047875173314110681341
setupStore17657101939
numNetworkReqs1185126244138213
🧭 User Journey Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Onboarding Import WalletimportWalletToSocialScreen2192192201219220
srpButtonToSrpForm93919529395
confirmSrpToPwForm21212102121
pwFormToMetricsScreen15151501515
metricsToWalletReadyScreen15151601616
doneButtonToHomeScreen736588985146780985
openAccountMenuToAccountListLoaded2909289029291429122929
total3932384840318040254031
Onboarding New WalletcreateWalletToSocialScreen2202192200220220
srpButtonToPwForm12610916120136161
createPwToRecoveryScreen999099
skipBackupToMetricsScreen35353603536
agreeButtonToOnboardingSuccess17161701717
doneButtonToAssetList51349253316530533
total90687992518921925
Asset DetailsassetClickToPriceChart14210518930159189
total14210518930159189
Solana Asset DetailsassetClickToPriceChart83828418384
total83828418384
Import Srp HomeloginToHomeScreen2107198022348321402234
openAccountMenuAfterLogin65626836868
homeAfterImportWithNewWallet2323225123874723572387
total44944348466010745444660
Send TransactionsopenSendPageFromHome21172942329
selectTokenToSendFormLoaded19191901919
reviewTransactionToConfirmationPage8468468471846847
total8868828934887893
SwapopenSwapPageFromHome35244794147
fetchAndDisplaySwapQuotes268626812690326872690
total272827202733527322733
🌐 Dapp Page Load Benchmarks

Current Commit: 8c575fd | Date: 3/10/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.07s (±43ms) 🟡 | historical mean value: 1.03s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 753ms (±39ms) 🟢 | historical mean value: 721ms ⬆️ (historical data)
  • firstContentfulPaint-> current mean value: 84ms (±10ms) 🟢 | historical mean value: 82ms ⬆️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.07s 43ms 1.04s 1.39s 1.11s 1.39s
domContentLoaded 753ms 39ms 729ms 1.04s 788ms 1.04s
firstPaint 84ms 10ms 72ms 168ms 92ms 168ms
firstContentfulPaint 84ms 10ms 72ms 168ms 92ms 168ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 962.4 KiB (22.32%)
  • ui: 348.29 KiB (4.25%)
  • common: 321.88 KiB (2.94%)

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Mar 16, 2026

Builds ready [9ccca07]
⚡ Performance Benchmarks
👆 Interaction Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Load New Accountload_new_account3033023051305305
total3033023051305305
Confirm Txconfirm_tx6024600960371060346037
total6024600960371060346037
Bridge User Actionsbridge_load_page24520030747297307
bridge_load_asset_picker25123526615265266
bridge_search_token7817707888788788
total1323123514618613281461
🔌 Startup Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Standard HomeuiStartup14841213186811315651670
load1228995142110012911393
domContentLoaded121999114129912861379
domInteractive3018107202681
firstPaint164691197130204317
backgroundConnect21819830414224239
firstReactRender21135882039
initialActions2013224
loadScripts101880412039810811186
setupStore1363351623
numNetworkReqs393184153778
Power User HomeuiStartup56752332151712335657710238
load13641161174212814051652
domContentLoaded13431157172512413811636
domInteractive41222874333128
firstPaint225871737214271440
backgroundConnect190434612580226728335586
firstReactRender2816260242940
initialActions105113
loadScripts1108940147611611431393
setupStore1765382030
numNetworkReqs23810347565280330
🧭 User Journey Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Onboarding Import WalletimportWalletToSocialScreen2212172243223224
srpButtonToSrpForm98951043100104
confirmSrpToPwForm24232402424
pwFormToMetricsScreen16151811718
metricsToWalletReadyScreen18181801818
doneButtonToHomeScreen63860368835670688
openAccountMenuToAccountListLoaded2934291129642129482964
total3948390440164539844016
Onboarding New WalletcreateWalletToSocialScreen2182172191218219
srpButtonToPwForm1121111131112113
createPwToRecoveryScreen888088
skipBackupToMetricsScreen39383903939
agreeButtonToOnboardingSuccess17161701717
doneButtonToAssetList50648356132496561
total90487497239890972
Asset DetailsassetClickToPriceChart604580147380
total604580147380
Solana Asset DetailsassetClickToPriceChart1537025663181256
total1537025663181256
Import Srp HomeloginToHomeScreen2279222523866322582386
openAccountMenuAfterLogin635680106280
homeAfterImportWithNewWallet1310470258291922732582
total378027755564114547215564
Send TransactionsopenSendPageFromHome492680205780
selectTokenToSendFormLoaded30213763537
reviewTransactionToConfirmationPage1302122413635113231363
total1375128614475713851447
SwapopenSwapPageFromHome1181121266126126
fetchAndDisplaySwapQuotes2704268727191527182719
total2841277929004528852900
🌐 Dapp Page Load Benchmarks

Current Commit: 9ccca07 | Date: 3/16/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.04s (±40ms) 🟡 | historical mean value: 1.05s ⬇️ (historical data)
  • domContentLoaded-> current mean value: 730ms (±37ms) 🟢 | historical mean value: 742ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 79ms (±12ms) 🟢 | historical mean value: 92ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.04s 40ms 1.01s 1.33s 1.09s 1.33s
domContentLoaded 730ms 37ms 708ms 1.00s 760ms 1.00s
firstPaint 79ms 12ms 64ms 184ms 88ms 184ms
firstContentfulPaint 79ms 12ms 64ms 184ms 88ms 184ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 976.49 KiB (22.65%)
  • ui: 325.99 KiB (3.98%)
  • common: 326.03 KiB (2.98%)

Users upgrading from older versions may not have a TransactionController
in their stored state. Previously this threw an error via Sentry that
blocked initialization. Now it logs a console warning and skips the
migration, consistent with how missing transactions is already handled.

Fixes #39609

https://claude.ai/code/session_01AyphppibFc9iZTRv8JVTVN
@cryptotavares cryptotavares force-pushed the claude/fix-metamask-39609-WNe5K branch from 9ccca07 to b87c2b7 Compare March 16, 2026 23:42
@cryptotavares cryptotavares marked this pull request as ready for review March 16, 2026 23:50
Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

// -- Step 1: Validate TransactionController exists
//
if (!hasProperty(state, 'TransactionController')) {
global.sentry?.captureException?.(
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing console.warn for absent TransactionController case

Low Severity

The PR description states it "logs a console warning and skips the migration, consistent with how missing transactions is already handled," and the test is named "skips migration with warning." However, the missing TransactionController branch at line 34–35 silently returns false without any console.warn. The analogous missing-transactions branch (line 52–56) does call console.warn. The test also doesn't assert that a warning was logged, unlike its counterpart test for missing transactions.

Additional Locations (1)
Fix in Cursor Fix in Web

@sonarqubecloud
Copy link
Copy Markdown

@metamaskbotv2
Copy link
Copy Markdown
Contributor

metamaskbotv2 bot commented Mar 17, 2026

Builds ready [4ed085d]
⚡ Performance Benchmarks
👆 Interaction Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Load New Accountload_new_account2862802976285297
total2862802976285297
Confirm Txconfirm_tx6024600660351160306035
total6024600660351160306035
Bridge User Actionsbridge_load_page23922025814243258
bridge_load_asset_picker23418927632265276
bridge_search_token74270476525761765
total1202111312785612411278
🔌 Startup Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Standard HomeuiStartup1457123317349514991632
load1204101714598912451377
domContentLoaded1198101014388812421358
domInteractive3018114212689
firstPaint1507139666211248
backgroundConnect21419726913216245
firstReactRender20134352231
initialActions106124
loadScripts99981812368710421156
setupStore1473561725
numNetworkReqs393184154077
Power User HomeuiStartup57992167150352597670710573
load13421178169912513891642
domContentLoaded13211171167711513671577
domInteractive3619223333195
firstPaint231811252139297351
backgroundConnect193730812502239519737532
firstReactRender23164462536
initialActions106113
loadScripts1085944144811011131337
setupStore1684671826
numNetworkReqs17910731945197284
🧭 User Journey Benchmarks
BenchmarkMetricMean (ms)Min (ms)Max (ms)Std Dev (ms)P75 (ms)P95 (ms)
Onboarding Import WalletimportWalletToSocialScreen2222172253224225
srpButtonToSrpForm98941013100101
confirmSrpToPwForm23232302323
pwFormToMetricsScreen16161601616
metricsToWalletReadyScreen17171701717
doneButtonToHomeScreen60859863013604630
openAccountMenuToAccountListLoaded2924289629542029372954
total3924386939894539613989
Onboarding New WalletcreateWalletToSocialScreen2222192252223225
srpButtonToPwForm1071071070107107
createPwToRecoveryScreen888088
skipBackupToMetricsScreen37363703737
agreeButtonToOnboardingSuccess16161601616
doneButtonToAssetList570368680122661680
total962769107111810481071
Asset DetailsassetClickToPriceChart704096218596
total704096218596
Solana Asset DetailsassetClickToPriceChart573380177080
total573380177080
Import Srp HomeloginToHomeScreen2266219823315423022331
openAccountMenuAfterLogin68421062381106
homeAfterImportWithNewWallet2337231823571623502357
total4675462247313946854731
Send TransactionsopenSendPageFromHome29273222832
selectTokenToSendFormLoaded31303313133
reviewTransactionToConfirmationPage1204969139814412831398
total12841062152315313411523
SwapopenSwapPageFromHome812411532102115
fetchAndDisplaySwapQuotes2703268527331727062733
total2785275628212628082821
🌐 Dapp Page Load Benchmarks

Current Commit: 4ed085d | Date: 3/17/2026

📄 Localhost MetaMask Test Dapp

Samples: 100

Summary

  • pageLoadTime-> current mean value: 1.05s (±43ms) 🟡 | historical mean value: 1.05s ⬆️ (historical data)
  • domContentLoaded-> current mean value: 724ms (±41ms) 🟢 | historical mean value: 742ms ⬇️ (historical data)
  • firstContentfulPaint-> current mean value: 82ms (±10ms) 🟢 | historical mean value: 92ms ⬇️ (historical data)

📈 Detailed Results

Metric Mean Std Dev Min Max P95 P99
pageLoadTime 1.05s 43ms 1.03s 1.34s 1.08s 1.34s
domContentLoaded 724ms 41ms 703ms 1.00s 752ms 1.00s
firstPaint 82ms 10ms 68ms 164ms 92ms 164ms
firstContentfulPaint 82ms 10ms 68ms 164ms 92ms 164ms
largestContentfulPaint 0ms 0ms 0ms 0ms 0ms 0ms
Bundle size diffs
  • background: -115 Bytes (0%)
  • ui: 5 Bytes (0%)
  • common: 20 Bytes (0%)

@cryptotavares cryptotavares added team-confirmations Push issues to confirmations team and removed team-product-safety Push issues to Product Safety team labels Mar 17, 2026
@cryptotavares cryptotavares added this pull request to the merge queue Mar 17, 2026
Merged via the queue into main with commit 67a05cb Mar 17, 2026
191 of 196 checks passed
@cryptotavares cryptotavares deleted the claude/fix-metamask-39609-WNe5K branch March 17, 2026 13:53
@github-actions github-actions bot locked and limited conversation to collaborators Mar 17, 2026
@metamaskbot metamaskbot added the release-13.24.0 Issue or pull request that will be included in release 13.24.0 label Mar 17, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-13.24.0 Issue or pull request that will be included in release 13.24.0 size-S team-confirmations Push issues to confirmations team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Sentry] Error: Migration 187: state.TransactionController is not defined

4 participants