Skip to content

refactor: rename initModularizedControllers to initMessengerClients and update result properties#28645

Merged
cryptodev-2s merged 5 commits into
mainfrom
rename-init-modularized-controllers-to-init-messenger-clients
Apr 13, 2026
Merged

refactor: rename initModularizedControllers to initMessengerClients and update result properties#28645
cryptodev-2s merged 5 commits into
mainfrom
rename-init-modularized-controllers-to-init-messenger-clients

Conversation

@cryptodev-2s
Copy link
Copy Markdown
Contributor

@cryptodev-2s cryptodev-2s commented Apr 10, 2026

Description

Rename initModularizedControllers to initMessengerClients, drop existingControllersByName, rename controllerInitFunctions to initFunctions, and update return type to messengerClientsByName. Update all consumers in Engine.ts, utils.test.ts, and test utility functions.

80 files changed. PR 3 of 4 — depends on PR 2 (#28641).

Relates to WPC-916.

Changelog

CHANGELOG entry: null

Related issues

Fixes: https://consensyssoftware.atlassian.net/browse/WPC-916

Manual testing steps

Feature: Messenger client init system

  Scenario: App builds and runs normally
    Given the app is built from this branch

    When user opens the app
    Then the app behaves identically to main (no runtime behavior change)

Screenshots/Recordings

N/A — no UI changes.

Before

N/A

After

N/A

Pre-merge author checklist

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

Note

Medium Risk
Refactors the Engine’s initialization wiring for all controller/messenger clients, so mistakes could break startup order or dependency resolution despite being a rename-focused change.

Overview
Renames and reshapes the Engine init helper by replacing initModularizedControllers with initMessengerClients, renaming controllerInitFunctions to initFunctions, and returning messengerClientsByName.

Simplifies initialization state by dropping support for existingControllersByName and updating the dependency lookup helper/error messaging to getMessengerClientOrThrow.

Updates Engine.ts wiring and a large set of controller init tests to use the new request mock helper (buildMessengerClientInitRequestMock) and the new result property names.

Reviewed by Cursor Bugbot for commit 80bf6e1. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-core-platform Core Platform team label Apr 10, 2026
@cryptodev-2s cryptodev-2s force-pushed the rename-controller-messengers-to-messenger-factories branch from d94c76a to 56cc68e Compare April 10, 2026 13:43
Base automatically changed from rename-controller-messengers-to-messenger-factories to main April 10, 2026 18:22
@cryptodev-2s cryptodev-2s force-pushed the rename-init-modularized-controllers-to-init-messenger-clients branch from 13768ee to 6f60b10 Compare April 11, 2026 07:16
@cryptodev-2s cryptodev-2s marked this pull request as ready for review April 11, 2026 07:17
@cryptodev-2s cryptodev-2s requested review from a team as code owners April 11, 2026 07:17
@cryptodev-2s cryptodev-2s force-pushed the rename-init-modularized-controllers-to-init-messenger-clients branch from 6f60b10 to 8522bad Compare April 13, 2026 08:55
@github-actions github-actions Bot added the risk-medium Moderate testing recommended · Possible bug introduction risk label Apr 13, 2026
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.17%. Comparing base (9f195d0) to head (8522bad).
⚠️ Report is 32 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #28645      +/-   ##
==========================================
+ Coverage   82.14%   82.17%   +0.02%     
==========================================
  Files        4949     4967      +18     
  Lines      130070   130768     +698     
  Branches    29004    29168     +164     
==========================================
+ Hits       106851   107462     +611     
- Misses      15923    15977      +54     
- Partials     7296     7329      +33     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread app/core/Engine/controllers/accounts-controller/index.test.ts Outdated
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 13, 2026
wachunei
wachunei previously approved these changes Apr 13, 2026
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 13, 2026
@cryptodev-2s cryptodev-2s requested a review from wachunei April 13, 2026 14:24
@github-actions github-actions Bot added risk-medium Moderate testing recommended · Possible bug introduction risk and removed risk-medium Moderate testing recommended · Possible bug introduction risk labels Apr 13, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeAccounts, SmokeConfirmations, SmokeNetworkAbstractions, SmokeNetworkExpansion, SmokeTrade, SmokeWalletPlatform, SmokeIdentity, SmokeRamps, SmokeMultiChainAPI, SmokePredictions, SmokePerps, SmokeSeedlessOnboarding, FlaskBuildTests
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 82%
click to see 🤖 AI reasoning details

E2E Test Selection:
This PR is a pure refactoring/renaming of the Engine's controller initialization infrastructure:

  1. Scope: 82 files changed, all within app/core/Engine/ - the core Engine initialization system
  2. Nature: Terminology rename from "controller" to "messenger client" throughout:
    • initModularizedControllersinitMessengerClients
    • controllersByNamemessengerClientsByName
    • controllerInitFunctionsinitFunctions
    • buildControllerInitRequestMockbuildMessengerClientInitRequestMock
    • getControllerOrThrowgetMessengerClientOrThrow
  3. Behavioral change: Removed existingControllersByName parameter from InitMessengerClientsFunctionRequest interface; the function now manages its own internal partialMessengerClientsByName state instead of accepting pre-existing controllers externally
  4. Impact: Engine.ts is the central initialization point for ALL controllers (AccountsController, TransactionController, NetworkController, SignatureController, PerpsController, PredictController, SeedlessOnboardingController, etc.) - every feature in the app depends on these being initialized correctly

Why broad coverage: Although this is a rename/refactor, the Engine initialization is the foundation of the entire app. Any subtle bug introduced during this refactoring (e.g., the removal of existingControllersByName changing initialization order or dependency resolution) could break any feature. The conservative approach is to run all smoke test suites to verify the app still functions correctly end-to-end.

Why not high risk: The changes are purely cosmetic renames with no algorithmic changes to the initialization logic itself. The unit tests have been updated to match. The removal of existingControlgersByName is reflected in the updated test that removed the 'not throws when existing controller is found' test case.

Performance Test Selection:
This PR is a pure refactoring/renaming of internal Engine initialization code. No UI components, rendering logic, data loading patterns, or performance-sensitive code paths were changed. The rename from 'controller' to 'messenger client' terminology does not affect runtime performance characteristics. No performance tests are warranted.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

@github-actions
Copy link
Copy Markdown
Contributor

E2E Fixture Validation — Schema is up to date
11 value mismatches detected (expected — fixture represents an existing user).
View details

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.74.0 Issue or pull request that will be included in release 7.74.0 risk-medium Moderate testing recommended · Possible bug introduction risk size-L team-core-platform Core Platform team

Projects

None yet

Development

Successfully merging this pull request may close these issues.