Skip to content
Open
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
53d0a13
LRC-LIB-PEOPLE: persistently ignore and restore selected faces
lostwald Nov 4, 2026
a49c88a
LRC-LIB-PEOPLE: preserve ignored faces through XMP rereads and review…
lostwald Nov 4, 2026
aae8309
LRC-LIB-PEOPLE: retain unnamed selections and scope accessible toggles
lostwald Nov 4, 2026
13707a7
LRC-LIB-PEOPLE: identify selected unnamed faces by catalog geometry
lostwald Nov 4, 2026
ec9bbd6
LRC-LIB-PEOPLE: merge current main and retain both release notes
lostwald Nov 5, 2026
3c095d5
LRC-LIB-PEOPLE: merge main and preserve both library-switch cleanups
lostwald Nov 5, 2026
b0bc65b
LRC-LIB-PEOPLE: merge renderer and catalog updates from main
lostwald Nov 5, 2026
c99f6e3
LRC-LIB-PEOPLE: merge current main with Auto Sync updates
lostwald Nov 5, 2026
dbbd474
LRC-LIB-PEOPLE: retain per-photo XMP policy in mixed history
lostwald Nov 5, 2026
730e4e7
LRC-LIB-PEOPLE: merge main and preserve upright ignored regions
lostwald Nov 5, 2026
dc0b1b9
LRC-LIB-PEOPLE: merge current main CI policy unchanged
lostwald Nov 5, 2026
4b51c19
LRC-LIB-PEOPLE: merge conflict-resistant parity documentation
lostwald Nov 5, 2026
be4a720
LRC-LIB-PEOPLE: leave web CPU-reference correction in its own PR
lostwald Nov 5, 2026
2f5d1fc
LRC-LIB-PEOPLE: merge main journal recovery and process V5
lostwald Nov 5, 2026
2f3a24c
LRC-LIB-PEOPLE: guard person ignore requests across main merge
lostwald Nov 5, 2026
48489f1
LRC-LIB-PEOPLE: move ignored faces to catalog format 13
lostwald Nov 5, 2026
b533259
LRC-LIB-PEOPLE: merge main and preserve parity histories
lostwald Nov 5, 2026
bee4adb
LRC-LIB-PEOPLE: merge onboarding without losing face translations
lostwald Nov 5, 2026
624d124
LRC-LIB-PEOPLE: clear dismissed suggestions when switching libraries
lostwald Nov 6, 2026
cf0c697
LRC-LIB-PEOPLE: merge main and preserve face review documentation
lostwald Nov 7, 2026
e1d67f6
1873: harden persistent face review
lostwald Nov 9, 2026
526d4c7
1873: reject incomplete unnamed ignore selections
lostwald Nov 9, 2026
3d26b79
1873: merge main and preserve both gap histories
lostwald Nov 10, 2026
b58aa80
1873: merge main and retain Survey and face review histories
lostwald Nov 10, 2026
a67ab18
1873: merge main and reserve catalog format 14 for ignored faces
lostwald Nov 11, 2026
669583c
1873: merge main and preserve catalog-only ignored regions
lostwald Nov 15, 2026
200dae1
fix(ci): simplify culling, panel and brush predicates (#4897)
lostwald Nov 29, 2026
2e0403a
Merge main e4b673581 into persistent face ignore
lostwald Nov 29, 2026
25e19c8
Merge standalone baseline lint repair for #4897
lostwald Nov 29, 2026
4614522
Merge main into persistent face ignore
lostwald Dec 2, 2026
b97d163
Merge main and reconcile Face Ignore with the Craft UI port
lostwald Dec 3, 2026
17e1f11
Merge main after the GPU shutdown fix
lostwald Dec 3, 2026
a592be6
Merge main and keep Face Ignore alongside Map commands
lostwald Dec 3, 2026
d6d53f1
Merge main after the No label filter change
lostwald Dec 3, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crates/catalog/src/journal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
//! | 11 | lens database profiles named in the Optics panel | `EmbeddedLens.source` |
//! | 12 | history steps and versions share segmentation grids (#2154) | `Catalog.grids`, `SegMask.grid` |
//! | 13 | Lens Blur | `DevelopSettings.lens_blur`, `Mask.adjust.lens_blur` |
//! | 14 | persistent ignored faces | `RegionKind::IgnoredFace` |
//!
//! Rules:
//! - **Bump [`VERSION`]** (and add a row above) in the change that adds an [`Op`] variant or a
Expand All @@ -89,7 +90,7 @@ pub const LOG: &str = "catalog.log";
const FORMAT: &str = "lightcraft-catalog";
/// The catalog format this build writes (and the newest it reads). See the module docs →
/// *Format versions*; bump it whenever an [`Op`] variant or a serialized field is added.
pub const VERSION: u32 = 13;
pub const VERSION: u32 = 14;

/// When [`Journal::wants_snapshot`] says it's time to compact the log.
#[derive(Clone, Copy, Debug)]
Expand Down
137 changes: 135 additions & 2 deletions crates/catalog/src/tests_format_version.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,138 @@ fn snapshot_version(m: &MemStore) -> u64 {
v["version"].as_u64().unwrap()
}

/// Hand-written old wire payload: never generated by the serializer under test. Only fields
/// present before ignored faces are stated; omitted optional fields exercise legacy defaults.
#[test]
fn frozen_legacy_face_and_mask_payloads_upgrade_and_replay() {
const BODY: &str = r#"{"photos":{"1":{"id":1,"source":{"type":"demo","scene":1},"file_name":"old.jpg","format":"JPEG","width":4,"height":3,"imported":"2026-01-01","meta":{"regions":[{"rect":{"x0":0.1,"y0":0.2,"x1":0.4,"y1":0.6},"kind":"Face","name":"Legacy person","description":"retained"}]},"develop":{"masks":[{"id":1,"components":[{"shape":{"kind":"object","hint":[],"seg":{"side":1,"data":"YwAA"}}}]}]}}},"albums":{},"next_photo":2,"next_album":1}"#;
for version in [9, 10, 11, 12, 13] {
let body = if version >= 12 {
BODY.replace("\"data\":\"YwAA\"", "\"grid\":0").replacen("{\"photos\"", "{\"grids\":[\"YwAA\"],\"photos\"", 1)
} else {
BODY.to_string()
};
let store = MemStore::new();
store.set(SNAPSHOT, format!("{{\"format\":\"lightcraft-catalog\",\"version\":{version},\"seq\":0,\"catalog\":{body}}}").into_bytes());
let (mut journal, mut catalog, report) = Journal::open(Box::new(store.clone())).unwrap();
assert_eq!(report.upgraded_from, Some(version));
assert_eq!(snapshot_version(&store), u64::from(VERSION));
let photo = catalog.photo(PhotoId(1)).unwrap();
let mut logits = Vec::new();
photo.develop.visit_seg_masks(&mut |seg| logits.push(seg.logits()));
assert_eq!(logits, vec![Some(vec![0.0])]);
let mut meta = photo.meta.clone();
assert_eq!(meta.regions.len(), 1);
assert_eq!(meta.regions[0].kind, lightcraft_meta::RegionKind::Face);
assert_eq!(meta.regions[0].rect, lightcraft_geom::Rect { x0: 0.1, y0: 0.2, x1: 0.4, y1: 0.6 });
assert_eq!(meta.regions[0].name.as_deref(), Some("Legacy person"));
assert_eq!(meta.regions[0].description.as_deref(), Some("retained"));
meta.regions[0].kind = lightcraft_meta::RegionKind::IgnoredFace;
let op = Op::SetMeta { id: PhotoId(1), meta: Box::new(meta.clone()) };
catalog.apply(op.clone()).unwrap();
journal.append(&[op]).unwrap();
drop(journal);
let (mut journal, replayed, _) = Journal::open(Box::new(store.clone())).unwrap();
assert_eq!(replayed.photo(PhotoId(1)).unwrap().meta, meta);
assert_eq!(replayed.photo(PhotoId(1)).unwrap().develop, catalog.photo(PhotoId(1)).unwrap().develop);
journal.snapshot(&replayed).unwrap();
drop(journal);
let (_, compacted, _) = Journal::open(Box::new(store)).unwrap();
assert_eq!(compacted.to_snapshot(), replayed.to_snapshot());
}
}

/// Format 13 belongs to Lens Blur on main. It must upgrade before an ignored face is written,
/// retaining both Lens Blur settings and face metadata (including earlier face-branch v13 data).
#[test]
fn v13_lens_blur_and_faces_upgrade_before_ignored_regions_are_written() {
const BODY: &str = r#"{"photos":{"1":{"id":1,"source":{"type":"demo","scene":1},"file_name":"old.jpg","format":"JPEG","width":4,"height":3,"imported":"2026-01-01","meta":{"regions":[{"rect":{"x0":0.1,"y0":0.2,"x1":0.4,"y1":0.6},"kind":"Face","name":"Legacy person","description":"retained"}]},"develop":{"lens_blur":{"enabled":true,"amount":42,"boost":18,"focus_mask":1,"transition":27},"masks":[{"id":1,"adjust":{"lens_blur":31,"lens_blur_boost":17},"components":[{"shape":{"kind":"object","hint":[],"seg":{"side":1,"grid":0}}}]}]}}},"grids":["YwAA"],"albums":{},"next_photo":2,"next_album":1}"#;
for kind in [lightcraft_meta::RegionKind::Face, lightcraft_meta::RegionKind::IgnoredFace] {
let body = if kind == lightcraft_meta::RegionKind::IgnoredFace {
BODY.replace("\"kind\":\"Face\"", "\"kind\":\"IgnoredFace\"")
} else {
BODY.to_string()
};
let store = MemStore::new();
store.set(SNAPSHOT, format!("{{\"format\":\"lightcraft-catalog\",\"version\":13,\"seq\":0,\"catalog\":{body}}}").into_bytes());
let (mut journal, mut catalog, report) = Journal::open(Box::new(store.clone())).unwrap();
assert_eq!(report.upgraded_from, Some(13));
assert!(snapshot_version(&store) > 13, "main's Lens Blur reader must refuse ignored-face catalogs");
let photo = catalog.photo(PhotoId(1)).unwrap();
assert_eq!(photo.meta.regions[0].kind, kind);
assert_eq!(photo.meta.regions[0].name.as_deref(), Some("Legacy person"));
assert_eq!(photo.meta.regions[0].description.as_deref(), Some("retained"));
assert_eq!(photo.meta.regions[0].rect, lightcraft_geom::Rect { x0: 0.1, y0: 0.2, x1: 0.4, y1: 0.6 });
let settings = photo.develop.clone();
assert!(settings.lens_blur.enabled);
assert_eq!(
(settings.lens_blur.amount, settings.lens_blur.boost, settings.lens_blur.focus_mask, settings.lens_blur.transition),
(42.0, 18.0, Some(1), 27.0)
);
assert_eq!((settings.masks[0].adjust.lens_blur, settings.masks[0].adjust.lens_blur_boost), (31.0, 17.0));
let mut logits = Vec::new();
settings.visit_seg_masks(&mut |seg| logits.push(seg.logits()));
assert_eq!(logits, vec![Some(vec![0.0])]);
let mut meta = photo.meta.clone();
meta.regions[0].kind = lightcraft_meta::RegionKind::IgnoredFace;
let op = Op::SetMeta { id: PhotoId(1), meta: Box::new(meta.clone()) };
catalog.apply(op.clone()).unwrap();
journal.append(&[op]).unwrap();
drop(journal);
let (mut journal, replayed, report) = Journal::open(Box::new(store.clone())).unwrap();
assert_eq!(report.replayed, 1);
assert_eq!(replayed.photo(PhotoId(1)).unwrap().meta, meta);
assert_eq!(replayed.photo(PhotoId(1)).unwrap().develop, settings);
journal.snapshot(&replayed).unwrap();
drop(journal);
let (_, compacted, _) = Journal::open(Box::new(store)).unwrap();
assert_eq!(compacted.to_snapshot(), replayed.to_snapshot());
}
}

/// Existing catalogs upgrade before accepting ignored regions, retaining face metadata.
#[test]
fn legacy_faces_upgrade_without_losing_assignments_or_boxes() {
let (mut base, _, _) = legacy_parts();
let id = base.photos().next().unwrap().id;
let mut meta = base.photo(id).unwrap().meta.clone();
meta.regions = vec![lightcraft_meta::Region {
rect: lightcraft_geom::Rect { x0: 0.1, y0: 0.1, x1: 0.4, y1: 0.4 },
kind: lightcraft_meta::RegionKind::Face,
name: Some("Person".into()),
description: Some("retained".into()),
}];
base.apply(Op::SetMeta { id, meta: Box::new(meta.clone()) }).unwrap();
for version in [9, 10, 11, 12, 13] {
let m = MemStore::new();
m.set(
SNAPSHOT,
format!("{{\"format\":\"lightcraft-catalog\",\"version\":{version},\"seq\":3,\"catalog\":{}}}\n", base.to_snapshot()).into_bytes(),
);
let (mut journal, mut catalog, report) = Journal::open(Box::new(m.clone())).unwrap();
assert_eq!(report.upgraded_from, Some(version));
assert_eq!(snapshot_version(&m), u64::from(VERSION));
assert!(snapshot_version(&m) > 13, "older builds must refuse the format before decoding ignored faces");
assert_eq!(catalog.photo(id).unwrap().meta, meta);

let mut ignored = meta.clone();
ignored.regions[0].kind = lightcraft_meta::RegionKind::IgnoredFace;
let op = Op::SetMeta { id, meta: Box::new(ignored.clone()) };
catalog.apply(op.clone()).unwrap();
journal.append(&[op]).unwrap();
drop(journal);
// Both log replay and a subsequent compaction retain the ignored state and metadata.
let (mut journal, reopened, report) = Journal::open(Box::new(m.clone())).unwrap();
assert_eq!(report.upgraded_from, None);
assert_eq!(report.replayed, 1);
assert_eq!(reopened.photo(id).unwrap().meta, ignored);
journal.snapshot(&reopened).unwrap();
drop(journal);
let (_, compacted, _) = Journal::open(Box::new(m)).unwrap();
assert_eq!(compacted.photo(id).unwrap().meta, ignored);
}
}

#[test]
fn v1_library_loads_and_is_upgraded() {
let (base, log, full) = legacy_parts();
Expand Down Expand Up @@ -238,9 +370,10 @@ fn op_variants_are_versioned() {
Op::SetHistoryCursor { .. } => 8,
}
}
/// v13: Lens Blur in develop settings and mask adjustments (v12: `Catalog.grids` and `SegMask.grid`; v11: `EmbeddedLens.source`;
/// v14: the persisted `RegionKind::IgnoredFace` value in metadata regions (v13: Lens Blur
/// in develop settings and mask adjustments; v12: `Catalog.grids` and `SegMask.grid`; v11: `EmbeddedLens.source`;
/// v10: `Mask.on_photo`; v9: `Photo.preview_checked` and `Op::SetContent.preview_checked`).
const NEWEST_FIELDS: u32 = 13;
const NEWEST_FIELDS: u32 = 14;
let newest = since(&Op::SetHistoryCursor { id: PhotoId(1), cursor: None });
assert_eq!(newest.max(NEWEST_FIELDS), VERSION, "the newest op's or fields' version must be the current format version");
}
52 changes: 52 additions & 0 deletions crates/catalog/src/tests_grids.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,58 @@ fn v9_catalog_with_inline_grids_loads_and_is_upgraded() {
assert!(rewritten.contains("\"grids\":["), "the shared table is in the file");
}

