fix: enrich valuation-captured songs (artists + notes) so they render in the catalog

Merged
SW
4mo ago
+60-4

What

The valuation capture path created songs rows but produced artist-less, notes-less tracks — so a materialized catalog showed the count ("Found 52 songs") with an empty list: the chat catalog view's isCompleteSong requires artist + notes (and "Hide items with missing info" is on by default), so every valuation track was filtered out.

Root cause: mapUnmappedAlbumTracks looked up each track on Spotify (which returns artists) but discarded track.artists and never ran the enrichment the manual/CSV flow does. ("spaceheater" renders because it was added via that flow → processSongsInput → linkSongsToArtists + queueRedisSongs.)

Fix: carry track.artists through and run the same enrichment in the capture path:

  • linkSongsToArtists(songs) — writes song_artists (auto-creating the artist account via getPreferredArtistAccountIds).
  • queueRedisSongs(songs) — queues each ISRC for background note generation.

Reuses the already-fetched Spotify lookup (no extra API call); idempotent (upserts + queue dedupe by ISRC).

TDD

New test in mapUnmappedAlbumTracks.test.ts (red→green): asserts captured songs are linked to their Spotify artists and queued. lib/research/playcounts + lib/songs → 109 pass, tsc + eslint clean.

Scope / decision

Per recoupable/chat#1801 (decided 2026-06-18): fix at the root (capture writes the missing info) rather than relaxing the chat "missing info" filter. api#681's LEFT-join stays as the read-path safety net. Note: notes arrive asynchronously as the Redis queue drains; artists are written synchronously.

Root-cause follow-up on recoupable/chat#1801. Preview verification to follow in a comment.

🤖 Generated with Claude Code


Summary by cubic

Enriches valuation-captured songs with artists and queued notes so they render in the catalog instead of being filtered out. Fixes chat#1801 by running enrichment during capture using the existing Spotify lookup.

  • Bug Fixes
    • Preserve Spotify track.artists via getSpotifyArtists in mapUnmappedAlbumTracks.
    • After insert, run linkSongsToArtists and queueRedisSongs to link artists and queue note generation.
    • Add a test to confirm artists are linked and songs are queued; remains idempotent with no extra Spotify calls.