EventQuery is a 15-field struct translated into dynamic SQL via manual QueryBuilder logic (~300 lines in query_events_on and count_events_on in event.rs). The translation has grown organically with conditionals for filter combinations. Extracting query-building into a builder pattern with unit-testable SQL generation (without hitting Postgres) would improve maintainability as filter complexity grows. Priority: Low — not broken but increasingly fragile.
🤖 AI review update (2026-08-23)
Reframe this around shared predicate generation and validation rather than a public fluent builder. EventQuery already represents filter input; the maintainability risk is duplicated conditional SQL between query/count paths. Extract pure validation plus a shared predicate applicator where SQLx lifetimes allow, and test SQL shape alongside Postgres-backed semantic cases.
EventQueryis a 15-field struct translated into dynamic SQL via manualQueryBuilderlogic (~300 lines inquery_events_onandcount_events_oninevent.rs). The translation has grown organically with conditionals for filter combinations. Extracting query-building into a builder pattern with unit-testable SQL generation (without hitting Postgres) would improve maintainability as filter complexity grows. Priority: Low — not broken but increasingly fragile.🤖 AI review update (2026-08-23)
Reframe this around shared predicate generation and validation rather than a public fluent builder. EventQuery already represents filter input; the maintainability risk is duplicated conditional SQL between query/count paths. Extract pure validation plus a shared predicate applicator where SQLx lifetimes allow, and test SQL shape alongside Postgres-backed semantic cases.