hotfix: remove output caps from GET /players #103
No reviewers
Labels
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/major-domo-database#103
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "hotfix/remove-players-output-caps"
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?
Summary
MAX_LIMIT(500) andDEFAULT_LIMIT(200) caps fromGET /api/v3/players— bot and website consumers need full player lists without paginationlimitparam toOptional[int] = Query(default=None, ge=1)(no ceiling)Context
The caps added in #99 (
16f3f8d) fixed Gunicorn worker timeouts from unbounded queries across all list endpoints. However, the/playersendpoint is a known bounded dataset (~1500 rows/season) and its consumers depend on fetching complete lists. This hotfix exempts it while keeping protections everywhere else.Test plan
test_player_service.py— allget_playerstests pass (10/10)test_query_limits.py— all 5 tests pass (they test/decisions, not/players)GET /playersaccepts uncapped requests without 422🤖 Generated with Claude Code
AI Code Review
Files Reviewed
app/routers_v3/players.py(modified)Findings
Correctness
MAX_LIMIT/DEFAULT_LIMITimports (no longer referenced) and revertslimittoOptional[int] = Query(default=None, ge=1).PlayerService.get_players()already acceptslimit: Optional[int] = Noneand branches correctly at lines 144/150:if limit is not None: query = query.limit(limit). Solimit=None(the new default) returns the full unbounded result set as intended.total_countis computed pre-pagination at the service layer (query.count()before.limit()is applied), so the responsecount/totalfields remain semantically correct.ge=1constraint is preserved — callers passinglimit=0still get a 422.search_playersendpoint retains its own explicitle=50cap — unrelated, unchanged, correct.Security
ge=1guard prevents degenerate inputs. The only theoretical concern is an uncapped largelimit=Nquery, but the PR body's rationale is sound: the players table is bounded (~1500 rows/season), so even alimit=999999request returns at most ~1500 rows — no meaningful DoS vector.Style & Conventions
Optional[int] = Query(default=None, ge=1)is the correct FastAPI idiom for an optional positive integer param with no ceiling.Suggestions
Verdict: COMMENT
(Gitea blocks self-approval.) Clean, minimal hotfix. The service layer handles
limit=Nonecorrectly, the players dataset is bounded, and the import cleanup leaves no dead imports. Ready to merge.Automated review by Claude PR Reviewer