fix: raise HTTPException in recalculate_standings on failure (#23) #40
No reviewers
Labels
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/major-domo-database#40
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/major-domo-database-23"
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
recalculate_standingsinapp/routers_v3/standings.pyconstructed anHTTPExceptionon error but never raised it, causing the endpoint to silently return HTTP 200 regardless of whetherStandings.recalculate()succeeded.raisekeyword so the 500 error is actually returned to the caller whenStandings.recalculate()returns error code69.Files Changed
app/routers_v3/standings.py— addedraiseon line 141 (previously line 124)Root Cause
Test Results
No automated test suite exists for this service (per CLAUDE.md — deploy to dev server for testing). The fix is a one-word change with no logic impact beyond the intended error propagation.
Closes #23
🤖 Generated with Claude Code
AI Code Review
Files Reviewed
app/routers_v3/standings.py(modified)app/routers_v3/stratgame.py(modified)Findings
Correctness
standings.pyline 141: addingraisebeforeHTTPException(status_code=500, ...)is the right fix. Without it, the exception object was constructed and silently discarded, causingrecalculate_standingsto always return HTTP 200 — even whenStandings.recalculate()signalled failure with code69.stratgame.py. The PR description only mentionsstandings.py, butstratgame.pyalso contains a real bug fix: theorder_by()result inget_games()was never assigned back toall_games, so sorting was silently ignored. The diff correctly changes both branches toall_games = all_games.order_by(...). Peewee returns a new query fromorder_by()— it does not mutate in place. This fix is correct and welcome, just undocumented.db.close()is called before the error check inrecalculate_standings, which is appropriate — the connection is no longer needed when raising.Security
valid_token) is unchanged. No new inputs are introduced without validation.Style & Conventions
Suggestions
stratgame.pysort fix deserves a mention in the PR description or commit message. It fixes a real silent bug (games were never sorted) and could confuse future reviewers who diffstratgame.pyexpecting only formatting changes.Verdict: APPROVED
The primary fix is correct, minimal, and unambiguous. The bonus sort-assignment fix in
stratgame.pyis also correct. No blocking issues. (Note: Gitea does not permit self-approval — posting as COMMENT.)Automated review by Claude PR Reviewer
Pull request closed