Share ISRC canonicalization between matching and conflict reporting #47

Closed
opened 2026-09-05 22:42:20 +00:00 by tophattedcat · 0 comments
Owner

Problem

MatchIndex canonicalizes ISRCs with upper() only. Reporting's isrcs_equal also removes hyphens. The same pair can therefore be considered equivalent in reporting while failing automatic ISRC matching.

Reproduced with local ISRC US-ABC-12-34567 and Apple ISRC USABC1234567, with different metadata to isolate ISRC matching: reporting equality was true and matching returned unmatched.

Proposed change

Define one ISRC canonicalization helper in a suitable shared policy module and use it for both index construction/lookups and conflict reporting. Canonicalization must not rewrite non-empty local metadata.

Acceptance criteria

  • Case and hyphen variants resolve consistently in matching and reporting.
  • Multiple items sharing the canonical ISRC remain ambiguous.
  • Missing ISRC behavior and local-metadata precedence remain unchanged.
  • Add a focused failing regression, then run matching/reporting and full tests.

References: beetsplug/appleplaylists/matching.py:94-95,111-120, reporting.py:43-56. Audit finding 6 (medium).

## Problem MatchIndex canonicalizes ISRCs with upper() only. Reporting's isrcs_equal also removes hyphens. The same pair can therefore be considered equivalent in reporting while failing automatic ISRC matching. Reproduced with local ISRC US-ABC-12-34567 and Apple ISRC USABC1234567, with different metadata to isolate ISRC matching: reporting equality was true and matching returned unmatched. ## Proposed change Define one ISRC canonicalization helper in a suitable shared policy module and use it for both index construction/lookups and conflict reporting. Canonicalization must not rewrite non-empty local metadata. ## Acceptance criteria - Case and hyphen variants resolve consistently in matching and reporting. - Multiple items sharing the canonical ISRC remain ambiguous. - Missing ISRC behavior and local-metadata precedence remain unchanged. - Add a focused failing regression, then run matching/reporting and full tests. References: `beetsplug/appleplaylists/matching.py:94-95,111-120`, `reporting.py:43-56`. Audit finding 6 (medium).
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
coop/beets-appleplaylists#47
No description provided.