Skip to content

Split the listMessages monolith into a registry-driven dispatcher #18

Description

@jrnxf

This was generated by AI during triage.

From architecture review candidate #3 (recommendation: Worth exploring). Captured for triage.

Problem

listMessagesServerFn in the messages module is a ~330-line function with 7 type branches of 60–80 lines each. Query construction is trapped inside conditionals, so it can only be tested end-to-end through a mocked DB — the interface is not the test surface.

Proposed solution

With the registry in place, the per-type branches collapse into one registry-driven query builder. Any type that genuinely needs bespoke logic gets its own listXxxMessages() behind the same dispatcher interface.

Benefits

  • Each query path becomes independently testable.
  • The dispatcher shrinks to a lookup; reviewers see new-entity wiring at a glance.

Relationships

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds-triageMaintainer needs to evaluate

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions