Skip to content

feat: Migrate controller guidelines and examples to new Messenger - #6335

Merged
mikesposito merged 17 commits into
mainfrom
messenger-migrate-controller-docs
Oct 27, 2025
Merged

feat: Migrate controller guidelines and examples to new Messenger#6335
mikesposito merged 17 commits into
mainfrom
messenger-migrate-controller-docs

Conversation

@Gudahtt

@GudahttGudahtt commented Aug 19, 2025

Copy link
Copy Markdown
Member

Explanation

Migrate the controller guidelines and the sample-controllers package to the next export of the @metamask/base-controller package and the new Messenger class from @metamask/messenger.

References

Relates to #5626

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

Note

Migrate controller docs and sample-controllers to the new @metamask/messenger Messenger and @metamask/base-controller/next, updating APIs, metadata, tests, and dependencies.

  • Docs
    • Rewrite guidelines and data-services to use @metamask/messengerMessenger instead of RestrictedMessenger; update examples for actions/events typing, root/child messenger setup, delegation, and selector utilities (MessengerActions/MessengerEvents).
    • Replace references to “messaging system” with “messenger”; update code samples to messenger.call/subscribe/publish/registerMethodActionHandlers.
  • Sample Controllers (@metamask/sample-controllers)
    • Migrate to @metamask/base-controller/next and @metamask/messenger.
    • Replace messagingSystem.* with messenger.*; update controller/service messenger types to Messenger<...> and constructor usage.
    • Update state metadata (anonymousincludeInDebugSnapshot).
    • Revise tests to use new Messenger, mock namespace utilities, and MessengerActions/MessengerEvents.
    • Add dependency on @metamask/messenger; update TS project references.
    • Changelog: mark BREAKING changes for Messenger migration and metadata rename.
  • Repo/README
    • Dependency graph: add sample_controllers --> messenger; add middleware/controller edge; list @metamask/messenger package.

Written by Cursor Bugbot for commit c1ad7a4. This will update automatically on new commits. Configure here.

@Gudahtt
Gudahttforce-pushed the messenger-migrate-controller-docs branch 2 times, most recently from 815bf50 to 39756caCompareAugust 19, 2025 18:05
@Gudahtt
Gudahttforce-pushed the messenger-migrate-base-controller branch 2 times, most recently from ae71891 to 67c7853CompareAugust 20, 2025 14:04
Base automatically changed from messenger-migrate-base-controller to mainAugust 20, 2025 14:10
@Gudahtt
Gudahttforce-pushed the messenger-migrate-controller-docs branch 4 times, most recently from 0a1a16b to 0bdc3d1CompareAugust 20, 2025 15:58
@Gudahtt
Gudahtt marked this pull request as ready for review August 20, 2025 15:58
@Gudahtt
Gudahtt requested a review from a team as a code ownerAugust 20, 2025 15:58
@Gudahtt
Gudahttforce-pushed the messenger-migrate-controller-docs branch from 0bdc3d1 to 7bbe29cCompareAugust 20, 2025 17:25
cursor[bot]

This comment was marked as outdated.

@Gudahtt

This comment was marked as resolved.

Gudahtt added a commit that referenced this pull request Aug 21, 2025
Tests that used the `@metamask/base-controller/next` export were not
working correctly until after a build was completed. They were using
the built code rather than the source code. On CI the tests run without
any build, so they would always fail.
This was resolved up updating the TSConfig and Jest config to map the
`next` export to the correct source code.
This unblocks #6335 as well as other controller migrations to the
upcoming BaseController version.
Gudahtt added a commit that referenced this pull request Aug 21, 2025
…6349)
## Explanation
Tests that used the `@metamask/base-controller/next` export were not
working correctly until after a build was completed. They were using the
built code rather than the source code. On CI the tests run without any
build, so they would always fail.
This was resolved up updating the TSConfig and Jest config to map the
`next` export to the correct source code.
This unblocks #6335 as well as other controller migrations to the
upcoming BaseController version.
## References
Relates to #5626
## Checklist
- [x] I've updated the test suite for new or updated code as appropriate
- [x] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [x] I've communicated my changes to consumers by [updating changelogs
for packages I've
changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs),
highlighting breaking changes as necessary
- [x] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
@Gudahtt
Gudahttforce-pushed the messenger-migrate-controller-docs branch 2 times, most recently from c4836ce to d669a35CompareAugust 21, 2025 16:43
@Gudahtt

Copy link
Copy Markdown
MemberAuthor

Rebased to resolve conflict (the messenger package publish)

@GudahttGudahtt mentioned this pull request Jul 17, 2025
43 tasks

@mcmiremcmire left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Had some minor comments, but overall these changes make sense.

Comment threadpackages/sample-controllers/src/sample-gas-prices-controller.test.ts Outdated
Comment threaddocs/controller-guidelines.md Outdated
Comment threaddocs/controller-guidelines.md Outdated
Comment threaddocs/controller-guidelines.md
Comment threaddocs/controller-guidelines.md Outdated
Comment threaddocs/controller-guidelines.md Outdated
Comment threaddocs/controller-guidelines.md Outdated
Comment threaddocs/controller-guidelines.md Outdated
@Gudahtt
Gudahttforce-pushed the messenger-migrate-controller-docs branch 2 times, most recently from 0f4215d to 5d451a9CompareAugust 28, 2025 16:50
@Gudahtt
Gudahttforce-pushed the messenger-migrate-controller-docs branch from efa167b to 80d7730CompareOctober 21, 2025 20:57
@socket-security

socket-securityBot commented Oct 21, 2025

Copy link
Copy Markdown

No dependency changes detected. Learn more about Socket for GitHub.

👍 No dependency changes detected in pull request

mcmire
mcmire previously approved these changes Oct 21, 2025

@mcmiremcmire left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM!

cryptodev-2s
cryptodev-2s previously approved these changes Oct 21, 2025

@cryptodev-2scryptodev-2s left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

@mikesposito

Copy link
Copy Markdown
Member

nit: we should run yarn update-readme-content to refresh the README dependency graph

@mikesposito
mikesposito dismissed stale reviews from cryptodev-2s and mcmire via f8360c3October 24, 2025 17:43
@mikesposito
mikesposito added this pull request to the merge queueOct 27, 2025
Merged via the queue into main with commit a607066Oct 27, 2025
256 of 257 checks passed
@mikesposito
mikesposito deleted the messenger-migrate-controller-docs branch October 27, 2025 13:18
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@Gudahtt@mikesposito@mcmire@cryptodev-2s