Skip to content

feat(persistence): report per-key read results on storage failures - #48015

Merged
gauthierpetetin merged 2 commits into
mainfrom
feat/mwpe-319-split-state-read-diagnostics
Nov 17, 2026
Merged

gauthierpetetin merged 2 commits into
mainfrom
feat/mwpe-319-split-state-read-diagnostics

Conversation

@gauthierpetetin

@gauthierpetetin gauthierpetetin commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Description

When split-state persistence fails, Sentry reports the underlying storage error but not which logical keys were readable, missing, or failed. That makes vault corruption and write failures hard to diagnose.

This PR adds a per-key diagnostic read on the existing persistence failure path and attaches the results as Sentry extras. Existing error messages, tags, and fingerprints are unchanged.

What is reported

  • ExtensionStore.getSplitStateReadDiagnostics() reads the split-state manifest, then each listed key on its own.
  • Outcomes are key names and error names only. Stored values are never retained.
  • Manifest status is one of:
    • readable: split-state manifest present
    • missing: no array manifest (legacy data/meta)
    • failed: unsupported storage or the manifest read threw

Where it is attached

  • Only through #capturePersistenceException, for get-failed, set-failed, persist-failed, and their backup variants.
  • Browser-shutdown failures skip the probe.
  • Missing-vault recovery after a successful read does not probe. Every key would look readable and would not explain the missing vault.

Sentry extras

  • persistence.read_manifest_status
  • persistence.read_manifest_key_count
  • persistence.read_manifest_error_name
  • persistence.read_readable_keys
  • persistence.read_missing_keys
  • persistence.read_failed_keys (Key:ErrorName entries)

Changelog

CHANGELOG entry: null

Related issues

Fixes: MWPE-319

Manual testing steps

  1. Build and load the extension with split-state storage.
  2. Trigger a storage read or write failure that is reported to Sentry (for example the existing vault-corruption test helpers, or a mocked storage.local failure).
  3. In Sentry, open the persistence error and verify the persistence.read_* extras are present for split state.
  4. Confirm no controller values, vault ciphertext, or addresses appear in the extras.
  5. Confirm a normal boot with a healthy wallet does not add these extras.

Screenshots/Recordings

Before

After

Screenshot 2026-11-17 at 15 36 44

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

Medium Risk
Touches persistence failure telemetry and performs extra storage.local reads on error paths near vault/keyring storage, though designed to avoid leaking stored values.

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

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

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.

@metamask-ci metamask-ci Bot added the team-extension-platform Extension Platform team label Nov 17, 2026
@metamask-ci

metamask-ci Bot commented Nov 17, 2026

Copy link
Copy Markdown
Contributor
Builds ready [7bd6fe2]
⚡ Performance Benchmarks (Total: 🟢 8 pass · 🟡 2 warn · 🔴 3 fail)

Baseline (latest main): f693520 | Date: 11/3/2026 | Pipeline: 44071389255 | 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]
🟡 bridge_load_page
🟡 bridge_search_token

