fix: remove dead roster fields from CSV in v1_cards_get_one (#36) #37
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#37
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/paper-dynasty-database-36"
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
Other Observations
v1_cards_patchstill acceptsroster1_id,roster2_id,roster3_idquery parameters that are silently ignored (no assignment tothis_card). This is dead API surface worth cleaning up separately.Removes non-existent roster1/roster2/roster3 columns from CSV output. Accessing this_card.roster1.name raised AttributeError at runtime for any GET /api/v2/cards/{card_id}?csv=true request. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>AI Code Review
Files Reviewed
app/routers_v2/cards.py(modified)Findings
Correctness
Cardmodel indb_engine.py(lines 472–491) defines onlyplayer,team,pack, andvaluefields — noroster1,roster2, orroster3. The old code accessingthis_card.roster1.nameetc. would unconditionally raiseAttributeErroron anyGET /api/v2/cards/{card_id}?csv=truerequest. Removal is the right fix.id,player,team.abbrev,pack,value) all correspond to validCardmodel fields.get_cardsCSV usesline.player.p_namefor the player name, butv1_cards_get_oneCSV emitsthis_card.player(the model object, which renders as its__str__). This divergence predates this PR and should be addressed separately if consistency matters.Security
Style & Conventions
v1_cards_get_oneCSV block.Suggestions
v1_cards_patch(lines 332–337 in the original file) still assignsthis_card.roster1_id,roster2_id,roster3_id— undeclared Peewee fields that are silently dropped bysave(). Worth a follow-up issue to remove those dead params from the API surface.Verdict: APPROVED ✓
Clean, correct removal of dead code that was causing a guaranteed runtime crash. Model inspection confirms no roster fields exist. No security or convention issues introduced.
Automated review by Claude PR Reviewer
Fixed in PR #39: #39
Removed
roster1,roster2,roster3from the CSV header and data row inv1_cards_get_one. These fields don't exist on theCardmodel, so accessing them would raiseAttributeErrorat runtime.Pull request closed