Conversation
- Add searchalbum track count display (e.g., "17 tracks") - Add validators: queueSizeIncreaseExactly, extractAndStoreTrackCount, queueSizeIncreasedByStoredCount - Verify add command increases queue by exactly 1 - Search album/playlist before adding to get expected track count - Verify actual increase matches expected (catches duplicate queueing bugs) - Add three-level output: exact (silent), within tolerance (warning), outside tolerance (fail) - Show detailed baseline → actual numbers in warnings/errors
|
You have run out of free Bugbot PR reviews for this billing cycle. This will reset on February 11. To receive reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial. |
There was a problem hiding this comment.
Pull request overview
This PR enhances the integration test suite with sophisticated queue size validation to detect duplicate queueing bugs, and adds track count display to album search results.
Changes:
- Added three-level queue size validation (exact match, warning, fail) with tolerance handling for edge cases
- Introduced track count extraction from search results and validation against actual queue changes
- Enhanced
searchalbumcommand to display track counts for each album result - Modified Spotify API integration to include
totalTracksfield in album search results
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| test/tools/integration-test-suite.mjs | Added validators for exact queue size verification, track count extraction, and validation with configurable tolerance to catch duplicate queueing bugs |
| lib/spotify.js | Added totalTracks field to album search results with null-safe default value |
| lib/command-handlers.js | Updated searchalbum to display track counts alongside album names |
| const tolerance = Math.floor(exactIncrease * 0.9); | ||
| if (actualIncrease >= tolerance && actualIncrease < exactIncrease) { | ||
| console.log(` ⚠️ WARNING: Queue increased by ${actualIncrease} (expected ${exactIncrease}, baseline: ${baseline} → ${size})`); | ||
| return true; |
There was a problem hiding this comment.
The tolerance calculation can produce incorrect results for small values of exactIncrease. When exactIncrease is 1, tolerance becomes Math.floor(0.9) = 0, which means an actualIncrease of 0 would trigger a warning and pass instead of failing. For small exact values (1-2 tracks), the 90% tolerance doesn't make sense. Consider using a minimum absolute tolerance (e.g., Math.max(1, Math.floor(exactIncrease * 0.9))) or disabling tolerance for small values.
| const tolerance = Math.floor(exactIncrease * 0.9); | |
| if (actualIncrease >= tolerance && actualIncrease < exactIncrease) { | |
| console.log(` ⚠️ WARNING: Queue increased by ${actualIncrease} (expected ${exactIncrease}, baseline: ${baseline} → ${size})`); | |
| return true; | |
| // Disable tolerance for very small expected increases (1-2 tracks), | |
| // where a "90%" tolerance would allow clearly incorrect results (e.g., 0 of 1). | |
| if (exactIncrease >= 3) { | |
| const tolerance = Math.floor(exactIncrease * 0.9); | |
| if (actualIncrease >= tolerance && actualIncrease < exactIncrease) { | |
| console.log(` ⚠️ WARNING: Queue increased by ${actualIncrease} (expected ${exactIncrease}, baseline: ${baseline} → ${size})`); | |
| return true; | |
| } |
lib/command-handlers.js
Outdated
| const trackInfo = albumResult.totalTracks ? ` (${albumResult.totalTracks} tracks)` : ''; | ||
| message += `> *${albumResult.name}* by _${albumResult.artist}_${trackInfo}\n`; |
There was a problem hiding this comment.
The track count display always uses "tracks" (plural) even when totalTracks is 1, which would show "(1 tracks)". For consistency with other parts of this file (see lines 437 and 606), consider using conditional pluralization: (${albumResult.totalTracks} ${albumResult.totalTracks === 1 ? 'track' : 'tracks'})
| const trackInfo = albumResult.totalTracks ? ` (${albumResult.totalTracks} tracks)` : ''; | |
| message += `> *${albumResult.name}* by _${albumResult.artist}_${trackInfo}\n`; | |
| const trackInfo = albumResult.totalTracks | |
| ? ` (${albumResult.totalTracks} ${albumResult.totalTracks === 1 ? 'track' : 'tracks'})` | |
| : ''; | |
| message += `> *${albumResult.name}* by _${albumResult.artist_${trackInfo}\n`; |
- Disable tolerance for small exact values (1-2 tracks) to prevent accepting 0 when expecting 1 - Fix pluralization in searchalbum: '1 track' instead of '1 tracks'
Summary
lib/folder for cleaner project structurelib/add-handlers.jswith add/addalbum/addplaylist/append commands.map()with.forEach()for side effects, fix duplicate playlist queueing bugTest improvements
addalbumandaddplaylistwith queue size verificationWorkflow fixes
Changes
lib/