📈 Results compared to the previous 5 runs on main

  • ↑ loadNewAccount/load_new_account: +182%
  • ↑ loadNewAccount/total: +182%
  • ↑ loadNewAccount/lcp: +838%
  • ↑ loadNewAccount/cls: +572%
  • ↑ confirmTx/longTaskCount: +67%
  • ↑ confirmTx/longTaskTotalDuration: +69%
  • ↑ confirmTx/longTaskMaxDuration: +61%
  • ↑ confirmTx/tbt: +75%
  • ↓ confirmTx/inp: -29%
  • ↑ confirmTx/lcp: +861%
  • ↑ bridgeUserActions/bridge_load_page: +39%
  • ↑ bridgeUserActions/bridge_load_asset_picker: +13%
  • ↑ bridgeUserActions/bridge_search_token: +26%
  • ↑ bridgeUserActions/total: +24%
  • ↑ bridgeUserActions/lcp: +838%
  • ↑ bridgeUserActions/cls: +577%
  • ↑ loadNewAccount/load_new_account: +181%
  • ↑ loadNewAccount/total: +181%
  • ↑ loadNewAccount/inp: +72%
  • ↑ loadNewAccount/lcp: +980%
  • ↓ confirmTx/longTaskCount: -100%
  • ↓ confirmTx/longTaskTotalDuration: -100%
  • ↓ confirmTx/longTaskMaxDuration: -100%
  • ↓ confirmTx/tbt: -100%
  • ↓ confirmTx/inp: -21%
  • ↓ confirmTx/fcp: -60%
  • ↑ confirmTx/lcp: +1050%
  • ↑ bridgeUserActions/bridge_load_page: +549%
  • ↑ bridgeUserActions/bridge_load_asset_picker: +186%
  • ↑ bridgeUserActions/bridge_search_token: +155%
  • ↓ bridgeUserActions/longTaskCount: -100%
  • ↓ bridgeUserActions/longTaskTotalDuration: -100%
  • ↓ bridgeUserActions/longTaskMaxDuration: -100%
  • ↓ bridgeUserActions/tbt: -100%
  • ↑ bridgeUserActions/total: +209%
  • ↓ bridgeUserActions/inp: -19%
  • ↓ bridgeUserActions/fcp: -61%
  • ↑ bridgeUserActions/lcp: +1026%
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: -15%
  • ↓ startupStandardHome/firstPaint: -18%
  • ↓ startupStandardHome/backgroundConnect: -13%
  • ↓ startupStandardHome/firstReactRender: -41%
  • ↓ startupStandardHome/initialActions: -64%
  • ↑ startupStandardHome/setupStore: +36%
  • ↓ startupStandardHome/longTaskTotalDuration: -10%
  • ↓ startupStandardHome/inp: -37%
  • ↑ startupStandardHome/lcp: +350%
  • ↓ startupStandardHome/cls: -72%
  • ↓ startupStandardHome/uiStartup: -19%
  • ↓ startupStandardHome/load: -16%
  • ↓ startupStandardHome/domContentLoaded: -18%
  • ↓ startupStandardHome/initialActions: -50%
  • ↓ startupStandardHome/loadScripts: -16%
  • ↓ startupStandardHome/setupStore: -19%
  • ↓ startupStandardHome/lcp: -14%
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: -11%
  • ↓ onboardingImportWallet/metricsToWalletReadyScreen: -31%
  • ↓ onboardingImportWallet/doneButtonToHomeScreen: -94%
  • ↓ onboardingImportWallet/openAccountMenuToAccountListLoaded: -74%
  • ↓ onboardingImportWallet/longTaskCount: -82%
  • ↓ onboardingImportWallet/longTaskTotalDuration: -94%
  • ↓ onboardingImportWallet/longTaskMaxDuration: -88%
  • ↓ onboardingImportWallet/tbt: -100%
  • ↓ onboardingImportWallet/total: -87%
  • ↑ onboardingNewWallet/createPwToRecoveryScreen: +29%
  • ↑ onboardingNewWallet/skipBackupToMetricsScreen: +11%
  • ↓ onboardingNewWallet/doneButtonToAssetList: -82%
  • ↓ onboardingNewWallet/longTaskCount: -100%
  • ↓ onboardingNewWallet/longTaskTotalDuration: -100%
  • ↓ onboardingNewWallet/longTaskMaxDuration: -100%
  • ↓ onboardingNewWallet/tbt: -100%
  • ↓ onboardingNewWallet/total: -77%
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: -53%
  • ↓ dappPageLoad/firstPaint: -28%
  • ↓ dappPageLoad/firstContentfulPaint: -28%
Bundle Size Diffs [🚨 Warning! Bundle size has increased!]
Status Bundle Total Diff Change
🚨 background 15.18 MiB +1.5 KiB +0.01%
🚨 ui 19.16 MiB +1.45 KiB +0.01%
✅ common 0 Bytes 0 Bytes 0.00%
✅ other 4.46 MiB 0 Bytes 0.00%
✅ content scripts 3.19 MiB 0 Bytes 0.00%
🚨 unzipped 79.49 MiB +2.95 KiB 0.00%
✅ zip 23.92 MiB +790 Bytes 0.00%

Co-authored-by: Cursor <cursoragent@cursor.com>
@metamask-ci

metamask-ci Bot commented Nov 17, 2026

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

Baseline (latest main): f693520 | Date: 11/3/2026 | Pipeline: 44081884373 | 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]
🟡 bridge_search_token

