fix: remove broken live_update_batting stub endpoint (#10) #54
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
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-database#54
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/paper-dynasty-database#10"
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
Removes the completely broken
POST /api/v2/scouting/live-update/battingendpoint.Root cause
The endpoint iterated over
files.vl_basicwhich is astr(a filename like"vl-basic.csv"), not parsed CSV data. This caused the loop to iterate over individual characters. The body also contained onlypasswith TODO comments and no running stats logic — the endpoint would never produce a valid result.Fix
live_update_battingendpoint entirelycsv_file_to_dataframehelper codeBattingFilesmodel (still used bylive_update_pitching)Files changed
app/routers_v2/scouting.pyTest results
No test suite. Verified by reading back the modified file.
Other observations
live_update_pitching(POST /api/v2/scouting/live-update/pitching) is also a stub — it acceptsBattingFiles(not a pitching model) and simply returns the input unchanged. Not fixing here as it's out of scope.AI Code Review
Files Reviewed
app/routers_v2/scouting.py(modified)Findings
Correctness
live_update_battingremoval is accurate and well-motivated.files.vl_basicis typed asstr(a filename), so iterating over it yields individual characters — the loop logic was fundamentally broken. The body was also entirelypasswith TODO comments, making this endpoint a no-op.BattingFilesmodel is correctly retained; it is still referenced bylive_update_pitching.csv_file_to_dataframecommented block is cleanly removed.live_update_battingelsewhere in the file.Security
live_update_pitchingstill logs the bearer token in plaintext (logging.warning(f"Bad Token: {token}")), but this is a pre-existing issue being addressed separately in PR #55, and is out of scope here.Style & Conventions
logging.basicConfig,APIRoutercondensed to one line). These are not mentioned in the PR body. The changes are harmless and consistent, but unrelated to the stated fix.Suggestions
live_update_pitchingacceptsBattingFiles(a batting model) — worth a follow-up issue to give it a proper pitching model once that endpoint is implemented.Verdict: APPROVED
The core change is correct: the endpoint was irreparably broken and removal is the right call. Retained model, removed dead code, no regressions introduced. The cosmetic reformatting is harmless.
Automated review by Claude PR Reviewer (self-approval blocked by Gitea — verdict is APPROVED)
AI Code Review
Files Reviewed
app/routers_v2/scouting.py(modified)Findings
Correctness
live_update_battingendpoint is cleanly removed. The root cause described in the PR body is accurate:files.vl_basicis astr(filename), sofor row in files.vl_basiciterates over individual characters — the endpoint was fundamentally broken and could never produce valid output.csv_file_to_dataframeblock is correctly removed.BattingFilesmodel is retained — still required bylive_update_pitching. Correct.live_update_pitchingis also a stub but out of scope. Appropriate scope discipline.Security
fix: use constant-time comparison for bearer token validation), which also patchedlive_update_pitchingin this file — changinglogging.warning(f'Bad Token: {token}')to'Bad Token: [REDACTED]'. The currentnext-releasehas the redacted version; this PR branch does not. The PR is currently unmergeable (mergeable: false) due to this conflict. When resolving the conflict, the security fix from #56 must be preserved — do not reintroduce token logging inlive_update_pitching.Style & Conventions
Suggestions
Verdict: COMMENT
The removal is correct and well-justified. The PR cannot merge in its current state due to a conflict with
next-release(introduced by #56 touching the same file). Resolve the conflict carefully to preserve the[REDACTED]token logging fix already innext-release.Automated review by Claude PR Reviewer
03cea0d96fto7b494faa99