Skip to content

refactor: extract spotifyRecommender (phase 3.3) - #662

Merged
LucasSantana-Dev merged 2 commits into
mainfrom
refactor/spotify-recommender-v2
Apr 16, 2026
Merged

LucasSantana-Dev merged 2 commits into
mainfrom
refactor/spotify-recommender-v2

Conversation

@LucasSantana-Dev

Copy link
Copy Markdown
Owner

Extract Spotify recommendation functions to dedicated module.

Summary

  • Extracts collectSpotifyRecommendationCandidates and searchSeedCandidates to new spotifyRecommender.ts
  • Reduces queueManipulation.ts from 2,112 LOC to 1,852 LOC (removed 260 LOC)
  • Adds 13 tests with 82% line coverage for spotifyRecommender
  • All 131 existing queueManipulation tests still pass (now 144 total)

Testing

  • queueManipulation tests: 131 passed
  • spotifyRecommender tests: 13 passed
  • No behavior changes - pure extraction

Phase 3.3 Complete

Part of Lucky refactor plan Phase 3: Breaking up queueManipulation.ts god object.

Extract collectSpotifyRecommendationCandidates and searchSeedCandidates
functions to new spotifyRecommender.ts module. Reduces queueManipulation
from 2,112 LOC to 1,852 LOC. Includes 13 tests with 82% line coverage.
@vercel

vercel Bot commented Apr 16, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
lucky Ready Ready Preview, Comment Apr 16, 2026 11:01pm

Request Review

@LucasSantana-Dev
LucasSantana-Dev enabled auto-merge (squash) April 16, 2026 22:42
@coderabbitai

coderabbitai Bot commented Apr 16, 2026 •

Copy link
Copy Markdown

Warning

Rate limit exceeded

@LucasSantana-Dev has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 37 minutes and 40 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 37 minutes and 40 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 56ab4d4a-a897-4d7a-bc35-a7f2c11598c2

📥 Commits

Reviewing files that changed from the base of the PR and between f56c426 and 7e6145d.

📒 Files selected for processing (3)
  • packages/bot/src/utils/music/autoplay/spotifyRecommender.spec.ts
  • packages/bot/src/utils/music/autoplay/spotifyRecommender.ts
  • packages/bot/src/utils/music/queueManipulation.ts
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/spotify-recommender-v2

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

Copy link
Copy Markdown

@LucasSantana-Dev
LucasSantana-Dev merged commit 7d5b357 into main Apr 16, 2026
12 checks passed
LucasSantana-Dev added a commit that referenced this pull request Apr 16, 2026
Extract collectLastFmCandidates function to dedicated lastFmSeeder.ts module as part of Phase 1.1 of queueManipulation refactor. Maintains strict behavior preservation with all 131 existing tests passing.

## Changes
- **New file**: packages/bot/src/utils/music/autoplay/lastFmSeeder.ts (267 LOC)
  - collectLastFmCandidates() - main Last.fm seeding function
  - Internal helper functions for candidate filtering and scoring
  - Dependencies: searchLastFmQuery, calculateRecommendationScore imported from queueManipulation

- **Modified file**: packages/bot/src/utils/music/queueManipulation.ts (-134 LOC)
  - Removed collectLastFmCandidates function body
  - Exported searchLastFmQuery and calculateRecommendationScore for lastFmSeeder dependency
  - Re-imported collectLastFmCandidates for backward compatibility

## Testing
- All 131 queueManipulation tests pass
- No behavior changes - pure extraction
- Circular dependency avoided by keeping searchLastFmQuery and calculateRecommendationScore in queueManipulation

## Phase 1 Status
Part of Lucky refactor plan Phase 1: Breaking up queueManipulation.ts god object.
Prior phases: #658 candidateScorer, #659 diversitySelector, #662 spotifyRecommender

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
LucasSantana-Dev added a commit that referenced this pull request May 13, 2026
…3) (#662)

Extract collectSpotifyRecommendationCandidates and searchSeedCandidates
functions to new spotifyRecommender.ts module. Reduces queueManipulation
from 2,112 LOC to 1,852 LOC. Includes 13 tests with 82% line coverage.
@LucasSantana-Dev
LucasSantana-Dev deleted the refactor/spotify-recommender-v2 branch May 23, 2026 02:21

This branch was successfully deployed

1 active deployment
Preview — 7e6145d2 Deployed Apr 16, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant