fix(upload): avoid session-state race in concurrent album creation (#1334)
12-concurrent uploads targeting the same album (artist_did, slug) raced
in `get_or_create_album`: the losers caught IntegrityError and called
`db.rollback()` on the caller's shared AsyncSession. under concurrent
load this left 2/12 uploads blowing up with MissingGreenlet on the very
next pool checkout, ~300ms after INSERT albums — observed on stg during
the 12-chromatic-drone smoke test (2026-04-24).
replace SELECT-then-INSERT-then-catch with a single
`INSERT ... ON CONFLICT DO NOTHING RETURNING`. the race resolves at the
DB level, no rollback on a shared session, no churn on pool state.
regression test fires 12 concurrent `get_or_create_album` calls on
separate sessions with the same title and asserts exactly 1 row, 1
`created=True`, and all callers agree on the resulting album id.
Co-authored-by: Claude Opus 4 (1M context) <noreply@anthropic.com>
authored by