Attach existing and new Spotify artists to organization rosters atomically

Merged
SI
2mo ago
+414-402

Adding an existing Spotify artist now uses the same atomic resolve-and-attach operation as adding a new one, so both return the canonical artist with the requested organization roster relationship committed. Lookup and attachment failures fail closed; ambiguous identities return 409, revoked membership returns 403, and unavailable persistence returns a retryable 503. Name-only creation uses a second transaction so attachment failures roll back the new profile. Post-commit profile-read failures return 503 without losing the committed artist identity.

Tracks recoupable/app#2166. Depends on https://github.com/recoupable/database/pull/83: apply that migration before deploying this API change. The existing HTTP response shape and 200/reused versus 201/created distinction are retained. No production data patch or canonical merge is included.

Validation: the full API suite passes (5,982 tests; 12 skipped). Non-admin allow/deny tests run through the real request validators with synthetic credentials. Readback and valuation tests preserve committed identity; the name-only adapter preserves response timestamps. The database PR separately verifies 16 PostgreSQL cases with the actual normalization trigger, concurrency, and rollback. API lint passes. A final boundary check also rejects malformed RPC JSON with an exact sanitized error (four adapter cases passed). The unused legacy identity lookup was removed.

Limitations: repository-wide type checking reports 196 errors in unchanged files outside this repair. The default production build stalled without progress and was stopped. A webpack build compiled successfully, then stopped at page-data collection because this isolated checkout has no PRIVY_PROJECT_SECRET configuration. No isolated hosted configuration or test identity is available in this checkout, so authenticated UI → API → persisted membership verification remains pending. This is implemented and fixture-tested, not merged or production-verified. Automatic PR preview checks are separate from authenticated end-to-end verification.

Release evidence: https://github.com/recoupable/app/issues/2166#issuecomment-6050403984 (hosted preview checkpoint). Final production commit/deployment and verification boundaries are recorded in the latest release checkpoint on recoupable/app#2166 and #2167.