Skip to content

test(bot): prune redundant feedbackService tests - #1012

Merged
LucasSantana-Dev merged 6 commits into
mainfrom
test/batch5-feedbackService
May 24, 2026
Merged

LucasSantana-Dev merged 6 commits into
mainfrom
test/batch5-feedbackService

Conversation

@LucasSantana-Dev

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

Copy link
Copy Markdown
Owner

Removes delegation-only test clusters and consolidates redundant input-variation tests.

Reduction

  • Original: 34 tests
  • New: 18 tests
  • Removed: 16 tests (47% reduction)

Strategy

Deleted clusters (2):

  • clearFeedback delegation-only test (only checked mock calls)
  • recordImplicitFeedback delegation-only test (only checked mock calls)

Consolidated with it.each (8 parameterized tests covering 14 original tests):

  • setFeedback (like/dislike) → 1 parameterized test covering 2 cases
  • getDislikedTrackKeys/getLikedTrackKeys (undefined guard) → 1 parameterized test covering 2 cases
  • getPreferredArtistKeys/getBlockedArtistKeys → 1 parameterized test covering 2 cases
  • getPreferredArtistKeys/getBlockedArtistKeys (undefined guard) → 1 parameterized test covering 2 cases
  • getLikedTrackWeights/getDislikedTrackWeights → 1 parameterized test covering 2 cases
  • getLikedTrackWeights/getDislikedTrackWeights (empty guard) → 1 parameterized test covering 2 cases
  • getImplicitDislikeKeys/getImplicitLikeKeys → 1 parameterized test covering 2 cases
  • getImplicitDislikeKeys/getImplicitLikeKeys (error guard) → 1 parameterized test covering 2 cases
  • getPreferredArtistKeys/getBlockedArtistKeys (Postgres error handling) → 1 parameterized test covering 2 cases
  • getLikedTrackWeights/getDislikedTrackWeights (null data) → 1 parameterized test covering 2 cases

Testing

Summary by CodeRabbit

  • Tests
    • Refactored and consolidated unit and integration tests for the music recommendation feedback service, improving test maintainability and reducing redundancy.

Review Change Stack

Reduces test count from 34 to 18 (−16 tests):
- Removes delegation-only clusters (clearFeedback, recordImplicitFeedback)
- Consolidates redundant input-variation tests with it.each
- Merges like/dislike feedback tests
- Merges preferred/blocked artist tests
- Merges implicit_dislike/implicit_like tests
- Merges Postgres error-handling tests

All 32 parameterized test instances pass. Part of Phase 4 bot test reduction.
@coderabbitai

coderabbitai Bot commented May 24, 2026 •

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ce5ff78c-d531-4bc6-a9e2-a9471fed98a9

📥 Commits

Reviewing files that changed from the base of the PR and between 3d7890a and 77773ee.

📒 Files selected for processing (1)
  • packages/bot/src/services/musicRecommendation/feedbackService.spec.ts

📝 Walkthrough

Walkthrough

Refactored feedbackService.spec.ts by consolidating redundant unit and integration tests into parameterized it.each suites. The changes eliminate duplicate coverage across feedback storage, artist preference getters, track-weight decay calculations, implicit feedback behavior, and error handling paths while maintaining full test coverage.

Changes

Test Consolidation and Parameterization

Layer / File(s) Summary
setFeedback and track-key getter parameterization
packages/bot/src/services/musicRecommendation/feedbackService.spec.ts
Converted two standalone setFeedback tests (dislike/like) into a single parameterized it.each, and removed the standalone clearFeedback delete-key test.
Artist-key getter consolidation
packages/bot/src/services/musicRecommendation/feedbackService.spec.ts
Consolidated multiple empty-result tests for undefined userId and parameterized preferred vs. blocked artist key selection assertions, eliminating duplicate empty-set coverage.
Track-weight decay and empty-map parameterization
packages/bot/src/services/musicRecommendation/feedbackService.spec.ts
Converted liked/disliked track weight decay tests into it.each to validate the same decay expectations for both feedback types, with parameterized empty-map assertions for undefined user IDs.
Implicit feedback behavior and redis error handling
packages/bot/src/services/musicRecommendation/feedbackService.spec.ts
Reworked implicit feedback tests with parameterized key retrieval (like/dislike), retained trimming validation (≤200 entries), and consolidated redis-error cases. Updated recordImplicitFeedback error assertions to use resolves expectations.
Postgres error handling consolidation
packages/bot/src/services/musicRecommendation/feedbackService.spec.ts
Replaced two separate Postgres-error graceful tests for preferred and blocked artist getters with a single it.each covering both paths. Cosmetically reformatted Redis mock setup in the related test.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • LucasSantana-Dev/Lucky#577: Introduces implicit feedback recording behavior (recordImplicitFeedback, getImplicitLikeKeys/getImplicitDislikeKeys) in feedbackService and autoplay logic, which aligns with this PR's test consolidation of implicit feedback coverage.
🚥 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 feedbackService tests' accurately and concisely summarizes the main change: removing and consolidating redundant tests in the feedbackService test suite.
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/batch5-feedbackService

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.

@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 4:03pm

Request Review

@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.

@sonarqubecloud

Copy link
Copy Markdown

@LucasSantana-Dev
LucasSantana-Dev merged commit f288c67 into main May 24, 2026
31 of 32 checks passed
@LucasSantana-Dev
LucasSantana-Dev deleted the test/batch5-feedbackService branch May 24, 2026 16:10

This branch was successfully deployed

1 active deployment
Preview — 07d65a85 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