From 6672bb52efb2532d17af19efad284490e310c26b Mon Sep 17 00:00:00 2001 From: Deluan Date: Fri, 19 Jun 2026 13:43:27 -0400 Subject: [PATCH] refactor(lyrics): address review feedback on sidecar FS read MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Move blank local-storage import from sources.go into lyrics_suite_test.go (the test suite already imports the local package for RegisterExtractor, so local's init() runs; production binaries get the scheme via normal wiring) - Fix misleading comment: model.ParseLyrics → model.ParseLyricsFile - Replace what-comment with why-comment in BeforeSuite explaining the log.Fatal guard that requires the no-op extractor registration --- core/lyrics/lyrics_suite_test.go | 5 +++-- core/lyrics/sources.go | 1 - core/lyrics/sources_test.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/core/lyrics/lyrics_suite_test.go b/core/lyrics/lyrics_suite_test.go index e7230ab6e..c9fdcbae8 100644 --- a/core/lyrics/lyrics_suite_test.go +++ b/core/lyrics/lyrics_suite_test.go @@ -20,8 +20,9 @@ func TestLyrics(t *testing.T) { RunSpecs(t, "Lyrics Suite") } -// Register a no-op extractor so that storage.For("file://...") works in tests. -// The lyrics package only needs FS() for sidecar reads; ReadTags is never called. +// core/storage/local calls log.Fatal if the default scanner extractor is unregistered +// when constructing any localStorage. Register a no-op so storage.For("file://...") works +// in tests without importing the real extractor. var _ = BeforeSuite(func() { local.RegisterExtractor(consts.DefaultScannerExtractor, func(fs.FS, string) local.Extractor { return &noopExtractor{} diff --git a/core/lyrics/sources.go b/core/lyrics/sources.go index d19b0e92d..3476230a5 100644 --- a/core/lyrics/sources.go +++ b/core/lyrics/sources.go @@ -9,7 +9,6 @@ import ( "path" "github.com/navidrome/navidrome/core/storage" - _ "github.com/navidrome/navidrome/core/storage/local" "github.com/navidrome/navidrome/log" "github.com/navidrome/navidrome/model" "github.com/navidrome/navidrome/utils/ioutils" diff --git a/core/lyrics/sources_test.go b/core/lyrics/sources_test.go index 1f2249478..06dcb2602 100644 --- a/core/lyrics/sources_test.go +++ b/core/lyrics/sources_test.go @@ -74,7 +74,7 @@ var _ = Describe("sources", func() { Expect(lyrics).To(HaveLen(0)) }) - // fromExternalFile delegates format parsing to model.ParseLyrics; the + // fromExternalFile delegates format parsing to model.ParseLyricsFile; the // per-format parser output is covered exhaustively in the model package. // Here we only verify each suffix is read from the library FS and routed. DescribeTable("should read the sidecar file and route its suffix to a parser",