Skip to content

feat: pluggable discovery sources for richer album mosaic#205

Draft
cdtinney wants to merge 1 commit into
mainfrom
feat/richer-album-discovery
Draft

feat: pluggable discovery sources for richer album mosaic#205
cdtinney wants to merge 1 commit into
mainfrom
feat/richer-album-discovery

Conversation

@cdtinney
Copy link
Copy Markdown
Owner

Summary

Introduces a DiscoverySource interface so album discovery strategies are pluggable. The monolithic pipeline in getCurrentlyPlayingRelatedAlbums is replaced with a source registry — adding a new discovery strategy means implementing one interface and adding it to an array.

Three sources ship with this PR:

  • Related artists (priority 10) — Last.fm + ListenBrainz, now querying all song artists instead of just the primary
  • Genre fallback (priority 20) — searches Spotify for artists in the same genres when the related artist pool is small
  • 2-hop traversal (priority 30) — fetches related artists of the top 5 related artists for deeper graph exploration

Also includes:

  • Song-level discoveryResultCache (4h TTL) to skip the pipeline on repeated polls
  • relatedArtistsCache TTL increased from 1h to 4h
  • resolveArtistId extracted to its own module for reuse across sources
  • Spotify recommendations API intentionally excluded (deprecated Nov 2024)

Testing

  • 49 server tests pass (14 test files), including new tests for runDiscovery, each source, and the updated pipeline
  • pnpm format:check and pnpm lint pass (warnings only, no errors)
  • Manual testing needed: play a collaborative track and a niche genre track to verify mosaic variety

@cdtinney cdtinney force-pushed the feat/richer-album-discovery branch from 06827ef to 2418bb4 Compare April 29, 2026 03:05
Introduces a DiscoverySource interface so album discovery strategies are
pluggable. Three sources: related artists (multi-artist, Last.fm +
ListenBrainz), genre-based fallback, and 2-hop traversal. Also adds a
song-level discovery cache and increases related artists cache TTL to 4h.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@cdtinney cdtinney force-pushed the feat/richer-album-discovery branch from 2418bb4 to a115bae Compare April 29, 2026 05:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant