fix: remove dead roster fields from CSV in v1_cards_get_one (#37) #39
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#39
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "ai/paper-dynasty-database-37"
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. raisesAttributeErrorat runtime for anyGET /api/v2/cards/{card_id}?csv=truerequest.Files Changed
app/routers_v2/cards.py— removedroster1,roster2,roster3from CSV header and data rowFix
Before:
After:
Test Results
No test suite. Fix verified by code inspection —
Cardmodel indb_engine.pyhas no roster fields.Notes
The ruff linter hook reformatted the entire file (single → double quotes, line wrapping) on save. The functional diff is only the removal of the three roster columns.
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.AI Code Review
Files Reviewed
app/routers_v2/cards.py(modified)Findings
Correctness
db_engine.py: theCardmodel (line 472) declares onlyplayer,team,pack, andvalueas fields — noroster1,roster2, orroster3. The oldthis_card.roster1.nameaccess was a guaranteedAttributeErroron everyGET /api/v2/cards/{card_id}?csv=truerequest.id,player,team.abbrev,pack,value) are all valid fields on theCardmodel.this_card.playerserializes as the Peewee model repr in CSV (e.g.<Player: 42>), not the player name. This is pre-existing behavior not introduced by this PR and is consistent with the same pattern in the non-CSV path.Security
Style & Conventions
Suggestions
v1_cards_patch(lines 332–337 of currentmain) still acceptingroster1_id,roster2_id,roster3_idquery parameters that silently no-op (Peewee ignores assignments to undeclared fields onsave()). This is dead API surface but not a crash risk. Recommend tracking this as a follow-up issue.Verdict: APPROVED
The functional fix is minimal, correct, and addresses a runtime crash. The ruff reformatting is noise but harmless. Safe to merge.
Automated review by Claude PR Reviewer (COMMENT posted — Gitea does not permit self-approval)
Pull request closed