CMRT 31: Fixups addCmrtMember + stem canonical pref + Clear MusicBrainz Data + CMRT/MBQueue refresh fix + MBQueue status text/rendering fix - #46
Open
Swarnadip-Kar wants to merge 9 commits into
Conversation
Swarnadip-Kar
force-pushed
the
cmrt-fixups-stem-mbclear-refresh
branch
from
July 9, 2026 17:42
73d396c to
9b719c8
Compare
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.
Five items bundled into one PR -- two flagged
fixups, one new preference, one new track-menu action,
one refresh bug fix.
A — Fixups
addCmrtMember()'s null-or-value binding restructured into temp
variables (mentor-suggested pattern).
B — Stem-aware canonical scoring
New preference (off by default): "Allow stem files to become the
canonical track (CMRT)." QualityScorer's format table doesn't recognize
"stem" as a filetype and was defaulting stems to the mp3-tier
score (50.0) -- letting a stem win or tie a canonical
election. Off, a stem's score is clamped to 0.0, so any real-format
competitor always outscores it, and two competing stems tie at 0.0 (the
existing ">" comparison already keeps whichever got there first -- no new
branching needed). The first track fingerprinted for any mastering still
always becomes canonical regardless of stem-ness; this only changes what
happens when a second track later matches into its group.
but the clamp is now comparison-only.
A stem's real QualityScorer score is always written to
cmrt_members/fingerprint_metadata -- the 0.0 clamp only ever decides who
wins a canonical election, it is never what gets stored for either
track. This was a correctness bug in the original draft: as written, a
stem's true score would have been overwritten with 0.0 in the database
itself.
C — Clear > MusicBrainz Data
New TrackDAO::clearMusicBrainzData() nulls every MBID/AcoustID column
(including acoustid_lookup_at, which updateAcoustIdResult() can't null --
it stamps that column with the current time unconditionally). Recovers
tracks whose lookup status is stuck at 'completed' with partially-correct
MBIDs, which were previously invisible to both the MBQueue view and the
worker's polling query. New WTrackMenu action mirrors Clear > Fingerprint;
standalone use re-queues for a fresh lookup, Clear > All does not (the
fingerprint is already gone by that point in the same action).
D — CMRT column refresh fix
The CMRT column comes from library_view's own joined SQL, cached once per
BaseSqlTableModel::select() -- unlike key/bpm (BaseTrackCache-backed),
it doesn't refresh on a plain dataChanged() signal, which is why it only
ever updated after an action that happens to trigger a full re-select
(sorting, switching sidebar tabs, toggling a column). Added
AcoustIdWorker::cmrtDataChanged(), emitted after each
CmrtGroupingService::processTrack() call, forwarded (signal-to-signal)
through a matching TrackCollectionManager::cmrtDataChanged() signal into
Library's existing slotRefreshLibraryModels() -- the same slot already
used for libraryScanFinished(), not a new refresh mechanism.
DlgPrefFingerprint::slotClearAllFingerprints() and
WTrackMenu::clearFingerprintDataForSelection() (Clear > Fingerprint /
Clear > All) had the identical stale-column problem and are fixed the
same way. The MBQueue panel had the same class of bug for a different
table (musicbrainz_queue_view, not the CMRT column) -- forwarded the
worker's existing queueDrained() through a new
TrackCollectionManager::acoustIdQueueDrained() signal so
DlgMusicBrainzQueue can re-select its own table model once per finished
batch instead of only on button clicks.
E — MBQueue Status column text fix
Separate, non-refresh bug found while reviewing the MBQueue files:
MusicBrainzQueueTableModel::rawValue() only mapped the NULL status case
to "pending" and passed every other status ("queued"/"failed"/
"unmatched") straight through as raw DB tokens, even though the comment
in AcoustIdWorker::processJob() explicitly says the view is supposed to
show "no match" vs "lookup failed" as distinct, readable text. Added the
missing mapping.
E-followup — MBQueue Status column rendering fix
The Status cell was rendering inside a boxed/bordered shape with a
leading gap before the text, unlike other columns. Root cause:
BaseTrackTableModel::roleValue() returned rawValue unconditionally for
columns mapping to COLUMN_LIBRARYTABLE_INVALID (i.e. columns whose name
isn't in ColumnCache::kColumnPropertiesByEnum, like "status"). For
Qt::DecorationRole, this caused Qt to interpret the status text string
as a decoration icon, rendering an empty black rectangle with reserved
space. Fixed in basetracktablemodel.cpp by guarding the early return to
only pass rawValue for display/tooltip/edit/export roles.
Depends on: cmrt-fixup-per-field-toggles-quality-score (#41)