claude-memory/graph/fixes/fix-dead-roster-csv-fields-in-paper-dynasty-database-cards-e-61b618.md

66 lines
2.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: 61b618e7-6c6a-46be-9dec-b31b57cb19fe
type: fix
title: "Fix: dead roster CSV fields in paper-dynasty-database cards endpoint"
tags: [paper-dynasty, paper-dynasty-database, fastapi, python, fix, dead-code, csv, card-model]
importance: 0.55
confidence: 0.8
created: "2026-03-03T18:07:05.018372+00:00"
updated: "2026-03-03T19:37:40.283018+00:00"
relations:
- target: fb56ad2c-5c87-48d4-8a69-118c81f74884
type: BUILDS_ON
direction: outgoing
strength: 0.7
edge_id: 4b12f41f-ac18-4ea9-81c3-17f9b99b9d2a
- target: 1e6628fa-dc5d-4047-a9ae-ecb884e04ba2
type: RELATED_TO
direction: outgoing
strength: 0.69
edge_id: caec4168-dea7-45bc-b10c-ed8baf816768
- target: 25a63239-d077-4a92-8466-0900e16b837f
type: RELATED_TO
direction: outgoing
strength: 0.68
edge_id: 7f19347f-52cb-4d65-a5a3-61e8670d3d5a
- target: 62d0f73d-8854-4c71-9001-60b38d438534
type: RELATED_TO
direction: incoming
strength: 0.82
edge_id: 06b45144-877b-4e26-bad5-b479fa53e6c0
- target: a08cfd86-d519-41cd-b93e-0877e11c7cc3
type: RELATED_TO
direction: incoming
strength: 0.77
edge_id: 1b5c2d30-6668-41b4-a17c-cc2af2bb3105
- target: 475fcd0d-8d29-471b-a6e3-f3face5320c9
type: RELATED_TO
direction: incoming
strength: 0.75
edge_id: 14902c20-b159-422e-bf42-ad47ff012b9c
---
## Problem
`app/routers_v2/cards.py``v1_cards_get_one` endpoint's CSV branch accessed `this_card.roster1.name`, `this_card.roster2.name`, `this_card.roster3.name`. The `Card` model has no such fields, so any `GET /api/v2/cards/{id}?csv=true` request would raise `AttributeError` at runtime.
## Root Cause
The CSV code was written against an older schema that had roster foreign keys on `Card`. Those fields were removed from the model but the CSV export code was never updated.
## Solution
Removed the three dead columns from the CSV header row and data row. The output now reflects only fields that exist on `Card`: `id`, `player`, `team`, `pack`, `value`.
## Files Changed
- `app/routers_v2/cards.py` lines 144146
## Note
The `v1_cards_patch` endpoint also accepts `roster1_id`, `roster2_id`, `roster3_id` params that are silently ignored (no assignment in handler body) — dead API surface but not a runtime error.
## PR
https://git.manticorum.com/cal/paper-dynasty-database/pulls/35