Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor base-controller for type safety and better application of controller-messenger pattern #2061

Closed
MajorLift opened this issue Nov 17, 2023 · 1 comment
Labels

Comments

@MajorLift
Copy link
Contributor

MajorLift commented Nov 17, 2023

Motivation

The BaseController, ControllerMessenger, and RestrictedControllerMessenger classes outline the controller-messenger pattern that are implemented by all of our controllers.

However, these classes are currently limited by incomplete or unsafe typing, and weak enforcement of best practices. A rigorous overhaul of the types and methods defined in base-controller, along with updates to enable more accurate allowlisting of action and events, will unlock type-safe feature development for all of our clients and services.

These changes remove blockers for updating controllers to use BaseControllerV2, while completely deprecating BaseControllerV1. This affects all controllers slated to be consolidated and migrated into the core repo.

Tasks

  • Fix all any usage.
    • ActionConstraint, ExtractActionParameters, ExtractActionResponse
    • SelectorFunction, EventSubscriptionMap
  • Improve handling of namespaced type names.
  • getState action and stateChange event are defined in the base controller.
  • Enforce sound practices around action/event allow lists.
    • All internal actions/events are available for usage without being specified in an allow list.
    • Internal actions/events are not accepted into allow lists when a restricted controller-messenger is being initialized.
@MajorLift MajorLift changed the title Overhaul base-controller for type safety and better application of controller-messenger pattern Refactor base-controller for type safety and better application of controller-messenger pattern Nov 17, 2023
@MajorLift
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant