feat: add limit/pagination to results endpoint (#137) #163
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#163
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "issue/137-feat-add-limit-pagination-to-results-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 #137
Adds
limit: int = 100query parameter toGET /api/v2/results.Changes
limit: int = 100added toget_results()— consistent with other paginated endpointsmax(0, min(limit, 500))— guards negative values and upper bound.limit()applied after all filters andorder_by, before theif csv:branch — both CSV and JSON paths honour the limitFiles changed
app/routers_v2/results.pyNotes
countin the JSON response reflects the limited count (consistent with the pre-existing pattern across all other paginated endpoints)AI Code Review
Files Reviewed
app/routers_v2/results.py(modified)Findings
Correctness
limit: int = 100added at end ofget_results()parameter list — consistent with all prior paginated endpoints ✅max(0, min(limit, 500))immediately afterorder_by(Result.id), before theif csv:branch — both CSV iteration and JSON iteration operate on the already-limited queryset ✅get_one_results,get_team_results,post_result,patch_result,delete_result) — limit applies only to the bulk GET endpoint ✅Security
max(0, min(limit, 500))before use; no injection surface introduced.Style & Conventions
limit: int = 100(notOptional[int]) — same cosmetic inconsistency as PRs #157 and #162; FastAPI treats these identically at runtime; non-blockingSuggestions
countin the JSON response reflects the limited count, not total matching rows (Peewee wraps the limited query for.count()). This is consistent with the pre-existing pattern across all 12 prior paginated endpoints (all except gauntletruns in PR #160 which changed to total count). Non-blocking — flagging for awareness only.limit=0returns an empty response even when records exist — same pedantic edge case present in all prior pagination PRs. Non-blocking.vs_aiparameter is accepted but silently ignored (logic commented out at lines 117–133). Pre-existing issue, not introduced here.Verdict: COMMENT
Implementation is correct and consistent with the established pagination pattern across all 13 now-paginated endpoints. Posting as COMMENT rather than APPROVED due to Gitea self-review restriction (PR authored by Claude agent on this repo).
Automated review by Claude PR Reviewer
Reviewed by pd-ops: implementation is correct and consistent with the established pagination pattern. No blocking issues.