Repository navigation
Conversation
A Local files track kept its link to an album after the file's album tag was changed or removed, because a rescan only ever adds album links. The "Reconcile duplicate albums" task then re-read such a file through get_album, hit an assert on the missing album and aborted entirely. - get_album skips a file whose tags no longer name an album and ends in MediaNotFoundError instead of an AssertionError - a sync of a changed file unlinks its track from this source's albums the file no longer names; albums left empty are removed by the existing orphan cleanup - add TracksController.remove_album_link Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014D4KvsSm7CAASBQFYcBLjT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014D4KvsSm7CAASBQFYcBLjT
Contributor
|
✅ The title and description are good to go. Thanks! |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The rescan cleanup can unlink valid sibling-file album associations and delete shared albums, including other-source mappings and user favorites.
3 open issues
What changed in this PR
This PR addresses stale album associations after local-file album tags change or are removed, and prevents missing album tags from aborting album reconciliation.
Changes:
- Handles missing album tags with the existing not-found error.
- Adds stale-link cleanup during local-file sync and a controller method to remove individual links and invalidate cached listings.
- Adds regression tests for tag changes, shared sources, multiple files, and missing albums.
| File | Description |
|---|---|
tests/providers/filesystem_local/test_stale_album_links.py |
Adds regression coverage for stale album links and missing tags. |
music_assistant/providers/filesystem_local/__init__.py |
Handles missing album tags and reconciles links after rescanning changed files. |
music_assistant/controllers/music/media/tracks.py |
Adds single-link removal with album and track listing invalidation. |
Review effort: Balanced
This comment was marked as outdated.
This comment was marked as outdated.
- capture the library track before the changed file overwrites it, so a second file of the same track is still seen by the guard - never unlink an album that also has a mapping on another source, so the orphan cleanup can not remove a shared album - read the track's albums through TracksController.get_library_track_albums (new unfiltered option) instead of querying album_tracks in the provider - stub the cache delete in the tests and cover both shared-album variants Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014D4KvsSm7CAASBQFYcBLjT
OzGav
marked this pull request as ready for review
November 12, 2026 06:01
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What does this implement/fix?
When the album tag of a Local files track was changed or removed, the library kept the track's link to its old album. A rescan only ever adds album links (
_set_track_albuminserts intoalbum_tracksand never removes rows, and_update_library_itemskips the album step entirely when the new tags have no album).The "Reconcile duplicate albums" task then re-read such a file through the provider's
get_album, hitassert isinstance(full_track.album, Album), and the bareAssertionErrorescaped every handler, aborting the whole task with an emptyfailed:message on every run.Changes:
filesystem_local.get_albumskips a file whose tags no longer name an album and ends in the existingMediaNotFoundError, which the enrichment and reconcile paths already handle._unlink_stale_albums). Albums left empty are removed by the existing end-of-sync orphan cleanup. The link is left alone when the track has more than one file on this source, or when both the track and the album are also on another source, since that source may still place the track on the album.TracksController.remove_album_linkto drop a single track/album link and invalidate both cached listings.No migration: existing stale links clear up once the affected file is changed and rescanned, or by removing the stale album and syncing again.
Reported in https://github.com/orgs/music-assistant/discussions/7058 (traceback there points at the same assert on
stable).Related issue (if applicable):
Types of changes
bugfixnew-featureenhancementnew-providerbreaking-changerefactordocumentationmaintenancecidependenciesChecklist
pre-commit run --all-filespasses.pytestpasses, and tests have been added/updated undertests/where applicable.music-assistant/modelsis linked.music-assistant/frontendis linked.Tests were added in
tests/providers/filesystem_local/test_stale_album_links.pybut have not been run locally yet; relying on CI for this draft.Generated by Claude Code