Write per-track match diagnostics to a file instead of relying on HA's log #55

Merged
neerdoc merged 1 commit from macsome_14 into main 2026-08-02 21:22:36 +00:00
Owner

Despite the last two rounds of fixes, manual verification is still
finding the large majority of "wanted" tracks already own in Plex (e.g.
82+/90 in the last audit). HA's own log rotates/truncates too fast to
reliably capture and grep a full sync's worth of matching decisions,
which has made root-causing this by log excerpt alone unreliable.

_plex_find() now writes a full diagnostic line per track to
match_debug.log, created next to engine.py in the installed integration
folder (not subject to HA's log rotation or level config), truncated at
the start of every match_and_build() run so it always holds exactly the
latest sync's decisions:

  • MATCH: playlist, track, score, matched Plex ratingKey, and which
    candidate field/artist variant won.
  • NO MATCH: every Plex search hit returned for that title, with its
    title/album/grandparentTitle/originalTitle and computed score per
    candidate — so a false negative can be diagnosed directly instead of
    guessed at.

Co-Authored-By: Claude Sonnet 5 noreply@anthropic.com

Despite the last two rounds of fixes, manual verification is still finding the large majority of "wanted" tracks already own in Plex (e.g. 82+/90 in the last audit). HA's own log rotates/truncates too fast to reliably capture and grep a full sync's worth of matching decisions, which has made root-causing this by log excerpt alone unreliable. _plex_find() now writes a full diagnostic line per track to match_debug.log, created next to engine.py in the installed integration folder (not subject to HA's log rotation or level config), truncated at the start of every match_and_build() run so it always holds exactly the latest sync's decisions: - MATCH: playlist, track, score, matched Plex ratingKey, and which candidate field/artist variant won. - NO MATCH: every Plex search hit returned for that title, with its title/album/grandparentTitle/originalTitle and computed score per candidate — so a false negative can be diagnosed directly instead of guessed at. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Despite the last two rounds of fixes, manual verification is still
finding the large majority of "wanted" tracks already own in Plex (e.g.
82+/90 in the last audit). HA's own log rotates/truncates too fast to
reliably capture and grep a full sync's worth of matching decisions,
which has made root-causing this by log excerpt alone unreliable.

_plex_find() now writes a full diagnostic line per track to
match_debug.log, created next to engine.py in the installed integration
folder (not subject to HA's log rotation or level config), truncated at
the start of every match_and_build() run so it always holds exactly the
latest sync's decisions:

- MATCH: playlist, track, score, matched Plex ratingKey, and which
  candidate field/artist variant won.
- NO MATCH: every Plex search hit returned for that title, with its
  title/album/grandparentTitle/originalTitle and computed score per
  candidate — so a false negative can be diagnosed directly instead of
  guessed at.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign in to join this conversation.
No reviewers
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
WulfScience-FOSS/ha-music-own!55
No description provided.