📈 Results compared to the previous 5 runs on main

  • ↑ loadNewAccount/load_new_account: +181%
  • ↑ loadNewAccount/total: +181%
  • ↓ loadNewAccount/inp: -25%
  • ↓ loadNewAccount/fcp: -17%
  • ↑ loadNewAccount/lcp: +716%
  • ↓ loadNewAccount/cls: -86%
  • ↑ confirmTx/longTaskCount: +33%
  • ↑ confirmTx/longTaskTotalDuration: +28%
  • ↑ confirmTx/longTaskMaxDuration: +38%
  • ↑ confirmTx/tbt: +26%
  • ↓ confirmTx/inp: -37%
  • ↓ confirmTx/fcp: -22%
  • ↑ confirmTx/lcp: +683%
  • ↓ confirmTx/cls: -14%
  • ↑ bridgeUserActions/bridge_search_token: +20%
  • ↓ bridgeUserActions/longTaskTotalDuration: -19%
  • ↓ bridgeUserActions/longTaskMaxDuration: -17%
  • ↓ bridgeUserActions/tbt: -34%
  • ↑ bridgeUserActions/total: +21%
  • ↓ bridgeUserActions/fcp: -22%
  • ↑ bridgeUserActions/lcp: +667%
  • ↓ bridgeUserActions/cls: -86%
  • ↑ loadNewAccount/load_new_account: +181%
  • ↑ loadNewAccount/total: +181%
  • ↓ loadNewAccount/inp: -25%
  • ↓ loadNewAccount/fcp: -65%
  • ↑ loadNewAccount/lcp: +1233%
  • ↓ confirmTx/longTaskCount: -100%
  • ↓ confirmTx/longTaskTotalDuration: -100%
  • ↓ confirmTx/longTaskMaxDuration: -100%
  • ↓ confirmTx/tbt: -100%
  • ↑ confirmTx/inp: +114%
  • ↓ confirmTx/fcp: -67%
  • ↑ confirmTx/lcp: +1082%
  • ↑ bridgeUserActions/bridge_load_page: +352%
  • ↑ bridgeUserActions/bridge_load_asset_picker: +147%
  • ↑ bridgeUserActions/bridge_search_token: +147%
  • ↓ bridgeUserActions/longTaskCount: -100%
  • ↓ bridgeUserActions/longTaskTotalDuration: -100%
  • ↓ bridgeUserActions/longTaskMaxDuration: -100%
  • ↓ bridgeUserActions/tbt: -100%
  • ↑ bridgeUserActions/total: +136%
  • ↑ bridgeUserActions/inp: +69%
  • ↓ bridgeUserActions/fcp: -62%
  • ↑ bridgeUserActions/lcp: +1034%

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

  • 🟡 confirmTx/INP: p75 216ms
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/load: +28%
  • ↑ startupStandardHome/domContentLoaded: +28%
  • ↓ startupStandardHome/firstPaint: -58%
  • ↓ startupStandardHome/firstReactRender: -30%
  • ↓ startupStandardHome/initialActions: -64%
  • ↑ startupStandardHome/loadScripts: +26%
  • ↑ startupStandardHome/setupStore: +101%
  • ↑ startupStandardHome/longTaskCount: +43%
  • ↑ startupStandardHome/longTaskTotalDuration: +17%
  • ↑ startupStandardHome/longTaskMaxDuration: +22%
  • ↑ startupStandardHome/tbt: +18%
  • ↓ startupStandardHome/fcp: -62%
  • ↑ startupStandardHome/lcp: +71%
  • ↓ startupStandardHome/cls: -72%
  • ↓ startupStandardHome/uiStartup: -20%
  • ↓ startupStandardHome/load: -16%
  • ↓ startupStandardHome/domContentLoaded: -17%
  • ↓ startupStandardHome/backgroundConnect: -13%
  • ↓ startupStandardHome/initialActions: -50%
  • ↓ startupStandardHome/loadScripts: -16%
  • ↓ startupStandardHome/setupStore: -30%
  • ↓ startupStandardHome/lcp: -15%
User Journey Benchmarks · Samples: 5 · mock API 🔴 1
Benchmarkchrome-webpackfirefox-webpack
onboardingImportWallet
[Sentry log · main/release]
🟢 [CI log]🟢 [CI log]
onboardingNewWallet
[Sentry log · main/release]
🟢 [CI log]🔴 [CI log]
🔴 total