/// Format 12's shared-grid snapshots and the earlier face branch's inline format-12 snapshots
/// both upgrade before writing ignored faces. Face state and every settings holder survive.
#[test]
fn v12_shared_grids_and_faces_upgrade_without_losing_either() {
for shared in [false, true] {
for kind in [lightcraft_meta::RegionKind::Face, lightcraft_meta::RegionKind::IgnoredFace] {
let (mut live, _, id, blob) = masked_catalog(3);
let mut meta = live.photo(id).unwrap().meta.clone();
meta.regions = vec![lightcraft_meta::Region {
rect: lightcraft_geom::Rect { x0: 0.1, y0: 0.2, x1: 0.4, y1: 0.6 },
kind,
name: Some("Person".into()),
description: Some("retained".into()),
}];
live.apply(Op::SetMeta { id, meta: Box::new(meta.clone()) }).unwrap();
let m = MemStore::new();
if shared {
let (mut j, _, _) = open(&m);
j.snapshot(&live).unwrap();
drop(j);
let mut snapshot: serde_json::Value = serde_json::from_slice(&m.get(SNAPSHOT).unwrap()).unwrap();
snapshot["version"] = serde_json::json!(12);
assert_eq!(snapshot["catalog"]["grids"].as_array().unwrap().len(), 1);
m.set(SNAPSHOT, serde_json::to_vec(&snapshot).unwrap());
} else {
m.set(
SNAPSHOT,
format!("{{\"format\":\"lightcraft-catalog\",\"version\":12,\"seq\":0,\"catalog\":{}}}\n", live.to_snapshot()).into_bytes(),
);
}
let (mut j, mut loaded, report) = open(&m);
assert_eq!(report.upgraded_from, Some(12));
assert!(snapshot_version(&m) > 13, "main's format-13 reader must refuse ignored-face snapshots");
assert_eq!(loaded.to_snapshot(), live.to_snapshot());
let snapshot = String::from_utf8(m.get(SNAPSHOT).unwrap()).unwrap();
assert_eq!(snapshot.match_indices(&blob).count(), 1, "the upgrade retains shared grids");

meta.regions[0].kind = lightcraft_meta::RegionKind::IgnoredFace;
let op = Op::SetMeta { id, meta: Box::new(meta) };
loaded.apply(op.clone()).unwrap();
j.append(&[op]).unwrap();
drop(j);
let (mut j, replayed, _) = open(&m);
assert_eq!(replayed.to_snapshot(), loaded.to_snapshot(), "ignored state and masks survive log replay");
j.snapshot(&replayed).unwrap();
drop(j);
let (_, compacted, _) = open(&m);
assert_eq!(compacted.to_snapshot(), loaded.to_snapshot(), "ignored state and masks survive compaction");
}
}
}

