MetaMask / MetaMask/metamask-extension

[State Sync Redesign 3.11] Update state logs and debug tools

Open
#40,048 0 comments 0 reactions 0 assignees View on GitHub
INVALID-ISSUE-TEMPLATE team-extension-platform
Dominant language
TypeScript
Stars
13.2k
Forks
5.6k
Avg merge
2d 5h
Merged PRs (30d)
451

Description

"Download State Logs" in Settings is a user-facing debug tool used by support teams. The exported format must remain usable.

Current consumers:
- `getCleanAppState(store)` returns `{ ...store.getState(), metamask: { ...state.metamask, socialLoginEmail: undefined } }`
- `getLogs` reads `reduxState.metamask.logs`
- `logStateString` (bound to `window.logStateString`) calls both
- E2E tests read state via `window.stateHooks.getCleanAppState()`
- E2E `errors.spec.ts` asserts `extra.appState.state.metamask.participateInMetaMetrics`

## Steps

1. Update `getCleanAppState` to build state from `ControllerStateManager` snapshots (controller-keyed output)
2. Update `getLogs` to read from `ControllerStateManager.getSnapshot('LoggingController').logs`
3. Update `global.metamask` API (`updateCurrentLocale`, `setFeatureFlag`)
4. Update E2E test assertions that read `state.metamask` from `getCleanAppState` — update to controller-keyed paths
5. Update E2E `errors.spec.ts` Sentry payload assertion
6. Update integration test preloaded state (`test/data/integration-init-state.json`, notification test mocks)
7. **Decision:** Should state logs output remain flat (add a flattening shim for backward compat with support workflows) or switch to controller-keyed? If flat, add `ControllerStateManager.getFlatSnapshot()` utility.

## Files

- `ui/index.js`
- `test/e2e/helpers.js`
- `test/e2e/tests/metrics/errors.spec.ts`
- `test/data/integration-init-state.json`
- `test/integration/notifications&auth/`

## Risk

**Medium** — changing state logs format may affect support workflows. E2E test updates are mechanical but numerous.

## Dependencies

Issue 3.10 (Sentry update)

## Context

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

Contributor guide

Open the contributing guide

Research direction

Start by tracing ControllerStateManager usage across ui/index.js and test/e2e/helpers.js, then inspect the metrics errors test and integration state fixtures listed in the issue. Determine whether support workflows require flat logs or can use controller-keyed output, then update the APIs, assertions, mocks, and snapshots consistently and run the affected E2E and integration tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
frontend, testing
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.