Skip to content

Conversation

@cryptodev-2s
Copy link
Contributor

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

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-2s cryptodev-2s self-assigned this Sep 9, 2025
@cryptodev-2s cryptodev-2s requested review from a team as code owners September 9, 2025 16:31
@cryptodev-2s cryptodev-2s mentioned this pull request Sep 9, 2025
43 tasks
@cryptodev-2s cryptodev-2s force-pushed the cryptodev-2s/messenger/permission-controller branch from f9a357f to 94c5e2b Compare September 9, 2025 16:32
@cryptodev-2s cryptodev-2s changed the title refactor: migrate {Permission,SubjectMetadata}Controller to `@metamask/messenger refactor: migrate {Permission,SubjectMetadata}Controller to @metamask/messenger Sep 9, 2025
@cryptodev-2s cryptodev-2s force-pushed the cryptodev-2s/messenger/permission-controller branch from 94c5e2b to 84146fc Compare September 9, 2025 16:39
mcmire
mcmire previously approved these changes Sep 10, 2025
@cryptodev-2s cryptodev-2s force-pushed the cryptodev-2s/messenger/permission-controller branch from 84146fc to 7ebeb14 Compare October 7, 2025 10:46
@cryptodev-2s cryptodev-2s requested a review from a team as a code owner October 7, 2025 10:46
mcmire
mcmire previously approved these changes Oct 7, 2025
Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

LGTM!

@FrederikBolding FrederikBolding added this pull request to the merge queue Oct 27, 2025
Merged via the queue into main with commit 6b51645 Oct 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 free to 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.

6 participants