/// The op log is not deduplicated: every record keeps the grids inline (a log never carries the
/// shared table), and replaying it rebuilds the same state.
#[test]
Expand Down
29 changes: 22 additions & 7 deletions crates/engine/src/cmd/face_detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,9 @@ fn overlaps_existing(f: &Face, regions: &[Region]) -> bool {
})
}

/// Recognize replaceable detector results while retaining explicitly ignored regions.
pub(crate) fn is_detected(r: &Region) -> bool {
r.description.as_deref().is_some_and(|d| d.starts_with(MARK))
r.kind != RegionKind::IgnoredFace && r.description.as_deref().is_some_and(|d| d.starts_with(MARK))
}

/// The photo as the faces see it: upright, uncropped, default settings, as 8-bit RGB with its size, its long edge at
Expand All @@ -246,6 +247,7 @@ pub(crate) fn render_rgb(s: &mut Session, id: lightcraft_catalog::PhotoId, edge:
Ok((rgb, image.width, image.height))
}

/// Detect selected photos and commit new face regions without automatic sidecar writes.
fn detect(s: &mut Session, p: &Value) -> Result<Value> {
let apply = p.get("apply").and_then(Value::as_bool).unwrap_or(true);
let defaults = Options::default();
Expand Down Expand Up @@ -288,15 +290,19 @@ fn detect(s: &mut Session, p: &Value) -> Result<Value> {
}
results.push(json!({"id": id.0, "faces": faces.iter().map(face_json).collect::<Vec<_>>()}));
}
let applied = !ops.is_empty();
if applied {
s.commit("Detect Faces", Op::Batch { ops })?;
// regions are not written to XMP, so a sidecar must not be rewritten for this
s.skip_auto_write = true;
}
let applied = commit_detections(s, ops)?;
Ok(json!({"detector": LABEL, "applied": applied, "photos": results, "ms": started.elapsed().as_secs_f64() * 1000.0}))
}

