fix: duplicate album merge broken in threaded import mode - #6623
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
PR try fix bug #6601 where duplicate album MERGE in threaded import lose music_dir context, so db-relative paths stay relative and file ops fail.
Changes:
- Add
contextvarsimport in importer stages. - Change
_extend_pipelineto snapshot current context and run inner pipeline inside it.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| docs/changelog.rst | Add unreleased bug-fix note for threaded duplicate merge issue (#6601). |
| beets/importer/stages.py | Capture current contextvars context around nested pipeline execution in _extend_pipeline. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6623 +/- ##
==========================================
+ Coverage 72.43% 72.44% +0.01%
==========================================
Files 160 160
Lines 20681 20690 +9
Branches 3272 3272
==========================================
+ Hits 14980 14989 +9
Misses 4976 4976
Partials 725 725
🚀 New features to boost your workflow:
|
Contributor
Author
|
Yes, I'm using this branch and it works perfectly. Feel free to test it out. |
snejus
requested changes
May 13, 2026
snejus
reviewed
May 17, 2026
| """Regression test for #6601: threaded merge must propagate context vars.""" | ||
|
|
||
| plugin = "musicbrainz" | ||
| # Each thread gets its own connection; :memory: would give each thread an |
snejus
approved these changes
May 17, 2026
|
@snejus when could we have a new release with this one? |
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.
Fixes #6601
Added
import contextvarsand changed_extend_pipelineto capture the current context and run the inner pipeline within it to ensure themusic_dircontext variable is available when the inner pipeline resolves paths, preventing the relative-path bug that caused could not get filesize errors and removing 0 old duplicated items during merge.Works perfectly after the fix:
docs/changelog.rstto the bottom of one of the lists near the top of the document.)