feat(migrations): repoint funnel-duplicate roster artists — pass 2 (chat#1859)

Merged
SW
5mo ago
+113-0

What

Pass 2 of the funnel-duplicate roster repoint — the first of the two backfill follow-ups owed on chat#1859 now that marketing#46 is deployed and the forward mint has stopped.

Adds 20260708170000_repoint_funnel_duplicate_roster_artists_pass2.sql, which re-runs the exact, verified logic of 20260707190000 (database#43) under a new timestamp. It is idempotent by design, so a re-run only touches what still qualifies: Category A duplicates — an account holding the song-less duplicate but not yet the canonical.

Why a second pass

20260707190000 ran on prod 2026-07-08. Duplicates kept accruing until marketing#46 deployed (some pre-existing leads flip into scope the moment their account claims a catalog — condition 5). Post-merge verification of #43 caught this (evidence). With the mint now stopped, this pass converges.

Scope (measured 2026-07-08 on prod, read-only)

  • Category A rows this repoints: 2 (account has the duplicate, not the canonical).
  • Category B (account already holds the canonical) is skipped here by design — the repoint can't fix those; the sibling PR does.

Same conservative 5-condition signature as #43 (on a roster · zero song_artists · Spotify social · exactly one song-owning same-name twin · every referencing account owns a catalog). Same post-condition RAISE EXCEPTION guard.

Verification

  • Logic is byte-for-byte the repoint half of the already-applied, already-verified 20260707190000 (14 rows repointed live, repro flipped 0/$0 → 67 / 557.5M). Re-running is safe: repointed dupes fail condition 1; the social copy is NOT EXISTS-guarded.
  • The Supabase Preview check validates it parses + runs against a branch.
  • Acceptance is shared with the sibling: the #1859 health-check query returns 0 rows after this + the cleanup-delete run.

Merge order

This PR first, then cleanup-delete (#45). The cleanup migration's timestamp is later so they apply repoint → cleanup; merging in that order keeps the migration history in sequence.

Links

🤖 Generated with Claude Code