feat: S3 upload pipeline for APNG animated cards #198
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
2 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: cal/paper-dynasty-database#198
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
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?
Problem
card_storage.pyonly handles PNG uploads. The animated card endpoint (/animated) does not trigger any S3 upload. T3 and T4 variant cards will have static PNGimage_urlvalues but no animated versions cached on S3/CDN.Currently animated cards are rendered on-demand, which works but is expensive (12–24 Playwright screenshots per card). If animated cards need to be served at scale (e.g., in collection views or Discord embeds), on-demand rendering won't scale.
Fix
Extend
card_storage.pyto support APNG uploads with path pattern:cards/cardset-{csid:03d}/player-{pid}/v{variant}/{card_type}card.apngWire the animated endpoint to trigger a background S3 upload (same pattern as static card renders).
Impact
Not blocking for initial launch (on-demand works), but needed for CDN caching and scale. Becomes important if animated cards appear in collection views or notifications.
PR #210 opened: #210
Approach: Added
build_apng_s3_key,upload_apng_to_s3, andupload_variant_apngtocard_storage.pyfollowing the existing PNG upload pattern. Wiredget_animated_cardto triggerupload_variant_apngas a background task on each new render (cache miss only;?tier=dev previews skipped).Note: no
animated_urlDB column exists yet — the upload goes to S3 but there's no URL stored back to the DB. A follow-up migration would be needed to exposeanimated_urlvia the API.