MetaMask / MetaMask/core

[composable-controller] Implement type validation of constructor options

Open
#4,213 5 comments 0 reactions 0 assignees View on GitHub
bug team-wallet-framework wf-bugs
Dominant language
TypeScript
Stars
413
Forks
308
Avg merge
1d 4h
Merged PRs (30d)
253

Description

## Requirements

When initializing a `ComposableController` class, given a `ComposableControllerState` type:

1. A type error should be raised if the list of child controllers specified in the `controllers` array constructor option does not exactly match the list of controllers included in the `ComposableControllerState` type.

2. A type error should be raised if the controller-messenger instance passed into the `messenger` constructor option has an event allowlist that does not include all of the `stateChange` events for the list of controllers in the `ComposableControllerState` type.

## References

- Follows from https://github.com/MetaMask/core/issues/3627

Contributor guide

No contributing guide indexed for this repository

Research direction

Locate the ComposableController, ComposableControllerState, and constructor validation or test entry points in the repository. Review how controllers and messenger event allowlists are represented, then add coverage for mismatches with the state type and missing stateChange events. Done means both invalid constructor options raise type errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.