Repository navigation
fix(autoplay): strip modifiers from Spotify query, broaden cover dedup - #589
Conversation
…p patterns
- Remove query modifiers ('similar', 'like', 'playlist', 'mix') from the
Spotify search query — Spotify ignores these and returns 0 results,
causing unnecessary fallback to YouTube on every non-first replenish cycle
- Broaden cover noise patterns from /(cover version)?/ to /cover[^)]*/
so '(Cover - ao vivo)', '(Cover by X)' etc. are stripped before coreKey
computation, enabling dedup to catch cover variants of the now-playing song
- Add 'cover' to HYPHENATED_VERSION_SUFFIXES and VERSION_KEYWORD_RE so
'- Cover' suffixes are also trimmed by cleanTitle
- Tests: modifier non-append test (2x replenish), cover dedup test,
6 cleanTitle cover-pattern tests
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
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 49 minutes and 41 seconds. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the 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 configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe changes refine music search query handling by preventing query modifiers from being appended to Spotify searches while expanding detection and cleaning of cover and variant track patterns throughout the search pipeline. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
…lexity HYPHENATED_VERSION_SUFFIXES already handles '- Cover' via the pattern added in the previous commit, so VERSION_KEYWORD_RE does not need it. Removing it brings the regex back under SonarCloud S5843 threshold.
|
#589) * fix(autoplay): strip modifiers from Spotify query, broaden cover dedup patterns - Remove query modifiers ('similar', 'like', 'playlist', 'mix') from the Spotify search query — Spotify ignores these and returns 0 results, causing unnecessary fallback to YouTube on every non-first replenish cycle - Broaden cover noise patterns from /(cover version)?/ to /cover[^)]*/ so '(Cover - ao vivo)', '(Cover by X)' etc. are stripped before coreKey computation, enabling dedup to catch cover variants of the now-playing song - Add 'cover' to HYPHENATED_VERSION_SUFFIXES and VERSION_KEYWORD_RE so '- Cover' suffixes are also trimmed by cleanTitle - Tests: modifier non-append test (2x replenish), cover dedup test, 6 cleanTitle cover-pattern tests * fix(autoplay): remove cover from VERSION_KEYWORD_RE to fix S5843 complexity HYPHENATED_VERSION_SUFFIXES already handles '- Cover' via the pattern added in the previous commit, so VERSION_KEYWORD_RE does not need it. Removing it brings the regex back under SonarCloud S5843 threshold.



Problem
Two independent bugs causing wrong tracks to be queued:
1. YouTube fallback on every non-first replenish cycle
searchSeedCandidatesappended query modifiers (similar,like,playlist,mix) to all engines, including Spotify. Spotify doesn't understand these text modifiers and returns 0 results, silently falling back to YouTube on every cycle wherereplenishCount > 0.Before:
"Água viva ANATOMIA similar"→ Spotify: 0 results → YouTube fallbackAfter:
"Água viva ANATOMIA"→ Spotify: correct results2. Cover variants bypassing dedup
The cover noise pattern was too narrow:
/\(cover(?:\s{0,3}version)?\)/gionly matched(cover)and(cover version). Titles like(Cover - ao vivo)or(Cover by X)were not stripped, so theircoreKeydiffered from the studio version and dedup missed them.Before:
"Água viva (Cover - ao vivo)"→ coreKey"agua viva cover ao vivo"≠"agua viva"→ queuedAfter:
"Água viva (Cover - ao vivo)"→cleanTitlestrips(Cover...)→ coreKey"agua viva"→ deduplicatedChanges
queueManipulation.ts:spotifyQuery = spotifyBase(no modifier appended)searchQueryCleaner.ts:(cover[^)]*)/[cover[^\]]*]patterns,coverinHYPHENATED_VERSION_SUFFIXESandVERSION_KEYWORD_RESummary by CodeRabbit
Release Notes
Bug Fixes
New Features