From 8233d1e4126d8fda94f533f62064f8d3ef56ade9 Mon Sep 17 00:00:00 2001 From: Nathaniel Ledford Date: Fri, 9 Oct 2026 18:57:15 -0400 Subject: [PATCH] Synchronize Folder: progress reaches its end; say what still writes on the UI thread (review fixes) The relink check counted only the photos still to relink, so when some moved files were gone again the bar stopped short of its total. The module docs now name the writes that stay on the UI thread after each step (the durable save; auto-written sidecars), and a test that only showed the work checks files again is named for that. Co-Authored-By: Claude Opus 5.5 --- crates/engine/src/sync.rs | 7 +++++-- crates/engine/src/tests_sync.rs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/engine/src/sync.rs b/crates/engine/src/sync.rs index b876aef89..126cac37c 100644 --- a/crates/engine/src/sync.rs +++ b/crates/engine/src/sync.rs @@ -16,7 +16,9 @@ //! [`synchronize`] then imports the new files (in place), relinks the moved photos, moves the //! missing photos to Recently Deleted and reads the metadata updates — each only when chosen — as //! one undo step. It runs in halves ([`SyncJob`]) so that, in the app, every file it reads is -//! read on a worker thread and only the catalog changes happen on the UI thread. +//! read on a worker thread and only the catalog changes happen on the UI thread — with what every +//! command does after them there: the library's durable save and, with XMP auto-write on, the +//! sidecars of the photos whose metadata was read. //! //! The scan runs without the session ([`SyncInput`] + [`scan_with`]), so the app can run it on a //! worker thread: a folder on a sleeping network share must never stall a frame. @@ -572,9 +574,10 @@ impl SyncWork { return; } // still where the scan found it, and still gone from where the photo says + let checked = moved.len(); let relink: Vec<(PhotoId, String)> = moved.into_iter().filter(|m| Path::new(&m.to).is_file() && !Path::new(&m.from).exists()).map(|m| (PhotoId(m.id), m.to)).collect(); - step(relink.len()); + step(checked); if !relink.is_empty() && !send(SyncStep::Relink(relink)) { return; } diff --git a/crates/engine/src/tests_sync.rs b/crates/engine/src/tests_sync.rs index b5601e714..22dce0af8 100644 --- a/crates/engine/src/tests_sync.rs +++ b/crates/engine/src/tests_sync.rs @@ -498,7 +498,7 @@ fn the_work_of_synchronizing_runs_apart_from_its_commits() { } #[test] -fn readying_a_synchronize_reads_no_file() { +fn the_work_checks_again_that_a_new_file_is_still_there() { let dir = Scratch::new("ready"); let mut s = library(&dir); write_png(&dir.path("trip/c.png"), 3);