Fix an N+1 in one endpoint or resolver
One endpoint issuing a query per row, fixed with a query-count test that fails against the old code.
The ticket
Remove the N+1 query pattern from one endpoint or resolver.
Acceptance criteria
- A test asserts the number of queries issued
- That test fails against the current code
- Results are identical before and after
- The fix batches or joins rather than caching over the top
What lands as proof
A query-count assertion, which is the only test that actually catches an N+1 coming back.
Why teams defer it
- It is invisible on a development dataset and quadratic on a real one.
- Without query-count instrumentation there is nothing to assert, so the fix has no guard.
Questions
- What does the agent actually change?
- The ticket is scoped to one outcome: remove the N+1 query pattern from one endpoint or resolver. Work that serves that outcome is in scope, and anything outside it is left for a separate ticket, so the pull request stays reviewable.
- How do I know the work is done?
- The pull request carries the evidence, not only the diff. Here that means query-count test that fails against the old code, so a reviewer can confirm the result without reproducing the work locally.
- How much oversight does this need?
- None is required before the run starts. Every claim this ticket makes can be checked by machine, so the agent works straight through and a person reviews the finished pull request like any other.