Keep player fan contacts owned by organizations

Merged
SI
10d ago
+182-0

Fans who connect to multiple artists in one workspace currently have separate profile records. Add one private organization contact per Spotify identity while preserving each artist relationship, fan ID, session and listening event.

  • Backfill canonical profiles, enforce matching organization/identity on every artist relationship, and keep capture compatible with existing callers through a database trigger.
  • Reports retain fan_id and add contact_id. Browser roles cannot read contacts directly; separate organizations never merge fans by email or name.
  • Validation: 17 migration/backfill/concurrency/access/playback tests pass on PostgreSQL 15 and 17, including the existing playback compatibility suite.
  • Rollout: apply this additive migration before the API change. Backfill briefly locks fan writes; older API capture remains compatible. Production migration has not been applied.

Summary by cubic

Adds a private organization-scoped contact per Spotify identity so fans who connect to multiple artists in a workspace share one profile, while preserving each artist relationship, fan ID, session, and listening event. Existing capture callers remain compatible via a database trigger, and reports now include contact_id alongside fan_id. Browser roles cannot read contacts directly, and contacts never merge across owners or by email/name.

Rollout

  • Apply the additive migration before deploying API readers of contact_id / player_fan_contacts.
  • The migration briefly locks player_fans during backfill; connections can wait briefly.
  • Production migration has not been applied.