fix: remove dead roster fields from CSV in v1_cards_get_one (#35) #36
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#36
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/paper-dynasty-database#35"
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 non-existent
roster1,roster2,roster3columns from the CSV output inv1_cards_get_one. Accessingthis_card.roster1.nameetc. would raiseAttributeErrorat runtime for anyGET /api/v2/cards/{card_id}?csv=truerequest.Files Changed
app/routers_v2/cards.py— removedroster1,roster2,roster3from CSV header and data rowsFix
Before:
After:
Test Results
No test suite. Fix verified by code inspection —
Cardmodel indb_engine.pyconfirms fields areplayer,team,pack,valueonly (no roster fields).Notes
v1_cards_patchendpoint still acceptsroster1_id,roster2_id,roster3_idquery parameters that are silently ignored (no assignment tothis_card). This is dead API surface worth cleaning up separately — tracked in the issue body under "Other Observations".AI Code Review
Files Reviewed
app/routers_v2/cards.py(modified)Findings
Correctness
Cardmodel indb_engine.py(line 472) defines onlyplayer,team,pack, andvaluefields — noroster1/2/3fields exist. The removed code would have raisedAttributeErroron everyGET /api/v2/cards/{card_id}?csv=truerequest.id,player,team.abbrev,pack,value) are all valid Card model attributes.Security
Style & Conventions
Suggestions
this_card.playerin thev1_cards_get_oneCSV row serializes as the Player ORM object's__str__representation, while the bulkget_cardsCSV endpoint usesline.player.p_name. This inconsistency predates this PR and is out of scope, but worth aligning in a follow-up.v1_cards_patchendpoint (lines 332–337 in the pre-PR file) assignsthis_card.roster1_id = roster1_idetc. Peewee silently ignores non-field attribute assignments duringsave(), so this is harmless but dead. The PR author correctly flags this for a separate cleanup issue.Verdict: APPROVED
The fix precisely targets the runtime
AttributeErrorin the CSV path ofv1_cards_get_one. Model verification confirms the removed fields never existed onCard. The ruff reformatting is expected and non-functional. The two pre-existing issues noted are out of scope and appropriately deferred.Automated review by Claude PR Reviewer
Fixed in PR #37. Removed the non-existent
roster1,roster2,roster3columns from the CSV header and data row inv1_cards_get_one— these fields don't exist on theCardmodel and would raiseAttributeErrorat runtime.Pull request closed