/
/
# What does this implement/fix? Refreshing a track could silently strip its album and artist bare. Most music providers attach a stripped-down album (and artist) to every track they hand over — often just a name and an id. Refreshing a track fed that stub straight into the library, where it replaced the real album: the release year, barcode and MusicBrainz ids, genres and artwork were all dropped, and the album lost its links to the other services it had been matched to. The same happened to the track's artist, biography and all. The catch is that replacing an item *is* wanted in other cases — it is how a local file that moved to a new folder gets its old entry cleaned up. So instead of skipping the replace, an update now only replaces the details it actually carries, and only unlinks the service it came from. **Related issue (if applicable):** - https://github.com/music-assistant/server/issues/5853 ## Types of changes - [x] Bugfix (non-breaking change which fixes an issue) — `bugfix` - [ ] New feature (non-breaking change which adds functionality) — `new-feature` - [ ] Enhancement to an existing feature — `enhancement` - [ ] New music/player/metadata/plugin provider — `new-provider` - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) — `breaking-change` - [ ] Refactor (no behaviour change) — `refactor` - [ ] Documentation only — `documentation` - [ ] Maintenance / chore — `maintenance` - [ ] CI / workflow change — `ci` - [ ] Dependencies bump — `dependencies` Changes: - An album or artist keeps its stored artwork, genres and description when the incoming item has none. An empty artwork list does not count as artwork. - An album keeps its release year and edition (Deluxe, Remastered) when the incoming item has none. - Items keep their stored barcode and MusicBrainz ids when the incoming item has none. - A replacing update now only drops the links of the service it came from, so links to other services survive. A moved local file still cleans up its own stale entry. - Same guards for albums, artists and tracks; radio stations keep their existing behaviour, where a station going dynamic deliberately sheds the other services. ## Checklist - [x] The code change is tested and works locally. - [x] `pre-commit run --all-files` passes. - [x] `pytest` passes, and tests have been added/updated under `tests/` where applicable. - [ ] For changes to shared models, the companion PR in `music-assistant/models` is linked. - [ ] For changes affecting the UI, the companion PR in `music-assistant/frontend` is linked. - [x] I have read and complied with the project's [AI Policy](https://github.com/music-assistant/.github/blob/main/AI_POLICY.md) for any AI-assisted contributions. - [ ] I have [raised a PR against the documentation repository](https://github.com/music-assistant/music-assistant.io/blob/main/CONTRIBUTING.md) targeting the main or beta branch as appropriate.