fix: generate track notes at capture so songs are complete (render in catalog)
Why
Follow-up to #684. That PR linked artists at capture, but captured songs still had null notes, so the chat catalog's isCompleteSong (which requires notes) kept hiding them — the page showed "Found N songs" with an empty list.
Root cause of the missing notes: notes are generated inline by getSongsByIsrc → generateTrackNotes in the manual/CSV flow. The capture path instead relied on queueRedisSongs, which enqueues to the songs-isrc-processing BullMQ queue — and that queue has no worker anywhere (api or tasks). So queued note jobs are never processed; captured songs never got notes.
Fix
mapUnmappedAlbumTracks now generates notes inline with the same generateTrackNotes helper the manual flow uses, reusing the SpotifyTrack it already fetched (no extra Spotify round-trip beyond the existing genre lookup), and writes them onto the song. Captured songs now land complete (artist from #684 + notes) and render through the normal catalog path.
generateTrackNotes is a cheap metadata template (no LLM).
TDD
Test asserts notes are generated per track and written to the upserted song. lib/research/playcounts + lib/songs → 109 pass; tsc + prettier + lint clean.
Notes / scope
- Fixes new captures. Existing catalogs (captured before this) stay note-less unless re-captured/backfilled.
- The dead
songs-isrc-processingqueue (no consumer) is left as-is here; worth a separate cleanup or building the worker if async enrichment is desired later.
Closes the notes half of the root cause in recoupable/chat#1801. Preview verification to follow in a comment.
🤖 Generated with Claude Code
Summary by cubic
Generate track notes during capture so songs land complete and show in the catalog. Fixes missing notes caused by relying on a queue with no worker.
-
Bug Fixes
mapUnmappedAlbumTracksnow callsgenerateTrackNotesand storesnoteson upserted songs, reusing the fetchedSpotifyTrack(no extra Spotify calls).- Keeps artist linking and still enqueues via
queueRedisSongsfor parity; notes are generated inline soisCompleteSongno longer filters captured tracks. - Added a test to assert notes are generated and saved.
-
Migration
- Applies to new captures only; recapture or backfill to add notes to existing catalogs.
Summary by CodeRabbit
- Refactor
- Enhanced track data processing to generate and include notes during song consolidation, ensuring enriched information is persisted with stored song data.