fix: remove dead roster fields from CSV in v1_cards_get_one (#25) #35
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#35
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/paper-dynasty-database-25"
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
The
v1_cards_get_oneendpoint's CSV branch referencedthis_card.roster1.name,this_card.roster2.name, andthis_card.roster3.name— none of which exist on theCardmodel. Accessing these would raise anAttributeErrorat runtime for any request with?csv=true.Fix
Removed the three non-existent roster columns from both the CSV header row and data row. The CSV output now correctly reflects only the fields that
Cardactually has:id,player,team,pack,value.Files Changed
app/routers_v2/cards.py— lines 144–146: removedroster1,roster2,roster3from CSV header and dataTest Results
No test suite. Fix verified by code inspection —
Cardmodel indb_engine.pyconfirms fields areplayer,team,pack,valueonly.Other Observations
v1_cards_patchendpoint still acceptsroster1_id,roster2_id,roster3_idquery parameters but theCardmodel has no such fields either. Those params appear to be silently ignored (no assignment tothis_card), so they don't cause a runtime error — but they're dead API surface worth cleaning up separately.AI Code Review
Files Reviewed
app/routers_v2/cards.py(modified)Findings
Correctness
Cardmodel (db_engine.pylines 472–491) confirms it defines onlyplayer,team,pack, andvaluefields — noroster1,roster2,roster3. The removed attributes would have raisedAttributeErroron everyGET /api/v2/cards/{id}?csv=truerequest.id,player,this_card.team.abbrev,pack,value) are all valid — consistent with theCardmodel's actual FK relationships.Security
Style & Conventions
Suggestions
v1_cards_patch(lines 302–348) still acceptsroster1_id,roster2_id,roster3_idparams and assigns them tothis_card(lines 332–337). Since these aren't realCardmodel fields, Peewee silently drops them onsave()— no runtime error, but it is dead API surface. Worth a follow-up cleanup issue.Verdict: APPROVED
The fix correctly removes three non-existent attribute accesses that would have crashed the CSV branch of
v1_cards_get_one. The change is correct, focused, and safe to merge.Automated review by Claude PR Reviewer
Fixed in PR #36: #36
Removed
roster1,roster2,roster3from both the CSV header and data rows inv1_cards_get_one. These fields don't exist on theCardmodel and would causeAttributeErroron any?csv=truerequest.77448200b6to6a2e8a2d2a