Skip to content

Extract Channel Provider Construction into a Factory #7

@Escoto

Description

@Escoto

Description

The main function contains a ~140-line match block (lines 118-257) that constructs each channel provider. Every arm follows the exact same pattern:

  1. Build a temporary provider with a dummy SecurityGate
  2. Call resolve_users
  3. Build the real provider with the resolved gate
  4. Log registration
  5. Push into provider_arcs

Each new channel kind added will copy-paste this boilerplate, increasing the risk of subtle divergence between arms.

Recommendation:

Extract a ChannelProvider factory method (e.g., channel::build(ch_config, workspace, global_output) -> Result<Arc<dyn ChannelProvider>>) that encapsulates the two-phase construction. Each provider module can expose a build() or implement a ChannelProviderFactory trait that hides the temporary-provider + resolve + real-provider dance.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions