Plugin: close remaining SPEC correctness gaps #41

Merged
hermes merged 2 commits from post-review-correctness into main 2026-09-05 22:01:21 +00:00
Owner

Summary

  • keep plugin resolution state aligned when an explicit or interactive match moves a beets item from one Apple track to another
  • mark retained displaced tracks according to their remaining association count (unmatched, matched, or ambiguous) while marking the selected track matched
  • preserve a displaced track's permanent skip until that Apple track is explicitly matched
  • tolerate historical beets associations whose Apple ID is not present in plugin state
  • reject duplicate occurrence positions before opening or mutating any local store

Closes #39
Closes #40

TDD evidence

  • The displaced-state regressions failed against current main because the former Apple track remained matched; both explicit and interactive workflows now pass.
  • The duplicate-position regression failed through the late SQLite constraint path after automatic association; it now receives an actionable prevalidation error and verifies beets metadata, plugin-state bytes, and playlistmanager contents are unchanged.

Validation

  • pytest -q -W error: 104 passed
  • Ruff 0.16.4 lint checks on all changed files
  • Ruff formatting checks on the issue #40 runtime/test files
  • python -m compileall -q beetsplug tests
  • isolated-BEETSDIR beet -p appleplaylists apple --help
  • source distribution and wheel build
  • git diff --check
## Summary - keep plugin resolution state aligned when an explicit or interactive match moves a beets item from one Apple track to another - mark retained displaced tracks according to their remaining association count (`unmatched`, `matched`, or `ambiguous`) while marking the selected track `matched` - preserve a displaced track's permanent skip until that Apple track is explicitly matched - tolerate historical beets associations whose Apple ID is not present in plugin state - reject duplicate occurrence positions before opening or mutating any local store Closes #39 Closes #40 ## TDD evidence - The displaced-state regressions failed against current `main` because the former Apple track remained `matched`; both explicit and interactive workflows now pass. - The duplicate-position regression failed through the late SQLite constraint path after automatic association; it now receives an actionable prevalidation error and verifies beets metadata, plugin-state bytes, and playlistmanager contents are unchanged. ## Validation - `pytest -q -W error`: 104 passed - Ruff 0.16.4 lint checks on all changed files - Ruff formatting checks on the issue #40 runtime/test files - `python -m compileall -q beetsplug tests` - isolated-`BEETSDIR` `beet -p appleplaylists apple --help` - source distribution and wheel build - `git diff --check`
hermes force-pushed post-review-correctness from 5ca0d2c14f to 11aaab75cc 2026-09-05 21:56:36 +00:00 Compare
hermes force-pushed post-review-correctness from 11aaab75cc to ed04e9d1c0 2026-09-05 21:59:31 +00:00 Compare
hermes merged commit e4fbbffd4a into main 2026-09-05 22:01:21 +00:00
Author
Owner

Late independent review inspected superseded commit 13b093c and flagged that it cleared a displaced track's permanent skip. This was already corrected before merge in final issue #39 commit cc124c9: _save_association_states leaves resolution_state = skipped unchanged, and test_explicit_match_preserves_displaced_permanent_skip covers the case. The merged main at e4fbbffd4a0bf744d4967c6bfb03e4ffe369869a contains that guard.

The independent review found no correctness or security issue in the issue #40 duplicate-position validation.

Late independent review inspected superseded commit `13b093c` and flagged that it cleared a displaced track's permanent skip. This was already corrected before merge in final issue #39 commit `cc124c9`: `_save_association_states` leaves `resolution_state = skipped` unchanged, and `test_explicit_match_preserves_displaced_permanent_skip` covers the case. The merged `main` at `e4fbbffd4a0bf744d4967c6bfb03e4ffe369869a` contains that guard. The independent review found no correctness or security issue in the issue #40 duplicate-position validation.
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
coop/beets-appleplaylists!41
No description provided.