Skip to content

Conversation

@mikesposito
Copy link
Member

@mikesposito mikesposito commented Sep 24, 2025

Explanation

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 ComposableController to @metamask/messenger, updates types/metadata, rewrites tests, and updates dependencies and docs.

  • @metamask/composable-controller:
    • Migrate from RestrictedMessenger to Messenger (@metamask/messenger) and @metamask/base-controller/next APIs.
    • Update types: add ComposableControllerActions/GetState, refine ChildControllerStateChangeEvents, and redefine ComposableControllerMessenger to use Messenger.
    • Replace anonymous metadata with includeInDebugSnapshot; keep persist, includeInStateLogs, usedInUi.
    • Use messenger.subscribe for child stateChange events with error handling; minor cleanup.
    • Tests: rewrite to new messenger API and delegation; add case for failed subscription; remove allowlist-dependent cases.
    • Add dependency @metamask/messenger; update TS project references.
    • Changelog: document breaking changes and a typing fix.
  • Docs/Graph:
    • Add composable_controller --> messenger; add eip_7702_internal_rpc_middleware --> controller_utils in README mermaid graph.
  • Tooling:
    • Adjust ESLint warning thresholds; update lockfile.

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

@mikesposito mikesposito mentioned this pull request Sep 24, 2025
43 tasks
@MajorLift
Copy link
Contributor

Resolving the type errors revealed this runtime breaking change in the unit tests:
https://github.com/MetaMask/core/actions/runs/18690961760/job/53296361842?pr=6904

MajorLift and others added 5 commits October 21, 2025 19:23
## Explanation

<!--
Thanks for your contribution! Take a moment to answer these questions so
that reviewers have the information they need to properly understand
your changes:

* What is the current state of things and why does it need to change?
* What is the solution your changes offer and how does it work?
* Are there any changes whose purpose might not obvious to those
unfamiliar with the domain?
* If your primary goal was to update one package but you found you had
to update another one along the way, why did you do so?
* If you had to upgrade a dependency, why did you do so?
-->


- Fix incompatibility of `ChildControllerStateChangeEvents` type with
`BaseController` (when used in the `Events` type argument of
`ComposableControllerMessenger`) by removing unnecessary nested logic
from definition.
- Update generic parameter names `ControllerName` and `ControllerState`
to `ChildControllerName`, `ChildControllerState` for reduced ambiguity.

## References

<!--
Are there any issues that this pull request is tied to?
Are there other links that reviewers should consult to understand these
changes better?
Are there client or consumer pull requests to adopt any breaking
changes?

For example:

* Fixes #12345
* Related to #67890
-->

- Branches from #6710

## 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](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs),
highlighting breaking changes as necessary
- [ ] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Simplifies `ChildControllerStateChangeEvents` and types the messenger
`subscribe` call to fix `ComposableController` Messenger type errors;
updates changelog.
> 
> - **Composable Controller**:
> - **Types**: Simplify `ChildControllerStateChangeEvents` by removing
nested conditional logic and renaming generics to
`ChildControllerName`/`ChildControllerState`.
> - **Messenger**: Type the `subscribe` call for child `stateChange`
events, updating composed state with the received child state (with an
inline ts-expect-error to bypass an unnecessary overload constraint).
> - **Docs**:
> - Update `packages/composable-controller/CHANGELOG.md` with a Fixed
entry describing the type compatibility change.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
b3444fb. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
@mikesposito mikesposito marked this pull request as ready for review October 21, 2025 17:49
@mikesposito mikesposito requested a review from a team as a code owner October 21, 2025 17:49
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

The test didn't actually rely upon subscriptions being setup correctly, so this
mistake didn't impact the test result. It was only testing the constructor.

The mistake has still been updated to avoid confusion.
Copy link
Contributor

@cryptodev-2s cryptodev-2s left a comment

Choose a reason for hiding this comment

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

LGTM!

@mikesposito mikesposito added this pull request to the merge queue Oct 27, 2025
@FrederikBolding FrederikBolding removed this pull request from the merge queue due to the queue being cleared Oct 27, 2025
@mikesposito mikesposito added this pull request to the merge queue Oct 27, 2025
Merged via the queue into main with commit cfdd5e7 Oct 27, 2025
256 of 257 checks passed
@mikesposito mikesposito deleted the mikesposito/messenger/composable-controller branch October 27, 2025 11:26
Gudahtt added a commit that referenced this pull request Oct 27, 2025
The `INVALID_CONTROLLER_ERROR` error message incorrectly referenced the
property name `messagingSystem`, which is no longer used in the next version of
the `BaseController` class (which the `ComposableController` switched to in
the PR `#6710).

The error message was updated to no mention the messenger instance variable at
all, since the check that triggered the error doesn't look for it anyway.
Gudahtt added a commit that referenced this pull request Oct 27, 2025
The `INVALID_CONTROLLER_ERROR` error message incorrectly referenced the
property name `messagingSystem`, which is no longer used in the next version of
the `BaseController` class (which the `ComposableController` switched to in
the PR `#6710).

The error message was updated to no mention the messenger instance variable at
all, since the check that triggered the error doesn't look for it anyway.
github-merge-queue bot pushed a commit that referenced this pull request Oct 27, 2025
## Explanation

The `INVALID_CONTROLLER_ERROR` error message incorrectly referenced the
property name `messagingSystem`, which is no longer used in the next
version of the `BaseController` class (which the `ComposableController`
switched to in the PR #6710).

The error message was updated to no mention the messenger instance
variable at all, since the check that triggered the error doesn't look
for it anyway.

## References

Fixes minor error introduced by #6710

## 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

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> Update `INVALID_CONTROLLER_ERROR` to remove obsolete `messagingSystem`
reference, stating only that controllers must inherit from
`BaseController`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
05b6cb3. This will update automatically
on new commits. Configure
[here](https://cursor.com/dashboard?tab=bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to 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.

5 participants