- Move lazy imports to top level in card_storage.py and players.py (CLAUDE.md violation)
- Use os.environ.get() for S3_BUCKET/S3_REGION to allow dev/prod bucket separation
- Fix test patch targets from app.db_engine to app.services.card_storage (required after top-level import move)
- Fix assert_called_once_with field name: MockBatting.player → MockBatting.player_id
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Pin boto3==1.42.65 to match project convention of exact version pins
- Use player_id (not player) for FK column access in card_storage.py
to match the pattern used throughout the codebase
- Add comment explaining the tier is None guard in S3 upload scheduling
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds image_url field to each card state entry in the GET
/api/v2/refractor/cards response. Resolved by looking up the variant
BattingCard/PitchingCard row. Returns null when no image has been
rendered yet.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds BackgroundTasks to the card render endpoint. After rendering a
variant card (variant > 0) where image_url is None, schedules
backfill_variant_image_url to upload the PNG to S3 and populate
image_url on the card row.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
New service with S3 upload functions for the refractor card art
pipeline. backfill_variant_image_url reads rendered PNGs from disk,
uploads to S3, and sets image_url on BattingCard/PitchingCard rows.
18 tests covering key construction, URL formatting, upload params,
and error swallowing.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Dev environment uses sba_postgres container, paperdynasty_dev database,
sba_admin user — not pd_postgres/pd_master as previously documented.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>