MetaMask / MetaMask/metamask-extension

The `Backup` class should take messengers instead of controller references

Open
#33,661 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

### What is this about?

We want to reduce coupling between different pieces of the platform, and the messaging system is our tool to do this. Currently, the `Backup` class receives direct references to controllers. While this is not egregious, it does misalign with how we make use of controllers in other places, such as other controllers in general. We should have it take controller _messengers_ rather than the instances themselves.

When the [messenger delegation ADR](https://github.com/MetaMask/decisions/pull/53) is complete, we might also consider turning `Backup` into a service class and having it take a single messenger, and then delegating `:getState` actions from all of the input controllers to that messenger.

### Scenario

_No response_

### Design

_No response_

### Technical Details

_No response_

### Threat Modeling Framework

_No response_

### Acceptance Criteria

_No response_

### Stakeholder review needed before the work gets merged

- [ ] Engineering (needed in most cases)
- [ ] Design
- [ ] Product
- [ ] QA (automation tests are required to pass before merging PRs but not all changes are covered by automation tests - please review if QA is needed beyond automation tests)
- [ ] Security
- [ ] Legal
- [ ] Marketing
- [ ] Management (please specify)
- [ ] Other (please specify)

### References

_No response_

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 by locating the Backup class and the controller references it currently receives, then read the messenger delegation ADR linked in the issue. Trace how the relevant controller messengers expose the needed actions; done means Backup accepts messengers instead of controller instances while preserving its existing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend-api-design
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.