From d27ef174765bde5224260905524e47bcb558f500 Mon Sep 17 00:00:00 2001 From: Deluan Date: Fri, 14 Aug 2026 17:44:57 -0400 Subject: [PATCH] fix(cli): accept --source absent when nothing is currently absent validateSources checks the requested sources against the ones item_artwork actually uses, to catch a typo. The reserved empty source (spelled 'absent' on the CLI) is a valid filter even when it matches nothing, so a scheduled 'artwork reprocess --source absent --yes' stopped working the moment the library finished resolving. Treat it as intrinsically valid and let the existing zero-match path report it. --- cmd/artwork.go | 2 +- cmd/artwork_test.go | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/cmd/artwork.go b/cmd/artwork.go index 0757c0e52..d6365536d 100644 --- a/cmd/artwork.go +++ b/cmd/artwork.go @@ -374,7 +374,7 @@ func validateSources(q model.ArtworkQueueRepository, sources []string) error { } var unknown []string for _, s := range sources { - if !slices.Contains(inUse, s) { + if s != "" && !slices.Contains(inUse, s) { // the reserved absent source is valid even when nothing is absent unknown = append(unknown, displaySource(s)) } } diff --git a/cmd/artwork_test.go b/cmd/artwork_test.go index cc8b12e07..640ea4d0a 100644 --- a/cmd/artwork_test.go +++ b/cmd/artwork_test.go @@ -540,6 +540,19 @@ var _ = Describe("reprocessArtwork", func() { Expect(queue.Count()).To(BeZero()) }) + It("accepts the absent filter with nothing absent, still rejecting a typo", func() { + put(model.KindArtistArtwork, "ar-2", "folder") + + Expect(reprocessArtwork(ctx, ds, kinds, repositorySources([]string{absentSource}), + imageAgents, false, accept, &out)).To(Succeed(), + "a reserved source must stay valid once the library has none of it") + Expect(out.String()).To(ContainSubstring("Nothing matches")) + Expect(queue.Count()).To(BeZero()) + + Expect(reprocessArtwork(ctx, ds, kinds, repositorySources([]string{"absnt"}), + imageAgents, true, accept, &out)).ToNot(Succeed(), "a typo must still be rejected") + }) + It("accepts a source another kind uses, letting the empty selection report itself", func() { Expect(reprocessArtwork(ctx, ds, []model.Kind{model.KindArtistArtwork}, []string{"folder"}, imageAgents, false, decline, &out)).To(Succeed())