Skip to content

test: llm use route registry for screen detection - #47730

Merged
seaona merged 3 commits into
mainfrom
fix-mm-cli-unknown-screen-detection
Nov 10, 2026
Merged

seaona merged 3 commits into
mainfrom
fix-mm-cli-unknown-screen-detection

Conversation

@seaona

@seaona seaona commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Description

mm describe-screen returned currentScreen: unknown for main routes like #/activity and #/account-list. Screen detection relied on a hand-written list of URL matchers in state-inspector.ts, so every route had to be added to mm-cli by hand. Each unknown also ran a slow (2 s) page-object probe.
Now that the route registry (#47691) is merged, screen detection uses it directly:

  • Adds matchRoute() to test/e2e/route-registry. It ranks routes the same way the extension router does.
  • currentScreen is derived from the matched route path, for example /account-list → account-list and /settings/privacy → settings-privacy. Unknown sub-paths fall back to their closest parent route.
  • Locked/unlocked screens are derived from the registry instead of hardcoded lists.
  • SCREEN_CHECKS (the page-object load checks used by launch and self-onboarding) is keyed by route constants and trimmed to the four screens those flows wait on.

New routes are picked up automatically. The registry test already enforces that every route in ROUTES is registered.
Some screen names change, for example onboarding-complete → onboarding-completion and swap → cross-chain-swaps-prepare-bridge-page. They aren't used outside llm-workflow.

Changelog

CHANGELOG entry:

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/AIENG-282

Manual testing steps

  1. Build the extension (yarn build:test) and run yarn mm launch.
  2. Unlock the wallet.
  3. Go to #/account-list and run yarn mm describe-screen. Verify currentScreen is account-list and isUnlocked is true.
  4. Repeat for #/settings/privacy (expect settings-privacy), #/send (expect send) and #/ (expect home).
  5. Run yarn mm cleanup.

Screenshots/Recordings

Before

After

mm-describe.mov

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
Changes are confined to Playwright LLM/e2e test helpers and screen naming for mm describe-screen; no production wallet or auth logic is modified.

Overview
LLM workflow screen detection no longer relies on a hand-maintained URL matcher list. It now uses the e2e route registry and a new matchRoute() helper (react-router-style matching) so paths like #/activity and #/account-list resolve correctly instead of unknown (which triggered slow page-object probes).

currentScreen is derived from the matched route via getScreenName (e.g. /settings/privacy → settings-privacy); unknown nested hash paths fall back to the closest parent route. ScreenName is now a documented string rather than a fixed union. Locked/unlocked classification is computed from registry routes aligned with unauthenticated UI routes, not hardcoded screen sets.

SCREEN_CHECKS and launch/self-onboarding waits are keyed by route constants and narrowed to the four DOM checks those flows need. Tests cover matchRoute, URL detection, and onboarding flows updated to assert on routes instead of legacy screen literals (some reported names change, e.g. onboarding-complete → onboarding-completion).

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

@metamask-ci

metamask-ci Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor
Builds ready [bc7032a] [reused from 58e30f8]
⚡ Performance Benchmarks (Total: 🟢 7 pass · 🟡 3 warn · 🔴 3 fail)

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

Metricschrome-webpackfirefox-webpack
loadNewAccount
[Sentry log · main/release]
🔴 load_new_account(p95) [CI log]🔴 load_new_account(p95) [CI log]
onboardingImportWallet
[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: +183%
  • ↑ loadNewAccount/total: +183%
  • ↓ loadNewAccount/inp: -18%
  • ↑ loadNewAccount/lcp: +949%
  • ↑ loadNewAccount/cls: +573%
  • ↑ confirmTx/longTaskCount: +67%
  • ↑ confirmTx/longTaskTotalDuration: +77%
  • ↑ confirmTx/longTaskMaxDuration: +58%
  • ↑ confirmTx/tbt: +88%
  • ↓ confirmTx/inp: -13%
  • ↑ confirmTx/fcp: +11%
  • ↑ confirmTx/lcp: +1020%
  • ↓ confirmTx/cls: -14%
  • ↑ bridgeUserActions/bridge_load_page: +120%
  • ↑ bridgeUserActions/bridge_load_asset_picker: +24%
  • ↑ bridgeUserActions/longTaskCount: +36%
  • ↑ bridgeUserActions/longTaskTotalDuration: +92%
  • ↑ bridgeUserActions/longTaskMaxDuration: +66%
  • ↑ bridgeUserActions/tbt: +182%
  • ↑ bridgeUserActions/total: +14%
  • ↑ bridgeUserActions/lcp: +977%
  • ↑ bridgeUserActions/cls: +621%
  • ↑ loadNewAccount/load_new_account: +185%
  • ↑ loadNewAccount/total: +185%
  • ↓ loadNewAccount/inp: -10%
  • ↓ loadNewAccount/fcp: -30%
  • ↑ loadNewAccount/lcp: +1288%
  • ↓ confirmTx/longTaskCount: -100%
  • ↓ confirmTx/longTaskTotalDuration: -100%
  • ↓ confirmTx/longTaskMaxDuration: -100%
  • ↓ confirmTx/tbt: -100%
  • ↓ confirmTx/inp: -21%
  • ↑ confirmTx/fcp: +16%
  • ↑ confirmTx/lcp: +1314%
  • ↑ bridgeUserActions/bridge_load_page: +249%
  • ↑ bridgeUserActions/bridge_load_asset_picker: +87%
  • ↑ bridgeUserActions/bridge_search_token: +24%
  • ↓ bridgeUserActions/longTaskCount: -100%
  • ↓ bridgeUserActions/longTaskTotalDuration: -100%
  • ↓ bridgeUserActions/longTaskMaxDuration: -100%
  • ↓ bridgeUserActions/tbt: -100%
  • ↑ bridgeUserActions/total: +64%
  • ↑ bridgeUserActions/inp: +54%
  • ↓ bridgeUserActions/fcp: -37%
  • ↑ bridgeUserActions/lcp: +1239%

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

  • 🟡 loadNewAccount/FCP: p75 1.9s
  • 🟡 confirmTx/FCP: p75 1.9s
  • 🟡 bridgeUserActions/FCP: p75 1.9s
  • 🟡 confirmTx/FCP: p75 2.0s
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: +86%
  • ↑ startupStandardHome/load: +120%
  • ↑ startupStandardHome/domContentLoaded: +121%
  • ↑ startupStandardHome/domInteractive: +18%
  • ↓ startupStandardHome/firstPaint: -55%
  • ↓ startupStandardHome/firstReactRender: -98%
  • ↓ startupStandardHome/initialActions: -29%
  • ↑ startupStandardHome/loadScripts: +119%
  • ↑ startupStandardHome/setupStore: +101%
  • ↑ startupStandardHome/longTaskCount: +43%
  • ↑ startupStandardHome/longTaskTotalDuration: +118%
  • ↑ startupStandardHome/longTaskMaxDuration: +132%
  • ↑ startupStandardHome/tbt: +141%
  • ↓ startupStandardHome/inp: -11%
  • ↓ startupStandardHome/fcp: -57%
  • ↑ startupStandardHome/lcp: +93%
  • ↓ startupStandardHome/cls: -72%
  • ↓ startupStandardHome/domInteractive: -43%
  • ↑ startupStandardHome/backgroundConnect: +11%
  • ↓ startupStandardHome/firstReactRender: -98%
  • ↓ startupStandardHome/initialActions: -50%
  • ↓ startupStandardHome/fcp: -36%
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]

📈 Results compared to the previous 5 runs on main

  • ↑ onboardingImportWallet/srpButtonToSrpForm: +20%
  • ↑ onboardingImportWallet/confirmSrpToPwForm: +35%
  • ↑ onboardingImportWallet/pwFormToMetricsScreen: +53%
  • ↑ onboardingImportWallet/metricsToWalletReadyScreen: +20%
  • ↓ onboardingImportWallet/doneButtonToHomeScreen: -92%
  • ↓ onboardingImportWallet/openAccountMenuToAccountListLoaded: -73%
  • ↓ onboardingImportWallet/longTaskCount: -100%
  • ↓ onboardingImportWallet/longTaskTotalDuration: -100%
  • ↓ onboardingImportWallet/longTaskMaxDuration: -100%
  • ↓ onboardingImportWallet/tbt: -100%
  • ↓ onboardingImportWallet/total: -85%
  • ↓ onboardingNewWallet/createWalletToSocialScreen: -11%
  • ↑ onboardingNewWallet/createPwToRecoveryScreen: +25%
  • ↑ onboardingNewWallet/skipBackupToMetricsScreen: +15%
  • ↓ onboardingNewWallet/doneButtonToAssetList: -75%
  • ↓ onboardingNewWallet/longTaskCount: -62%
  • ↓ onboardingNewWallet/longTaskTotalDuration: -74%
  • ↓ onboardingNewWallet/longTaskMaxDuration: -37%
  • ↓ onboardingNewWallet/tbt: -100%
  • ↓ onboardingNewWallet/total: -70%
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: -66%
  • ↓ dappPageLoad/domContentLoaded: -30%
  • ↓ dappPageLoad/firstPaint: -47%
  • ↓ dappPageLoad/firstContentfulPaint: -47%
Bundle Size Diffs
Status Bundle Total Diff Change
✅ background 15.26 MiB 0 Bytes 0.00%
✅ ui 19.42 MiB 0 Bytes 0.00%
✅ common 0 Bytes 0 Bytes 0.00%
✅ other 4.46 MiB 0 Bytes 0.00%
✅ content scripts 3.23 MiB 0 Bytes 0.00%
✅ unzipped 79.77 MiB 0 Bytes 0.00%
✅ zip 23.86 MiB 0 Bytes 0.00%

@seaona
seaona marked this pull request as ready for review November 9, 2026 14:01
@seaona seaona self-assigned this Nov 9, 2026
@seaona seaona added the no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed label Nov 9, 2026
cryptotavares
cryptotavares previously approved these changes Nov 9, 2026
@metamask-ci

metamask-ci Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor
Builds ready [a2bc197] [reused from b151b6f]
⚡ Performance Benchmarks (Total: 🟢 2 pass · 🟡 0 warn · 🔴 2 fail)

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

Metricschrome-webpackfirefox-webpack
onboardingImportWallet
[Sentry log · main/release]
🟢 [CI log]🔴 [CI log]
onboardingNewWallet
[Sentry log · main/release]
🟢 [CI log]🔴 [CI log]

Regressions (🔴 2 failures)

Interaction Benchmarks · Samples: 5

⚠️ Missing data: chrome/webpack/interactionUserActions, firefox/webpack/interactionUserActions

✅ No regressions detected

Startup Benchmarks · Samples: 100

⚠️ Missing data: chrome/webpack/startupStandardHome, firefox/webpack/startupStandardHome

✅ No regressions detected

User Journey Benchmarks · Samples: 5 · mock API 🔴 2
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: -12%
  • ↓ onboardingImportWallet/metricsToWalletReadyScreen: -24%
  • ↓ onboardingImportWallet/doneButtonToHomeScreen: -92%
  • ↓ onboardingImportWallet/openAccountMenuToAccountListLoaded: -74%
  • ↓ onboardingImportWallet/longTaskCount: -100%
  • ↓ onboardingImportWallet/longTaskTotalDuration: -100%
  • ↓ onboardingImportWallet/longTaskMaxDuration: -100%
  • ↓ onboardingImportWallet/tbt: -100%
  • ↓ onboardingImportWallet/total: -85%
  • ↓ onboardingNewWallet/agreeButtonToOnboardingSuccess: -22%
  • ↓ onboardingNewWallet/doneButtonToAssetList: -78%
  • ↓ onboardingNewWallet/longTaskCount: -100%
  • ↓ onboardingNewWallet/longTaskTotalDuration: -100%
  • ↓ onboardingNewWallet/longTaskMaxDuration: -100%
  • ↓ onboardingNewWallet/tbt: -100%
  • ↓ onboardingNewWallet/total: -74%
Dapp Page Load Benchmarks · Samples: 100

⚠️ Missing data: chrome/webpack/pageLoadBenchmark

✅ No regressions detected

Bundle Size Diffs
Status Bundle Total Diff Change
✅ background 15.24 MiB 0 Bytes 0.00%
✅ ui 19.44 MiB 0 Bytes 0.00%
✅ common 0 Bytes 0 Bytes 0.00%
✅ other 4.46 MiB 0 Bytes 0.00%
✅ content scripts 3.23 MiB 0 Bytes 0.00%
✅ unzipped 79.87 MiB 0 Bytes 0.00%
✅ zip 23.96 MiB 0 Bytes 0.00%

@sonarqubecloud

sonarqubecloud Bot commented Nov 9, 2026

Copy link
Copy Markdown

@seaona
seaona enabled auto-merge November 10, 2026 08:47
@seaona seaona added no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed and removed no-changelog no-changelog Indicates no external facing user changes, therefore no changelog documentation needed labels Nov 10, 2026
@seaona
seaona added this pull request to the merge queue Nov 10, 2026
Merged via the queue into main with commit 794d367 Nov 10, 2026
120 checks passed
@seaona
seaona deleted the fix-mm-cli-unknown-screen-detection branch November 10, 2026 09:49
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 10, 2026
@metamaskbot metamaskbot added the release-13.58.0 Issue or pull request that will be included in release 13.58.0 label Nov 16, 2026

This branch was previously deployed

1 inactive deployment
pr-comment — a2bc1971 Deployed Nov 9, 2026 by seaona via Publish prerelease / Publish prerelease #173569
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.58.0 Issue or pull request that will be included in release 13.58.0 size-L team-qa QA team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants