diff --git a/core/dr-catalog/src/faces.rs b/core/dr-catalog/src/faces.rs
index 1f36ba9..241efe3 100644
--- a/core/dr-catalog/src/faces.rs
+++ b/core/dr-catalog/src/faces.rs
@@ -158,6 +158,16 @@ pub use dr_face::Calibration;
/// part of the frame: a re-index with a better model must not discard the
/// user's labelling (FR-CULL-10). Matching is by box overlap, since the face is
/// in the same place even when the box moves a little.
+///
+/// **Every model's faces are replaced, and every other model's marker goes
+/// with them.** An image holds the faces of whichever pipeline looked at it
+/// last, never a mixture — two detectors drawing boxes over the same face is
+/// not two opinions but a duplicate. So the replacement is unconditional on
+/// `model_id`, and the run markers of the pipelines whose faces were just
+/// removed are dropped too: a marker that says "done" over an image with
+/// none of that model's faces is exactly the state that made the V12 repair
+/// necessary, and a user who switches their detector back would otherwise
+/// find those photographs permanently empty.
pub fn record_detections(
conn: &Connection,
image_id: ImageId,
@@ -192,6 +202,10 @@ pub fn record_detections(
}
tx.execute("DELETE FROM faces WHERE image_id = ?1", [image_id.0 as i64])?;
+ tx.execute(
+ "DELETE FROM face_index WHERE image_id = ?1 AND model_id != ?2",
+ rusqlite::params![image_id.0 as i64, model_id],
+ )?;
let now = now_secs();
let mut ids = Vec::with_capacity(faces.len());
@@ -1608,6 +1622,25 @@ mod tests {
assert_eq!(edge, 2048, "the marker should record the newer proxy");
}
+ /// A user who switches detector and back must not find the images the
+ /// second pipeline visited reported as done under the first with no
+ /// faces behind the marker.
+ #[test]
+ fn re_indexing_under_another_model_drops_the_first_models_marker() {
+ let c = db();
+ let img = image(&c, 1);
+ record_detections(&c, img, "w600k_mbf", 2048, &[face(1)]).unwrap();
+ record_detections(&c, img, "scrfd_2.5g+w600k_mbf", 2048, &[face(2), face(3)]).unwrap();
+
+ assert!(is_indexed(&c, img, "scrfd_2.5g+w600k_mbf").unwrap());
+ assert!(
+ !is_indexed(&c, img, "w600k_mbf").unwrap(),
+ "the first pipeline's marker outlived its faces"
+ );
+ assert_eq!(for_image(&c, img).unwrap().len(), 2);
+ assert_eq!(coverage(&c, "w600k_mbf").unwrap().outstanding(), 1);
+ }
+
#[test]
fn clearing_a_marker_puts_that_image_back_in_the_queue() {
let c = db();
diff --git a/docs/gestures.md b/docs/gestures.md
index aefc9bd..d6b22a0 100644
--- a/docs/gestures.md
+++ b/docs/gestures.md
@@ -25,7 +25,7 @@ Sampling a neutral is the first move of the tonal pass — every colour judgemen
Anchored on the fingers' midpoint, and on the pointer, so the gesture reads as magnifying the picture rather than sliding it about. Double-tap is the way to an exact 1:1; this is the way to everything in between.
-`ui/dr-ui/ui/app.slint:1941`
+`ui/dr-ui/ui/app.slint:1950`
### Move a magnified photograph about
@@ -34,7 +34,7 @@ Anchored on the fingers' midpoint, and on the pointer, so the gesture reads as m
Only once there is something outside the viewport to reach, which is why the cursor becomes a hand exactly then. The view is clamped to the frame: panning past the edge would show undefined area beside the photograph, and that reads as a rendering fault rather than as the end of the picture.
-`ui/dr-ui/ui/app.slint:2032`
+`ui/dr-ui/ui/app.slint:2041`
### Paint a mask by hand
@@ -43,7 +43,7 @@ Only once there is something outside the viewport to reach, which is why the cur
A model's mask stops inside a shoulder and leaks into the hair, and no single edge control fixes two errors that go opposite ways. The whole stroke is one step in the history, so taking a mark back costs one press however long it took to make.
-`ui/dr-ui/ui/app.slint:2119`
+`ui/dr-ui/ui/app.slint:2128`
### Take back the last change
@@ -53,7 +53,7 @@ A model's mask stops inside a shoulder and leaks into the hair, and no single ed
A whole drag is one step, so undo takes back a decision rather than a frame of a gesture. The list is there because arriving six steps back costs what arriving from one does.
-`ui/dr-ui/ui/app.slint:2340`
+`ui/dr-ui/ui/app.slint:2349`
### Do it again after taking it back
@@ -61,7 +61,7 @@ A whole drag is one step, so undo takes back a decision rather than a frame of a
- **Pointer** — Click it, or press Redo in the History header
- **Keyboard** — Ctrl+Shift+Z
-`ui/dr-ui/ui/app.slint:2353`
+`ui/dr-ui/ui/app.slint:2362`
### Copy the settings from this photograph
@@ -71,7 +71,7 @@ A whole drag is one step, so undo takes back a decision rather than a frame of a
The panel is the copy that has to work: a tablet has no modifier key to hold and no menu bar to hang the action from. The shortcut is an accelerator for a control that is on screen either way.
-`ui/dr-ui/ui/app.slint:2386`
+`ui/dr-ui/ui/app.slint:2395`
### Paste the settings onto this photograph
@@ -81,7 +81,7 @@ The panel is the copy that has to work: a tablet has no modifier key to hold and
The button names what would be pasted — "3 adjustments", and whether the crop is coming with it — which the shortcut cannot say. Both paste the same scope.
-`ui/dr-ui/ui/app.slint:2398`
+`ui/dr-ui/ui/app.slint:2407`
### Change which group of adjustments is on screen
@@ -91,7 +91,7 @@ The button names what would be pasted — "3 adjustments", and whether the crop
The groups are whatever the operation set declares itself to be about, so there are as many as the pipeline has and no key can be assigned to one of them by name. Stepping is the binding that survives a node being added.
-`ui/dr-ui/ui/app.slint:2426`
+`ui/dr-ui/ui/app.slint:2435`
### Look at the photograph at 1:1
@@ -101,7 +101,7 @@ The groups are whatever the operation set declares itself to be about, so there
Noise reduction and capture sharpening are judgements about single pixels, and a fitted view averages several of the file's into each one on screen — so the frame looks softer than it is and the correction goes too far. The point and the magnification survive opening the next photograph, which is what makes checking the same eye across forty portraits forty keystrokes rather than forty pans.
-`ui/dr-ui/ui/app.slint:2461`
+`ui/dr-ui/ui/app.slint:2470`
### Move to the next or previous photograph
@@ -111,7 +111,7 @@ Noise reduction and capture sharpening are judgements about single pixels, and a
The edit on screen is saved on the way out, so stepping through a folder is as much a departure as going back to the grid and loses nothing.
-`ui/dr-ui/ui/app.slint:2491`
+`ui/dr-ui/ui/app.slint:2500`
### See the photograph before you edited it
@@ -121,7 +121,7 @@ The edit on screen is saved on the way out, so stepping through a folder is as m
Held rather than toggled, and no split screen: a split halves the working image on the tablet the column was sized for, and the comparison photographers describe making is a flick back and forth. It takes no history step, so checking whether a frame is overcooked costs nothing to undo afterwards.
-`ui/dr-ui/ui/app.slint:2615`
+`ui/dr-ui/ui/app.slint:2624`
### Put one control back to its default