Skip to content

CMRT 28: DAO: Quality-based canonical re-election on track deletion - #37

Open
Swarnadip-Kar wants to merge 1 commit into
cmrt-pipeline-groupingfrom
cmrt-canonical-reelection
Open

CMRT 28: DAO: Quality-based canonical re-election on track deletion#37
Swarnadip-Kar wants to merge 1 commit into
cmrt-pipeline-groupingfrom
cmrt-canonical-reelection

Conversation

@Swarnadip-Kar

@Swarnadip-Kar Swarnadip-Kar commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Finishes the TODO(XXX) left in clearFingerprintData()
"Update this logic to select next canonical track ... instead of just
promoting the first member found in the group."

Changes

When the canonical track of a group is deleted:

  1. Look at every other member's quality_score; highest wins.
  2. Promote it via updateCanonicalTrack() + saveFingerprintMetadata()
    (is_canonical=1, cmrt_offset_seconds=0) + updateMemberOffset()
    (offset_from_canonical=0) -- all three methods already exist from
    CMRT 27, so this PR adds zero new DAO surface.
  3. Recompute every other remaining member's offset against the new
    canonical's .chroma file via FingerprintMatcher::compare().
  4. Unchanged: if there are no other members, delete the now-empty group.

Notes for reviewers

  • Tie-breaking on quality_score is "first highest wins" (>, not >=) --
    not expected to matter since identical scores would need byte-identical
    files, which the SHA-256 cache already catches elsewhere, but noted in
    case that assumption doesn't hold for some library.
  • Same O(member count) .chroma-read cost as CmrtGroupingService::
    replaceCanonical() in CMRT 27, for the same reason (small group sizes
    expected in practice).
  • All of this still runs inside clearFingerprintData()'s existing
    ScopedTransaction -- no new transaction boundaries, every new early
    return relies on the same rollback-on-destruct behavior the rest of the
    function already does.

Depends on: cmrt-pipeline-grouping (#36)

@coveralls

coveralls commented Jun 20, 2026

Copy link
Copy Markdown

Coverage Report for CI Build 27872505024

Coverage increased (+4.2%) to 34.491%

Details

  • Coverage increased (+4.2%) from the base build.
  • Patch coverage: 48 uncovered changes across 1 file (0 of 48 lines covered, 0.0%).
  • No coverage regressions found.

Uncovered Changes

File Changed Covered %
src/library/dao/trackfingerprintdao.cpp 48 0 0.0%

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 89209
Covered Lines: 30769
Line Coverage: 34.49%
Coverage Strength: 77204.85 hits per line

💛 - Coveralls

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants