bug: GET /refractor/cards returns count: null with very large limit #183
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#183
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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?
Description
GET /api/v2/refractor/cards?team_id=31&limit=99999returns{"count": null, "items": []}instead of returning the full result set or capping at a max limit.Negative limits correctly return 422, but excessively large limits produce a response with
count: nulland an empty items array.Steps to Reproduce
Actual:
{"count": null, "items": []}Expected: Either cap at the server-side max (e.g. 100) and return results, or return a 422 validation error
Impact
Low — the bot uses reasonable limit values, but the API contract should be consistent.
countshould always be an integer.Found during REF-API integration testing (2026-04-06).
Fixed in PR #185.
Root cause: Peewee 3.17.9 returns
Nonefrom.count()on a complex multi-join query (RefractorCardState → RefractorTrack → Player via LEFT JOIN) when 0 rows match. Addedor 0guard:total = query.count() or 0.Note: the
limit: int = Query(ge=1, le=100)constraint was already in place —limit=99999would return 422. The guard ensurescountis always an integer regardless of filter combination.