MetaMask / MetaMask/metamask-extension

[State Sync Redesign 3.10] Update Sentry state capture chain

Open
#40,047 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

INVALID-ISSUE-TEMPLATE team-extension-platform
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

The Sentry error reporting chain reads state.metamask at multiple points. Must be updated before the slice is removed, or production error visibility is lost.

Current chain:

ui/index.js: getSentryAppState → maskObject(store.getState(), SENTRY_UI_STATE)
app/scripts/constants/sentry-state.ts: SENTRY_UI_STATE = { metamask: flattenedBackgroundStateMask }
app/scripts/lib/setupSentry.js: getMetaMetricsEnabledFromAppState → appState.state.metamask.participateInMetaMetrics
app/scripts/lib/setup-initial-state-hooks.js: wires getSentryState pre- and post-init

Steps

  1. Update getSentryAppState in ui/index.js to build state from ControllerStateManager snapshots + Redux (non-metamask slices)
  2. Update SENTRY_UI_STATE mask in sentry-state.ts to use controller-keyed shape (aligning with the background's SENTRY_BACKGROUND_STATE which is already controller-keyed)
  3. Update getMetaMetricsEnabledFromAppState in setupSentry.js to read from controller-keyed path (MetaMetricsController.participateInMetaMetrics)
  4. Update setup-initial-state-hooks.js wiring
  5. Validate: trigger a Sentry error in dev, confirm the masked state payload is correct

Files

  • ui/index.js
  • app/scripts/constants/sentry-state.ts
  • app/scripts/lib/setupSentry.js
  • app/scripts/lib/setup-initial-state-hooks.js

Risk

High — if Sentry breaks, we lose production error visibility. Must be validated before and after slice removal.

Dependencies

Issue 3.9 (dual-write removed, but Sentry update can start during dual-write phase)

Context

Part of [State Sync Redesign — Epic 3: UI-controller subscriptions].

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with getSentryAppState in ui/index.js, then compare sentry-state.ts with the controller-keyed SENTRY_BACKGROUND_STATE. Trace the MetaMetrics lookup in setupSentry.js and the wiring in setup-initial-state-hooks.js. Done means the four files use controller-keyed state and a dev Sentry error shows the correct masked payload before and after slice removal.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend, observability
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.