From fb0925d10adba6e8c3adb047dfea74f9fd3c078d Mon Sep 17 00:00:00 2001 From: Edouard Vanbelle Date: Sun, 30 Aug 2026 16:27:57 +0200 Subject: [PATCH] fix(thumbnails): a drained tier is not a teardown failure MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Every boot after the migration completes logged `WARN legacy sidecar directory could not be removed / No such file or directory`. The directory being absent IS the end state — it is what success looks like from the second boot onward — so this warned about the migration having worked, forever, on every restart. Returns early when the root is gone, which also skips walking three directories that no longer exist. The remaining `Err` arms keep their warning for the cases that are genuinely failures: a directory that exists and cannot be removed or moved aside. Co-Authored-By: Claude Opus 5 (1M context) --- .../services/thumb_derived_import_service.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/infrastructure/services/thumb_derived_import_service.rs b/src/infrastructure/services/thumb_derived_import_service.rs index 372005d2..490f272a 100644 --- a/src/infrastructure/services/thumb_derived_import_service.rs +++ b/src/infrastructure/services/thumb_derived_import_service.rs @@ -121,6 +121,21 @@ const BATCH_SIZE: usize = 100; /// claims (Finder's `.DS_Store`) blocking `remove_dir` forever, which /// would keep the read fallback alive on every developer machine. pub(crate) async fn teardown_if_drained(root: &std::path::Path, job: &str, run_id: &str) { + // Already gone — an earlier run drained it. This is the END STATE, not a + // failure, and it is what every boot after the migration looks like. + // Falling through would `remove_dir` a missing directory and report + // ENOENT as "could not be removed", warning about success forever. + if fs::metadata(root).await.is_err() { + tracing::debug!( + target: "oxicloud::dedup", + event = "thumbnail.teardown_noop", + job = job, + run_id = run_id, + "no legacy sidecar directory — nothing to tear down" + ); + return; + } + let mut claimed_remaining = 0usize; let mut foreign_remaining = 0usize;