Skip to content

fix(spotify): report tracks skipped by spotifysync - #7206

Closed
Taiwudao wants to merge 1 commit into
beetbox:masterfrom
Taiwudao:fix/spotifysync-skip-report
Closed

Taiwudao wants to merge 1 commit into
beetbox:masterfrom
Taiwudao:fix/spotifysync-skip-report

Conversation

@Taiwudao

Copy link
Copy Markdown

Closes #7158.

beet spotifysync skips every track that has no spotify_track_id, but the only trace of that was a debug-level line:

            try:
                spotify_track_id = item.spotify_track_id
            except AttributeError:
                self._log.debug("No track_id present for: {}", item)
                continue

At the default verbosity the command prints Processing 1/10 tracks - ... for each item and exits normally, so a library whose tracks were imported from MusicBrainz (or with import -A) looks like it synced successfully while nothing was requested at all.

Change

Count the skipped tracks and print one info-level line after the loop:

Skipped 3 track(s) without a spotify_track_id.

Info rather than warning, since having no Spotify id is a normal state for tracks that were not imported through the plugin - the user just needs to be told that they were not processed.

Tests

Added test_fetch_info_reports_tracks_without_id: an item without the field, _fetch_info called with force=True, asserting the message appears at INFO level. No HTTP mock is needed because the method returns before any request.

pytest test/plugins/test_spotify.py 14 passed
reverse check reverting spotify.py fails the new test

Changelog entry added under Unreleased -> Bug fixes.

@Taiwudao
Taiwudao requested a review from a team as a code owner November 21, 2026 05:59
`beet spotifysync` skips every track that has no `spotify_track_id`, but
it only said so at debug level. At the default verbosity the command printed
"Processing ..." for each track and exited normally, so it looked like the
data had been fetched when nothing was actually requested (see beetbox#7158).

Count those tracks and print one info-level line:

    Skipped 3 track(s) without a spotify_track_id.

Adds a test asserting the message is emitted for an item without the field.
@snejus

snejus commented Nov 21, 2026

Copy link
Copy Markdown
Member

See our AI Policy.

@snejus snejus closed this Nov 21, 2026
@codecov

codecov Bot commented Nov 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.93%. Comparing base (718dc3a) to head (ea6e40d).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #7206      +/-   ##
==========================================
+ Coverage   80.88%   80.93%   +0.04%     
==========================================
  Files         150      150              
  Lines       21247    21251       +4     
  Branches     3246     3247       +1     
==========================================
+ Hits        17186    17199      +13     
+ Misses       3250     3242       -8     
+ Partials      811      810       -1     
Files with missing lines Coverage Δ
beetsplug/spotify.py 65.43% <100.00%> (+1.59%) ⬆️

... and 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Track Skipping without reporting to user.

2 participants