Start face indexing from Settings

Beside the thumbnail sweep, because it is the same kind of thing: a job
that runs for an hour, is asked for once, and reports into the activity
list above it. It is also downstream of that sweep -- detection reads the
proxies it builds -- so the two belong in that order, and the coverage
line says how many images are waiting on a proxy rather than only how
many are left to index.

The button drives the Identity Manager's own state rather than a second
copy, so it cannot disagree with that screen about whether a pass is
running, and either place can start or stop it.

The pass now opens an activity row. The caption promises progress will
appear in the list above, and without a row it would not: the button
would be the only sign anything was happening, invisible from every
other screen.

Coverage is read when the Settings page opens. The figures live in the
catalog and this page deliberately holds no session, so they arrive
through a closure rather than being kept current -- they are only ever
looked at while the page is on screen, and the check is two counts and an
indexed scan.

Also adds DARKROOM_NO_SYNC. Redirecting XDG_DATA_HOME isolates a test
launch's catalog and thumbnails but not its server, and I found that out
by pushing a test catalog over the live one. The guard sits in
start_derived_sync rather than at its three call sites, because the sweep
firing a sync is correct and a flag checked in three places is one that
gets missed in a fourth.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-27 09:22:43 +02:00
co-authored by Claude Opus 5
parent f00b92a0e6
commit 25c88d9dbd
7 changed files with 172 additions and 34 deletions
+24
View File
@@ -50,6 +50,13 @@ pub struct IdentityController {
/// grid when they came from an open photograph loses their place for no
/// reason.
came_from_library: std::cell::Cell<bool>,
/// The activity row for the running sweep.
///
/// Face indexing is an hours-long background pass, and the Settings page
/// promises its progress will appear in the list above the button. Without
/// a row it would not, and the button would be the only sign it was
/// running — invisible from every other screen.
activity: RefCell<Option<crate::activity::Activity>>,
/// Rail portraits, kept between refreshes.
///
/// Every mutating action reloads the whole screen, and cutting a portrait
@@ -248,6 +255,7 @@ pub fn wire<S, M, P>(
window: &AppWindow,
ctl: Rc<IdentityController>,
catalog: Rc<RefCell<Option<Catalog>>>,
activity: Rc<crate::activity::ActivityLog>,
store: S,
models: M,
paths: P,
@@ -480,6 +488,10 @@ pub fn wire<S, M, P>(
ctl.progress.set((0, 0));
ctl.faces_found.set(0);
*ctl.activity.borrow_mut() = Some(activity.begin(
crate::activity::Kind::Index,
"Indexing faces",
));
*ctl.sweep.borrow_mut() = Some(crate::faces::spawn_face_sweep(
catalog_path,
store_dir,
@@ -536,9 +548,18 @@ pub fn wire<S, M, P>(
)
.into(),
);
if let Some(a) = ctl_tick.activity.borrow().as_ref() {
a.progress(seen, total);
}
if done {
*ctl_tick.sweep.borrow_mut() = None;
if let Some(a) = ctl_tick.activity.borrow_mut().take() {
a.finish(format!(
"{} face(s) in {seen} image(s)",
ctl_tick.faces_found.get()
));
}
w.set_identity_indexing(false);
// Newly indexed faces belong to nobody until they are
// grouped, so a sweep ending with an unchanged people
@@ -565,6 +586,9 @@ pub fn wire<S, M, P>(
// send fails and it returns, leaving everything already written
// written. No flag to fall out of step with the thread.
*ctl.sweep.borrow_mut() = None;
if let Some(a) = ctl.activity.borrow_mut().take() {
a.finish("stopped");
}
w.set_identity_indexing(false);
reload!(w, ctl, catalog, store);
});