📈 Results compared to the previous 5 runs on main

  • ↓ onboardingImportWallet/srpButtonToSrpForm: -14%
  • ↑ onboardingImportWallet/pwFormToMetricsScreen: +18%
  • ↓ onboardingImportWallet/doneButtonToHomeScreen: -94%
  • ↓ onboardingImportWallet/openAccountMenuToAccountListLoaded: -74%
  • ↓ onboardingImportWallet/longTaskCount: -100%
  • ↓ onboardingImportWallet/longTaskTotalDuration: -100%
  • ↓ onboardingImportWallet/longTaskMaxDuration: -100%
  • ↓ onboardingImportWallet/tbt: -100%
  • ↓ onboardingImportWallet/total: -86%
  • ↑ onboardingNewWallet/srpButtonToPwForm: +14%
  • ↑ onboardingNewWallet/createPwToRecoveryScreen: +40%
  • ↑ onboardingNewWallet/skipBackupToMetricsScreen: +18%
  • ↑ onboardingNewWallet/agreeButtonToOnboardingSuccess: +15%
  • ↓ onboardingNewWallet/doneButtonToAssetList: -73%
  • ↓ onboardingNewWallet/longTaskCount: -62%
  • ↓ onboardingNewWallet/longTaskTotalDuration: -72%
  • ↓ onboardingNewWallet/longTaskMaxDuration: -32%
  • ↓ onboardingNewWallet/tbt: -91%
  • ↓ onboardingNewWallet/total: -68%
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: -59%
  • ↓ dappPageLoad/domContentLoaded: -17%
  • ↓ dappPageLoad/firstPaint: -42%
  • ↓ dappPageLoad/firstContentfulPaint: -42%
Bundle Size Diffs [🚨 Warning! Bundle size has increased!]
Status Bundle Total Diff Change
🚨 background 15.18 MiB +1.91 KiB +0.01%
🚨 ui 19.16 MiB +1.45 KiB +0.01%
✅ common 0 Bytes 0 Bytes 0.00%
✅ other 4.46 MiB 0 Bytes 0.00%
✅ content scripts 3.19 MiB 0 Bytes 0.00%
🚨 unzipped 79.49 MiB +3.36 KiB 0.00%
✅ zip 23.92 MiB +876 Bytes 0.00%

@sonarqubecloud

Copy link
Copy Markdown

Copilot AI 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.

🟢 Approval recommended

No active review issues were identified for the per-key storage diagnostics changes.

No open issues 🎉

What changed in this PR

Adds per-key storage diagnostics to MetaMask’s persistence failure reports, helping diagnose split-state read and write failures without retaining stored values.

Changes:

  • Reports manifest status and readable, missing, or failed keys.
  • Attaches diagnostics as Sentry extras while preserving existing error messages, tags, and fingerprints; skips probes for browser shutdown and successful-read missing-vault recovery.
  • Adds unit coverage for diagnostic outcomes, reporting, and probe failures.
File Description
shared/​lib/​stores/​persistence-manager.ts Attaches diagnostic results to persistence error reports.
shared/​lib/​stores/​persistence-manager.test.ts Tests report extras, probe failures, and excluded recovery paths.
shared/​lib/​stores/​extension-store.ts Reads the manifest and classifies each listed key independently.
shared/​lib/​stores/​extension-store.test.ts Tests manifest handling and per-key outcomes without retaining values.
shared/​lib/​stores/​base-store.ts Defines diagnostic result types and an optional store method.

Review effort: Balanced

@gauthierpetetin
gauthierpetetin marked this pull request as ready for review November 17, 2026 13:11
@github-project-automation github-project-automation Bot moved this to Needs dev review in PR review queue Nov 17, 2026
@gauthierpetetin gauthierpetetin self-assigned this Nov 17, 2026

@Battambang Battambang 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.

There are 3 SonarCloud issues that might be considered but non blocking.

@github-project-automation github-project-automation Bot moved this from Needs dev review to Review finalised - Ready to be merged in PR review queue Nov 17, 2026
@gauthierpetetin
gauthierpetetin added this pull request to the merge queue Nov 17, 2026
Merged via the queue into main with commit 4ea0794 Nov 17, 2026
272 of 274 checks passed
@gauthierpetetin
gauthierpetetin deleted the feat/mwpe-319-split-state-read-diagnostics branch November 17, 2026 21:11
@github-project-automation github-project-automation Bot moved this from Review finalised - Ready to be merged to Merged, Closed or Archived in PR review queue Nov 17, 2026
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 17, 2026

This branch was previously deployed

1 inactive deployment
pr-comment — e9b9f125 Deployed Nov 17, 2026 by gauthierpetetin via identify-codeowners #90517
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

size-M team-extension-platform Extension Platform team

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants