Skip to content

refactor: migrate {Permission,SubjectMetadata}Controller to @metamask/messenger - #6537

Merged
FrederikBolding merged 6 commits into
mainfrom
cryptodev-2s/messenger/permission-controller
Oct 27, 2025
Merged

refactor: migrate {Permission,SubjectMetadata}Controller to @metamask/messenger#6537
FrederikBolding merged 6 commits into
mainfrom
cryptodev-2s/messenger/permission-controller

Conversation

@cryptodev-2s

@cryptodev-2scryptodev-2s commented Sep 9, 2025

Copy link
Copy Markdown
Contributor

Explanation

This PR migrates PermissionController and SubjectMetadataController to the new @metamask/messenger message bus, as opposed to the one exported from @metamask/base-controller.

References

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

Migrates PermissionController and SubjectMetadataController to the new @metamask/messenger API and renames the state metadata flag from anonymous to includeInDebugSnapshot.

  • BREAKING:
    • Replace RestrictedMessenger (from @metamask/base-controller) with new Messenger (from @metamask/messenger) across packages/permission-controller.
    • Rename state metadata property anonymous to includeInDebugSnapshot.
  • PermissionController (src/PermissionController.ts, src/Permission.ts):
    • Update types (PermissionControllerMessenger, SideEffectMessenger, SideEffectParams.messenger).
    • Replace messagingSystem with messenger; switch to registerActionHandler/messenger.call throughout.
    • Adjust validators and side-effects to use new messenger; minor JSDoc/typo fixes.
  • SubjectMetadataController (src/SubjectMetadataController.ts):
    • Migrate to new Messenger; update action registration; update state metadata flag.
  • Tests (PermissionController.test.ts, SubjectMetadataController.test.ts):
    • Refactor to construct root messenger and delegate actions; update imports to @metamask/base-controller/next and new messenger types.
  • Package/Config:
    • Add dependency @metamask/messenger@^0.3.0; add TS project references; update README dependency graph to include messenger and new edges; adjust ESLint thresholds; update lockfile.

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

@cryptodev-2scryptodev-2s self-assigned this Sep 9, 2025
@cryptodev-2s
cryptodev-2s requested review from a team as code ownersSeptember 9, 2025 16:31
@cryptodev-2scryptodev-2s mentioned this pull request Sep 9, 2025
43 tasks
@cryptodev-2s
cryptodev-2sforce-pushed the cryptodev-2s/messenger/permission-controller branch from f9a357f to 94c5e2bCompareSeptember 9, 2025 16:32
@cryptodev-2scryptodev-2s changed the title refactor: migrate {Permission,SubjectMetadata}Controller to `@metamask/messengerrefactor: migrate {Permission,SubjectMetadata}Controller to @metamask/messengerSep 9, 2025
@cryptodev-2s
cryptodev-2sforce-pushed the cryptodev-2s/messenger/permission-controller branch from 94c5e2b to 84146fcCompareSeptember 9, 2025 16:39
mcmire
mcmire previously approved these changes Sep 10, 2025
@cryptodev-2s
cryptodev-2sforce-pushed the cryptodev-2s/messenger/permission-controller branch from 84146fc to 7ebeb14CompareOctober 7, 2025 10:46
@cryptodev-2s
cryptodev-2s requested a review from a team as a code ownerOctober 7, 2025 10:46
mcmire
mcmire previously approved these changes Oct 7, 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!

Comment threadpackages/permission-controller/src/Permission.ts
Comment threadpackages/permission-controller/src/Caveat.ts
Comment threadpackages/permission-controller/src/permission-middleware.ts
Comment threadpackages/permission-controller/src/permission-middleware.ts
@FrederikBolding
FrederikBolding added this pull request to the merge queueOct 27, 2025
Merged via the queue into main with commit 6b51645Oct 27, 2025
258 of 259 checks passed
@FrederikBolding
FrederikBolding deleted the cryptodev-2s/messenger/permission-controller branch October 27, 2025 12:29
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@cryptodev-2s@mcmire@FrederikBolding@Mrtenz@mikesposito