collective

Browse / github.com/storytold/lightcraft / patch

LRC-LIB-PEOPLE: Start the face scan's progress over in another library (#2995)

If you change libraries mid faces scan, it retains the values from the prior library. <img width="373" height="197" alt="Image" src="https://github.com/user-attachments/assets/2259c50e-43db-4068-ac13-7b7570b2b816" /> As you can see the upper number (442717) is the much higher number from my prior library and the total photos in my just opened library (34021). I opened the larger library. It started scanning, I then went to "Open Recent Library" and selected the current one. The number completed immediately jumped much higher, likely max - total to scan. LightCraft: v0.14.0 OS: Windows 11 Pro

Status
open
Score
0.00
Adopters
0 other operators
Author
endthestart (imported from pull request #3024, open)
Base
c9860ea7a3fa367451acd9d8cf23538c345192c6
Size
+27 −0 in 3 files
Review
pending
Shared
2026-10-28
Id
2e9f4f08310b7594fe9953c3

How it went

No other operator has reported using it yet.

Diff

raw · crates/engine/src/faces_index.rs crates/engine/src/tests/face_recognize.rs docs/whats-new.md

diff --git a/crates/engine/src/faces_index.rs b/crates/engine/src/faces_index.rs--- a/crates/engine/src/faces_index.rs+++ b/crates/engine/src/faces_index.rs@@ -600,6 +600,8 @@ impl FacesState {         self.in_flight.clear();         self.retry_at = None;         self.saved_at = None;+        self.task = None;+        self.peak = 0;         self.epoch = self.epoch.wrapping_add(1);     } diff --git a/crates/engine/src/tests/face_recognize.rs b/crates/engine/src/tests/face_recognize.rs--- a/crates/engine/src/tests/face_recognize.rs+++ b/crates/engine/src/tests/face_recognize.rs@@ -524,6 +524,24 @@ fn face_scan_row_follows_pending_photos() {     let _ = std::fs::remove_dir_all(&d); } +#[test]+fn face_scan_row_starts_over_in_another_library() {+    // issue #2995: the scan's whole was kept from the library opened before, so a smaller one showed most of it done+    let d = temp("peak-library");+    let (mut s, _) = setup(&d, 64);+    s.faces.peak = 442_717;+    s.open_library(d.join("other"), true).unwrap();+    let id = s.catalog.photos().map(|p| p.id).max().unwrap();+    set_regions(&mut s, id, vec![region(0.1, None)]);+    let last = s.execute("faces.pump", &json!({})).unwrap();+    let pending = last["pendingPhotos"].as_u64().unwrap();+    assert!(pending > 0, "{last}");+    assert_eq!(last["peak"].as_u64().unwrap(), pending, "{last}");+    let rows = s.activity.list().into_iter().filter(|t| t.kind == "faces").collect::<Vec<_>>();+    assert_eq!(rows.iter().map(|t| (t.total, t.done)).collect::<Vec<_>>(), vec![(pending, 0)]);+    let _ = std::fs::remove_dir_all(&d);+}+ fn face_names(s: &Session, id: PhotoId) -> Vec<Option<String>> {     s.catalog.photo(id).unwrap().meta.regions.iter().map(|r| r.name.clone()).collect() }diff --git a/docs/whats-new.md b/docs/whats-new.md--- a/docs/whats-new.md+++ b/docs/whats-new.md@@ -1,5 +1,12 @@ # What's new in LightCraft +## 2026-10-25++### The face scan's progress starts over in another library+- Opening another library while the face scan was running kept the old library's photo count as the progress bar's+  whole, so a smaller library's scan looked almost done from the start (#2995). The scan's row and bar now start over+  with each library.+ ## 2026-10-24  ### Relative-date filters and smart albums follow the clock