Skip to content

fix(autoplay): strip bare tradução, purge now-playing duplicates, reduce lastfm boost - #591

Merged
LucasSantana-Dev merged 1 commit into
mainfrom
fix/autoplay-dedup-noise
Apr 13, 2026
Merged

LucasSantana-Dev merged 1 commit into
mainfrom
fix/autoplay-dedup-noise

Conversation

@LucasSantana-Dev

@LucasSantana-Dev LucasSantana-Dev commented Apr 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Bare "Tradução" dedup: Added \btradu[çc][aã]o\b and \btraduzido\b to NOISE_PATTERNS so "YE - FATHER Tradução" normalizes to the same key as "YE - FATHER" and is rejected as a duplicate
  • Purge stale queue duplicates: purgeDuplicatesOfCurrentTrack() runs at the start of each replenish cycle and removes any upcoming queue tracks that duplicate the now-playing track (catches duplicates added before the current song started)
  • Reduce Last.fm boost: LASTFM_SCORE_BOOST lowered from 0.1 → 0.0 so Last.fm novelty candidates no longer outscore seed-based candidates from the same session — prevents unrelated genre injection (e.g. Brazilian funk during a rap session)

Test plan

  • All 2176 bot tests pass
  • "YE - FATHER Tradução" no longer queued alongside "YE - FATHER"
  • No stale duplicates of now-playing track survive in upcoming queue
  • Autoplay session stays on-genre (Last.fm now equal priority, not boosted above seeds)

Summary by CodeRabbit

  • Bug Fixes

    • Improved autoplay queue management by removing duplicate tracks matching the currently playing track.
    • Adjusted last.fm recommendation scoring weights.
  • Improvements

    • Enhanced search query cleaning with expanded Portuguese language pattern recognition.
  • Tests

    • Updated test assertions for last.fm recommendation validation.

…uce lastfm boost

- add bare \btradu[çc][aã]o\b, \btraduzido\b patterns so "YE - FATHER Tradução" deduplicates against "YE - FATHER"
- purgeDuplicatesOfCurrentTrack() removes stale duplicates of now-playing at each replenish cycle
- reduce LASTFM_SCORE_BOOST 0.1 → 0.0 so last.fm novelty tracks no longer outrank seed-based candidates (prevents unrelated genre injection)
- update lastfm seed test: reason assertion removed (track added via seed-based path, reason is implementation detail)
@LucasSantana-Dev
LucasSantana-Dev enabled auto-merge (squash) April 13, 2026 18:45
@vercel

vercel Bot commented Apr 13, 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 13, 2026 6:46pm

@sonarqubecloud

Copy link
Copy Markdown

@LucasSantana-Dev
LucasSantana-Dev merged commit f9c7a54 into main Apr 13, 2026
11 of 12 checks passed
@coderabbitai

coderabbitai Bot commented Apr 13, 2026 •

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 75c94945-5507-4d5a-83aa-520ef5db93db

📥 Commits

Reviewing files that changed from the base of the PR and between 04d95b5 and 4d042d5.

📒 Files selected for processing (3)
  • packages/bot/src/utils/music/queueManipulation.spec.ts
  • packages/bot/src/utils/music/queueManipulation.ts
  • packages/bot/src/utils/music/searchQueryCleaner.ts

📝 Walkthrough

Walkthrough

The PR adjusts Last.fm scoring in autoplay queue replenishment by zeroing the LASTFM_SCORE_BOOST constant, adds duplicate track purging logic to remove now-playing track variants before replenishment, expands Portuguese language noise pattern matching, and relaxes test assertions on recommendation reason metadata.

Changes

Cohort / File(s) Summary
Last.fm Scoring Adjustment
packages/bot/src/utils/music/queueManipulation.ts
Changed LASTFM_SCORE_BOOST constant from 0.1 to 0.0, eliminating score lift from last.fm taste contributions.
Duplicate Track Purging
packages/bot/src/utils/music/queueManipulation.ts
Added purgeDuplicatesOfCurrentTrack() helper function that removes queue tracks matching the now-playing track by URL, normalized title/author keys, and extracted song core; invoked at start of _replenishQueue with debug logging.
Test Assertion Update
packages/bot/src/utils/music/queueManipulation.spec.ts
Removed assertion requiring metadata.recommendationReason to include "last.fm" substring; test now only validates metadata.isAutoplay: true.
Portuguese Noise Patterns
packages/bot/src/utils/music/searchQueryCleaner.ts
Added two Portuguese noise-removal regexes to NOISE_PATTERNS for standalone words tradução and traduzido to expand unwrapped occurrence stripping.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • #567: Modifies LASTFM_SCORE_BOOST and autoplay replenishment logic with Last.fm seeding integration.
  • #575: Targets duplicate-song prevention in autoplay queue replenishment.
  • #582: Uses extractSongCore and normalized matching for YouTube title variant deduplication.

Suggested labels

size/m

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/autoplay-dedup-noise

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.

@coderabbitai coderabbitai Bot added the size/m label Apr 13, 2026
@LucasSantana-Dev
LucasSantana-Dev deleted the fix/autoplay-dedup-noise branch April 13, 2026 19:07
LucasSantana-Dev added a commit that referenced this pull request May 13, 2026
…uce lastfm boost (#591)

- add bare \btradu[çc][aã]o\b, \btraduzido\b patterns so "YE - FATHER Tradução" deduplicates against "YE - FATHER"
- purgeDuplicatesOfCurrentTrack() removes stale duplicates of now-playing at each replenish cycle
- reduce LASTFM_SCORE_BOOST 0.1 → 0.0 so last.fm novelty tracks no longer outrank seed-based candidates (prevents unrelated genre injection)
- update lastfm seed test: reason assertion removed (track added via seed-based path, reason is implementation detail)

This branch was successfully deployed

1 active deployment
Preview — 4d042d52 Deployed Apr 13, 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