Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Refactor initialisation of Snaps controllers #30034

Draft
wants to merge 19 commits into
base: main
Choose a base branch
from

Conversation

Mrtenz
Copy link
Member

@Mrtenz Mrtenz commented Jan 31, 2025

Description

This refactors the initialisation of Snaps-related controllers to follow the pattern introduced in #28948.

Open in GitHub Codespaces

Related issues

Closes #30032.

Manual testing steps

  1. Go to this page...

Screenshots/Recordings

Before

After

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.

@Mrtenz Mrtenz added the team-snaps-platform Snaps Platform team label Jan 31, 2025
Mrtenz added a commit to MetaMask/snaps that referenced this pull request Jan 31, 2025
`SnapController`'s name was set to `string` rather than
`"SnapController"`, which causes some problems with type inference in
MetaMask/metamask-extension#30034.
@Mrtenz Mrtenz force-pushed the mrtenz/refactor-snaps-controllers-init branch from 56cf332 to 1dcd71a Compare February 3, 2025 10:56
@Mrtenz Mrtenz marked this pull request as ready for review February 3, 2025 11:21
@Mrtenz Mrtenz requested a review from a team as a code owner February 3, 2025 11:21
@metamaskbot
Copy link
Collaborator

Builds ready [bcd2967]
Page Load Metrics (1840 ± 92 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint21222571773399192
domContentLoaded15412196181118287
load15512261184019292
domInteractive2410042209
backgroundConnect8115323014
firstReactRender1697432814
getState588212311
initialActions01000
loadScripts10551635131316278
setupStore75913115
uiStartup181729242140298143
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 9.29 KiB (0.16%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@metamaskbot
Copy link
Collaborator

Builds ready [3cfc768]
Page Load Metrics (1739 ± 61 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint36319991604418201
domContentLoaded15381957171312259
load15492003173912661
domInteractive2596422010
backgroundConnect889292411
firstReactRender1597362613
getState589222512
initialActions01000
loadScripts10661506124412158
setupStore869222211
uiStartup17692605201118890
Bundle size diffs [🚨 Warning! Bundle size has increased!]
  • background: 9.29 KiB (0.16%)
  • ui: 0 Bytes (0.00%)
  • common: 0 Bytes (0.00%)

@Mrtenz Mrtenz changed the base branch from main to fb/snaps-bump-v87 February 3, 2025 14:08
@Mrtenz Mrtenz force-pushed the mrtenz/refactor-snaps-controllers-init branch from 3cfc768 to 430f2e8 Compare February 3, 2025 14:09
SnapInsightsControllerMessenger
> = ({ controllerMessenger, persistedState }) => {
const controller = new SnapInsightsController({
// @ts-expect-error: `persistedState.SnapInsightsController` is not
Copy link
Member

Choose a reason for hiding this comment

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

Somewhat worrying that all of these types don't match, any ideas why?

@metamaskbot
Copy link
Collaborator

Builds ready [b068d1d]
Page Load Metrics (1546 ± 43 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint1369171315468842
domContentLoaded1363170215258239
load1368171415468943
domInteractive22112412411
backgroundConnect873252110
firstReactRender15101272412
getState467202010
initialActions01000
loadScripts958123611057033
setupStore66413147
uiStartup15652125176812460

@Mrtenz Mrtenz force-pushed the mrtenz/refactor-snaps-controllers-init branch from 6699f5f to 35fe54f Compare February 4, 2025 10:55
@Mrtenz Mrtenz requested review from a team as code owners February 4, 2025 10:55
Copy link
Contributor

github-actions bot commented Feb 4, 2025

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.

@Mrtenz Mrtenz force-pushed the mrtenz/refactor-snaps-controllers-init branch from 35fe54f to 5ae3d12 Compare February 4, 2025 10:56
@Mrtenz Mrtenz marked this pull request as draft February 4, 2025 10:57
@Mrtenz Mrtenz removed the request for review from a team February 4, 2025 10:57
Copy link

socket-security bot commented Feb 4, 2025

Updated dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@metamask/[email protected] 🔁 npm/@metamask/[email protected] None 0 62.4 kB metamaskbot

View full report↗︎

Copy link

socket-security bot commented Feb 4, 2025

👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎

This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored.

View full report↗︎

@Mrtenz Mrtenz force-pushed the mrtenz/refactor-snaps-controllers-init branch 2 times, most recently from 55bbf3d to 11d0475 Compare February 4, 2025 11:01
@Mrtenz
Copy link
Member Author

Mrtenz commented Feb 4, 2025

@metamaskbot update-policies

@metamaskbot
Copy link
Collaborator

Policies updated.
👀 Please review the diff for suspicious new powers.

🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff

Copy link
Member Author

Choose a reason for hiding this comment

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

These changes are expected, as bumping @metamask/rate-limit-controller made it possible to dedupe some versions. It does not add any new capabilities to @metamask/rate-limit-controller.

Base automatically changed from fb/snaps-bump-v87 to main February 4, 2025 12:42
@Mrtenz Mrtenz force-pushed the mrtenz/refactor-snaps-controllers-init branch from 8c3471b to 24deb57 Compare February 4, 2025 13:30
@Mrtenz Mrtenz force-pushed the mrtenz/refactor-snaps-controllers-init branch from 24deb57 to 5a9ea5a Compare February 4, 2025 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
team-snaps-platform Snaps Platform team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Refactor Snaps controllers to use new controller initialisation pattern
6 participants