fix(api): scouting endpoints return 200 on auth failure, breaking Google Sheets clients #213
Labels
No Label
ai-changes-requested
ai-failed
ai-merged
ai-pr-opened
ai-reviewed
ai-reviewing
ai-working
autonomous
bug
enhancement
evolution
performance
phase-0
phase-1a
phase-1b
phase-1c
phase-1d
security
size:M
size:S
tech-debt
todo
type:feature
type:stability
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-database#213
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?
Problem
The
/api/v2/battingcardratings/scoutingand/api/v2/pitchingcardratings/scoutingendpoints return HTTP 200 even when the auth/guide gate fails. The failure body is a plain text string:Google Sheets clients consuming these endpoints as CSV treat the 200 as success and try to parse the error string as CSV data, producing confusing downstream errors ("team does not have the guide") even when
has_guide=true.Repro (real incident)
Team 100 (Gauntlet-EXW, "Exploding Whales") had
has_guide=truebut got the error. Root cause was a staletshash in the sheet after ansnamerename —team_hash()is derived fromsname[-1]andsname[-2], so any rename invalidates cached hashes.GET /api/v2/battingcardratings/scouting?team_id=100&ts=s67402603023w11135396893→ 200 (with error string body)s67402603023e11135396893s67402603023w11135396893Fix
In
database/app/routers_v2/battingcardratings.pyanddatabase/app/routers_v2/pitchingcardratings.py, theget_card_scoutinghandlers shouldraise HTTPException(status_code=403, detail=...)on gate failure instead of returning the message as a 200 response body.Current (battingcardratings.py:329)
Desired
Apply the same change to
pitchingcardratings.py.Acceptance
/scoutingendpoints return 403 (not 200) on gate failurePR #214 fixes this. Both
/scoutingendpoints nowraise HTTPException(status_code=403, ...)instead ofreturn-ing the error string as a 200 body.HTTPExceptionwas already imported — minimal two-line change per file.