/// The detector and synthetic regressions share the actual commit path, including XMP policy.
pub(crate) fn commit_detections(s: &mut Session, ops: Vec<Op>) -> Result<bool> {
if ops.is_empty() {
return Ok(false);
}
s.commit_catalog_only("Detect Faces", Op::Batch { ops })?;
Ok(true)
}

pub fn specs() -> Vec<CommandSpec> {
vec![
cmd!(
Expand Down Expand Up @@ -331,6 +337,15 @@ mod tests {
Region { rect: lightcraft_geom::Rect { x0, y0, x1, y1 }, kind: RegionKind::Face, name: Some("Ann".into()), description: None }
}

#[test]
fn ignored_detections_are_retained_and_suppress_overlapping_redetection() {
let mut ignored = region(0.4, 0.2, 0.6, 0.5);
ignored.kind = RegionKind::IgnoredFace;
ignored.description = Some(format!("{MARK}{LABEL}"));
assert!(!is_detected(&ignored));
assert!(overlaps_existing(&face(0.4, 0.2, 0.6, 0.5), &[ignored]));
}

#[test]
fn a_detection_on_an_existing_region_is_not_a_new_face() {
let existing = [region(0.40, 0.20, 0.60, 0.50), region(0.10, 0.10, 0.20, 0.20)];
Expand Down
Loading
Loading