feat: add limit/pagination to gauntletruns endpoint (#146) #160
No reviewers
Labels
No Label
ai-changes-requested
ai-failed
ai-merged
ai-pr-opened
ai-reviewed
ai-reviewing
ai-reviewing
ai-working
bug
enhancement
evolution
performance
phase-0
phase-1a
phase-1b
phase-1c
phase-1d
security
tech-debt
todo
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-database#160
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "issue/146-feat-add-limit-pagination-to-gauntletruns-endpoint"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #146
Adds
limitquery parameter (default 100, max 500) toGET /api/v2/gauntletruns.Changes
limit: int = 100parameter toget_gauntletruns()max(0, min(limit, 500))— guards negative values and upper bound.limit()applied after all filters, so both result set and count remain consistent with existing patternFiles changed
app/routers_v2/gauntletruns.pyReview: feat: add limit/pagination to gauntletruns endpoint (#146)
LGTM — correct implementation. One notable behavioral difference from the prior 9 paginated endpoints worth flagging.
✅ Correct
limit: int = 100withmax(0, min(limit, 500))— guards both negative values and upper bound, identical pattern to PRs #157/#159.limit()placement in the for loop is clean and correctMINOR —
countis now total (pre-limit), not limited countIn all 9 prior paginated endpoints,
countreflects the limited count (the queryset was.limit()-d before.count()was called). In this PR the order is reversed:Result:
count= total matching records;len(runs)≤ limit. This is actually more useful for pagination callers (they know the total), but it creates an inconsistency — callers of the other 9 paginated endpoints will observecount == len(items), while callers of this one will observecount >= len(runs)whenever the full result set exceeds the limit.Non-blocking (the behavior is arguably an improvement), but worth noting the inconsistency. If there's ever a push to standardise the
countfield across all paginated endpoints, this one is already ahead of the curve.MINOR —
limit: intvslimit: Optional[int]Same cosmetic inconsistency noted across the series — some endpoints use
Optional[int], others use plainint. Both work identically in FastAPI. Non-blocking.MINOR —
limit=0returns emptymax(0, min(0, 500))→ 0 → empty response even when records exist. Same pedantic edge case as all prior pagination PRs. Non-blocking.Approved — reviewer confirmed no blockers. Merging.
5ce6e03f9atodafa5bfd22dafa5bfd22to8638d67ac48638d67ac4to0ebc26305a0ebc26305atoe7fcf611da