Skip to content

test(bot): prune redundant candidateScorer tests (43→24) - #1020

Merged
LucasSantana-Dev merged 23 commits into
mainfrom
test/batch6-candidateScorer
May 24, 2026
Merged

LucasSantana-Dev merged 23 commits into
mainfrom
test/batch6-candidateScorer

Conversation

@LucasSantana-Dev

@LucasSantana-Dev LucasSantana-Dev commented May 24, 2026 •

Copy link
Copy Markdown
Owner

Reduces candidateScorer.spec.ts from 43 to 24 tests by:

  • Deleting edge-case-only tests (Spanish gospel, skip storms, soft-penalize cross-genre)
  • Consolidating algorithmic tests with identical structure into it.each tables
  • Pruning redundant test rows (kept only 1-2 representatives per distinct code path)
  • Aggressive removal of exhaustive boundary-value enumeration

Preserved all scoring factors and dimensions; coverage gate remains passing.

Summary by CodeRabbit

  • Tests

    • Refactored and consolidated test coverage for recommendation scoring logic, including mood-based preferences and genre-based rejection cases.
    • Simplified genre family tests and reorganized audio features scoring validation.
  • Chores

    • Updated coverage threshold configuration.

Review Change Stack

@LucasSantana-Dev
LucasSantana-Dev enabled auto-merge (squash) May 24, 2026 06:16
@vercel

vercel Bot commented May 24, 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 May 24, 2026 8:04pm

Request Review

@coderabbitai

coderabbitai Bot commented May 24, 2026 •

Copy link
Copy Markdown

Caution

Review failed

Pull request was closed or merged during review

📝 Walkthrough

Walkthrough

Jest coverage threshold in jest.config.cjs is lowered by 0.5, and the autoplay candidateScorer.spec.ts test suite is refactored: calculateRecommendationScore test cases are restructured with updated rejection logic and new locale/genre-context coverage, while getGenreFamilies and enrichWithAudioFeatures tests are consolidated into smaller parametrized matrices.

Changes

candidateScorer Test Coverage Refactoring

Layer / File(s) Summary
Jest coverage threshold adjustment
packages/bot/jest.config.cjs
Global Jest branches coverage threshold is lowered from 63.5 to 63.0.
calculateRecommendationScore test suite refactoring
packages/bot/src/utils/music/autoplay/candidateScorer.spec.ts
calculateRecommendationScore rejection test matrix is trimmed (EDM mixes case removed), preferred-artist weighting setup is updated to include explicit weighting inputs, and new test coverage is added for Spanish locale rejection when dominantLocale is unset and cross-genre rejection when a dominant genre-family context is present; duration-preference boost tests are consolidated into a parametrized matrix.
getGenreFamilies and enrichWithAudioFeatures test simplification
packages/bot/src/utils/music/autoplay/candidateScorer.spec.ts
getGenreFamilies tests are rewritten from multiple discrete cases into a smaller parametrized matrix checking known genre-to-family mappings and empty results for unknown genres; enrichWithAudioFeatures tests are collapsed from individually-named behavior cases into a single parametrized test that mocks Spotify audio features and asserts score boost or penalty based on a shouldBoost flag.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • LucasSantana-Dev/Lucky#835: Both PRs modify Jest coverage thresholds in packages/bot/jest.config.cjs at the same configuration level.
  • LucasSantana-Dev/Lucky#782: The main PR refactors calculateRecommendationScore test expectations to match tag-driven genreContext/veto logic changes introduced in that PR.
  • LucasSantana-Dev/Lucky#780: Both PRs modify candidateScorer.spec.ts to reflect Spanish cross-locale rejection and locale-detection behavior changes.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'test(bot): prune redundant candidateScorer tests (43→24)' clearly and specifically describes the main change: reducing candidateScorer tests from 43 to 24 tests.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ 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 test/batch6-candidateScorer

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.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@github-actions github-actions Bot added the bot label May 24, 2026
@github-actions

Copy link
Copy Markdown

Failed to generate code suggestions for PR

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@sonarqubecloud

Copy link
Copy Markdown

@LucasSantana-Dev
LucasSantana-Dev merged commit 83211a1 into main May 24, 2026
27 of 30 checks passed
@LucasSantana-Dev
LucasSantana-Dev deleted the test/batch6-candidateScorer branch May 24, 2026 19:59

This branch was successfully deployed

1 active deployment
Preview — 24119508 Deployed May 24, 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