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
From architecture review candidate #3 (recommendation: Worth exploring). Captured for triage.
Problem
listMessagesServerFnin themessagesmodule 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
Relationships
wontfix; if EntityRegistry slice 3 — rewire messages through the registry (all content types) #9 only swapped table lookup but left the 330-line structure, this is the follow-up to actually split it.