feat(valuation): enrich the linked searched artist's avatar + followers (chat#1881 P1 / 2a)

Merged
SW
3mo ago
+168-35

What

Item 2a (🟠 P1) of chat#1881. Funnel-claimed artists render with a blank avatar and "0 followers"; this populates real profile data on claim so the user can confirm we matched the right artist.

How

When the valuation flow links the searched Spotify artist (item 1b), it now also calls a best-effort enrichSearchedArtistProfile:

  • sets the artist's avatar (account_info.image) from the Spotify profile image, and
  • upserts its Spotify social (socials) with avatar / followerCount / username from the resolved profile.

Best-effort — a failed enrichment never fails the claim (mirrors the surrounding valuation best-effort pattern).

Tests (TDD red→green)

  • enrichSearchedArtistProfile 3/3 (sets avatar + upserts social with followers; null-avatar case still upserts; never throws).
  • linkSearchedArtistToAccount updated to assert the enrichment call. Full lib/valuation + lib/catalog 79/79; eslint clean.

Stacking / merge order

Stacked on item 1b (api#777) — this PR is based on that branch so the diff shows only the enrichment. Merge #777 first, then this retargets to main. Preview-verification (real avatar/followers appear on /artists after a funnel claim) is pending, gated on 1b being live. Tracking: chat#1881.


Summary by cubic

Populate real avatars and follower counts for funnel-claimed artists so roster and verify-socials don’t show blanks or ā€œ0 followers.ā€ Enrichment now runs for both canonical and fallback links and normalizes the Spotify profile_url so updates land on the linked social (chat#1881 P1/2a).

  • New Features

    • Added enrichSearchedArtistProfile to set account_info.image and upsert the Spotify social with avatar, followerCount, and username.
    • Centralized enrichment in runValuationHandler: resolve the searched Spotify profile once and enrich whichever artist lands on the roster; linkSearchedArtistToAccount is link-only (takes artistName).
  • Bug Fixes

    • Normalize the Spotify profile_url with normalizeProfileUrl to match updateArtistSocials and avoid orphan upserts.
    • Run enrichment on the canonical path too (not just fallback), so real avatar/followers appear after claims.

Summary by CodeRabbit

  • New Features

    • Newly linked artist profiles are enriched with their Spotify profile image, follower count, profile URL, and username.
    • Spotify social information is automatically added when available.
  • Bug Fixes

    • Profile enrichment failures no longer interrupt the artist-linking process.