From bda0896d82c2d2a71c29bb44554902d13cd74cde Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Tue, 2 Jun 2026 18:26:45 -0400 Subject: [PATCH] =?UTF-8?q?docs(server):=20drift=20#572=20=E2=80=94=20dele?= =?UTF-8?q?te.go=20honest=20about=20missing=20reconcile?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The docstring claimed "the next library scan reconciles missing files by removing their tracks rows" — but scanner.go only does filepath.WalkDir + UpsertTrack; it never enumerates existing rows to check file_path presence, and it never DELETEs orphan rows. The audit verified this — repo-wide grep finds no orphan-sweep code. The lie is load-bearing: lidarrquarantine/service.go:270 leans on this guarantee, so downstream code thinks the orphan case heals itself. Fix the comment to state reality (admin re-trigger or manual cleanup) and reference the open follow-up for adding a real sweep. The actual reconcile pass is a separate piece of work (needs scanrun integration + retention semantics + tests) and stays in the Scribe audit queue. --- internal/library/delete.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/internal/library/delete.go b/internal/library/delete.go index 532f9727..f496871e 100644 --- a/internal/library/delete.go +++ b/internal/library/delete.go @@ -29,9 +29,12 @@ var ErrTrackNotFound = errors.New("library: track not found") // // Order matters: file first, then DB. If the file delete fails (permission, // I/O error), we leave the DB row alone so the admin can retry. The reverse -// failure mode — file gone, DB row still present — is recoverable: the next -// library scan reconciles missing files by removing their tracks rows. So -// the function is retry-safe rather than atomic, by design. +// failure mode — file gone, DB row still present — is currently NOT +// auto-reconciled (drift #572 audit found the misleading prior claim +// that a scan would clean it up — the scanner only walks + upserts; +// it does not enumerate orphan rows). An admin must re-trigger +// DeleteTrackFile or delete the row manually. A scanrun orphan-row +// sweep is tracked as future work in the audit queue. func DeleteTrackFile(ctx context.Context, pool *pgxpool.Pool, trackID pgtype.UUID) error { q := dbq.New(pool) track, err := q.GetTrackByID(ctx, trackID)