Skip to content

Conversation

@mikesposito
Copy link
Member

@mikesposito mikesposito commented Jan 28, 2026

Explanation

This is a proposal for refactors of changes made in #7668. Specifically, it removes the dependency on KeyringController:getState, and removes the now unnecessary init() method. destroy() is also being removed, as we usually don't manage controller disposal.
Tests have been updated accordingly.

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
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Removes the runtime dependency on KeyringController:getState and simplifies polling lifecycle management.

  • Controller now subscribes to KeyringController:unlock/KeyringController:lock in the constructor to start/stop polling; init() and destroy() (and their handlers) are removed
  • Replaces direct feature-flag state typing with RemoteFeatureFlagControllerGetStateAction
  • Tests updated: remove KeyringController:getState usage and init/destroy cases, simplify messenger typings and delegation

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

@mikesposito mikesposito requested a review from a team as a code owner January 28, 2026 16:55
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 2 potential issues.

'RemoteFeatureFlagController:getState',
mockRemoteFeatureFlagGetState,
);
testRootMessenger.registerActionHandler(
Copy link

Choose a reason for hiding this comment

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

Delegating action without registered handler in test

Low Severity

The PR removed the registerActionHandler call for KeyringController:getState but left 'KeyringController:getState' in the delegate actions array at line 495. This creates inconsistent test code where an action is delegated without a corresponding handler being registered. While this won't cause test failures (since the controller no longer calls this action), it's dead code that was likely an oversight during the refactor.

Fix in Cursor Fix in Web

Copy link
Member Author

@mikesposito mikesposito Jan 28, 2026

Choose a reason for hiding this comment

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

I noticed these additional things to be removed in tests, but I also wanted to refactor the way some tests use the testRootMessenger, so I left them for another PR where I will propose a more broad refactor of root messenger usage in tests.

}
this.messenger.subscribe('KeyringController:lock', () =>
this.stopPolling(),
);
Copy link

Choose a reason for hiding this comment

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

Polling never starts if keyring already unlocked

High Severity

The removal of init() creates a scenario where polling never starts. The controller now only starts polling when KeyringController:unlock event fires, but if the keyring is already unlocked at construction time (e.g., app restart with wallet unlocked), no unlock event fires and startPolling() is never called. The old init() method checked KeyringController:getState to detect this and start polling appropriately. Without it, the controller may silently fail to fetch config data.

Fix in Cursor Fix in Web

Copy link
Member Author

Choose a reason for hiding this comment

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

The wallet is guaranteed to be locked on initialization, so this is not an issue

@mikesposito mikesposito merged commit 464d78b into feat/add-config-registry-controller Jan 29, 2026
303 of 304 checks passed
@mikesposito mikesposito deleted the mikesposito/refactor/config-registry-controller branch January 29, 2026 12:44
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.

3 participants