4.4 KiB
4.4 KiB
phase, plan, subsystem, tags, dependency_graph, tech_stack, key_files, decisions, metrics
| phase | plan | subsystem | tags | dependency_graph | tech_stack | key_files | decisions | metrics | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| quick-19 | 19 | playlist |
|
|
|
|
|
|
Quick Task 19: Fix Phantom Playlist Tracks Summary
Multi-root M3U8 path resolution replacing single-library getLibraryRoot() with getAllLibraryRoots() across all playlist path operations.
What Changed
Task 1: Multi-root path resolution in m3u.go and playlist.go (9144ded)
m3u.go — New functions:
resolveM3UPath(relativePath, libraryRoots, knownPaths)— resolves a relative M3U path against multiple roots, returning the first absolute path found in the knownPaths set. Falls back to first root for phantom tracks.toRelativePathMultiRoot(absolutePath, libraryRoots)— converts an absolute path to relative using the first root that contains it.
m3u.go — Updated signatures:
removeM3UEntries—libraryRoot string→libraryRoots []stringreplaceM3UEntryPaths—libraryRoot string→libraryRoots []stringfindM3UEntry—libraryRoot string→libraryRoots []string
playlist.go — Core change:
- Replaced
getLibraryRoot() stringwithgetAllLibraryRoots() []string— queries all libraries from DB (or falls back to legacy config)
playlist.go — 8 call sites updated:
mergeTracksForPlaylist— builds knownPaths set from dbTracks, uses resolveM3UPathImportPlaylist— tries each root via GetAudioFileByPath until match foundRestoreAllPlaylists— passes libraryRoots to restoreSinglePlaylistrestoreSinglePlaylist— tries each root for each M3U8 entrybuildM3UEntries— uses toRelativePathMultiRoot for correct relative paths per tracksaveImportedPlaylistFile— uses toRelativePathMultiRootFindPhantomMatches— uses resolveM3UPath for entry lookupGetPhantomCandidates— passes libraryRoots to findM3UEntryResolvePhantomTracks— uses toRelativePathMultiRoot and multi-root replaceM3UEntryPathsRemovePhantomTracks— passes libraryRoots to removeM3UEntries
Task 2: Multi-root path resolution tests (a902850)
Added 5 new test functions with 20 test cases:
TestResolveM3UPath— 7 cases covering abs paths, multi-root resolution, fallback, nil/emptyTestToRelativePathMultiRoot— 5 cases covering first root, second root, no match, emptyTestRemoveM3UEntriesMultiRoot— entries from different roots correctly removedTestFindM3UEntryMultiRoot— entry under second root found correctlyTestReplaceM3UEntryPathsMultiRoot— replacement under second root applied
Updated 5 existing tests for new []string parameter types.
Deviations from Plan
Auto-fixed Issues
1. [Rule 3 - Blocking] Pre-existing golines formatting in scan_queue.go
- Found during: Task 1 commit
- Issue:
golangci-lintpre-commit hook checks all Go files, not just staged;scan_queue.gohad a line too long for golines - Fix: Split the SQL string literal across multiple lines
- Files modified: backend/library/scan_queue.go
- Commit:
9144ded(included in Task 1)
2. [Rule 3 - Blocking] Existing tests use old single-root signatures
- Found during: Task 1
- Issue: Changing function signatures broke existing test compilation, blocking the commit
- Fix: Updated 5 existing test call sites from
stringto[]string{...}(merged into Task 1 instead of waiting for Task 2) - Files modified: backend/playlist/m3u_test.go
- Commit:
9144ded
Verification Results
go build ./backend/...— PASSgo vet ./backend/playlist/...— PASSgo test ./backend/playlist/...— PASS (38 tests)go test ./backend/...— PASS (all packages, no regressions)golangci-lint— PASS (0 issues)