Skip to content

LightCraft: An open-source non-destructive photo editor written by scratch in pure Rust

Merge PR #2021: Fix reference app catalog video classification and filtering

aiongg3f5dd5a92de5
diff --cc crates/engine/src/lightroom_catalog/tests.rs
index 654b40458,000000000..7e93131ce
mode 100644,000000..100644
--- a/crates/engine/src/lightroom_catalog/tests.rs
+++ b/crates/engine/src/lightroom_catalog/tests.rs
@@@ -1,810 -1,0 +1,887 @@@
+use super::*;
+use lightcraft_geom::CropGeometry;
+fn row(v: Value) -> Row {
+ serde_json::from_value(v).unwrap()
+}
+fn sample() -> CatalogImport {
+ let mut photo = CatalogPhoto {
+ source_id: 1,
+ uuid: "test-master".into(),
+ path: "/missing/test.ARW".into(),
+ image: row(json!({"id_local":1,"rating":5,"pick":1,"fileFormat":"ARW","fileWidth":20,"fileHeight":10})),
+ settings: "s = { Exposure2012 = 1.25, Contrast2012 = 17, CameraProfile = \"Example\" }".into(),
+ xmp: String::new(),
+ keywords: vec!["Travel|Goa".into()],
+ history: vec![row(json!({"text":"s = { Exposure2012 = 0.5 }"}))],
+ snapshots: Vec::new(),
+ original: Original::Local,
+ };
+ let mut copy = photo.clone();
+ copy.source_id = 2;
+ copy.uuid = "test-copy".into();
+ copy.image = row(json!({"id_local":2,"masterImage":1,"copyName":"Mono","rating":2,"pick":-1}));
+ copy.settings = "s = { ConvertToGrayscale = true, Exposure2012 = -0.5 }".into();
+ photo.image.insert("captureTime".into(), json!("2024-01-16T12:34:56"));
+ CatalogImport {
+ source: "test.lrcat".into(),
+ photos: vec![copy, photo],
+ collections: vec![
+ row(json!({"id_local":9,"name":"Travel","creationId":"collection.group"})),
+ row(json!({"id_local":10,"parent":9,"name":"Keepers","creationId":"collection"})),
+ ],
+ members: vec![
+ row(json!({"collection":10,"image":2,"positionInCollection":"a"})),
+ row(json!({"collection":10,"image":1,"positionInCollection":"b"})),
+ ],
+ collection_content: Vec::new(),
+ warnings: Vec::new(),
+ skipped: Vec::new(),
+ }
+}
+/// A crafted `.lrcat` that names a program as a photo's original gets no record for it, so
+/// Photo ▸ Edit In ▸ Open Original has nothing to hand the system opener (#2135). Its virtual
+/// copies go with it; the catalog's real photos still import.
+#[test]
+fn a_catalog_original_that_is_not_a_photo_file_is_not_imported() {
+ let mut data = sample();
+ let mut exe = data.photos[1].clone();
+ exe.source_id = 3;
+ exe.uuid = "payload".into();
+ exe.path = "/Users/sky/Downloads/payload.exe".into();
+ exe.image = row(json!({"id_local":3,"fileFormat":"ARW","fileWidth":20,"fileHeight":10}));
+ let mut exe_copy = exe.clone();
+ exe_copy.source_id = 4;
+ exe_copy.uuid = "payload-copy".into();
+ exe_copy.path = "/Users/sky/Downloads/payload.exe".into();
+ exe_copy.image = row(json!({"id_local":4,"masterImage":3,"copyName":"Mono"}));
+ // the copy comes before its master, as a catalog's table order may have it
+ data.photos.insert(0, exe_copy);
+ data.photos.push(exe);
+ for bad in [r"C:\Users\sky\start.lnk", "/Applications/Evil.app", "/Users/sky/go.command", "/Users/sky/run.bat"] {
+ let mut one = data.clone();
+ one.photos.retain(|p| p.source_id < 3);
+ let mut planted = one.photos[1].clone();
+ planted.source_id = 5;
+ planted.uuid = "planted".into();
+ planted.path = bad.into();
+ planted.image = row(json!({"id_local":5,"fileFormat":"ARW"}));
+ one.photos.push(planted);
+ let mut s = crate::Session::new();
+ let r = apply(&mut s, one, false).unwrap();
+ assert_eq!(r["photos"], 2, "{bad} is not catalogued: {r}");
+ assert!(s.catalog.photos().all(|p| !matches!(&p.source, Source::File { path } if path == bad)), "{bad} became a library record");
+ }
+ let mut s = crate::Session::new();
+ let r = apply(&mut s, data, false).unwrap();
+ assert_eq!(r["photos"], 2, "only the real master and its copy: {r}");
+ assert!(s.catalog.photos().all(|p| !matches!(&p.source, Source::File { path } if path.ends_with(".exe"))), "the program was catalogued");
+ let warnings = r["warnings"].to_string();
+ assert!(warnings.contains("payload.exe") && warnings.contains("file types LightCraft reads"), "{warnings}");
+ assert!(warnings.contains("image 4: not imported"), "the virtual copy of the refused original goes with it: {warnings}");
+}
+
+#[test]
+fn offline_local_master_and_copy_join_library_with_one_undo_step() {
+ let mut s = crate::Session::new();
+ let data = sample();
+ let master_id = s.catalog.alloc_photo_id();
+ let mut master = Photo::new(master_id, Source::File { path: "/missing/test.ARW".into() }, "test.ARW", "ARW", 20, 10, "before");
+ master.local = true;
+ s.commit("Browse folder", Op::AddPhoto { photo: Box::new(master) }).unwrap();
+ s.undo.clear();
+ let before = s.catalog.photo(master_id).unwrap().clone();
+ let mut index = ImportIndex::default();
+ let missing_sources = [key("/missing/test.ARW")].into_iter().collect();
+ let mut import = |s: &mut crate::Session| {
+ let undo0 = s.undo.len();
+ apply_prepared(
+ s,
+ data.clone(),
+ ApplyPrepared {
+ update_existing: false,
+ files: Default::default(),
+ index: &mut index,
+ archive_path: None,
+ missing_sources: &missing_sources,
+ undo0,
+ },
+ )
+ .unwrap()
+ .report
+ };
+ let first = import(&mut s);
+ assert_eq!(first["mapping"]["1"], master_id.0);
+ assert_eq!(first["imported"], 2, "the promoted master and new copy both join All Photos");
+ assert_eq!(first["missing"], json!(["/missing/test.ARW"]));
+ assert_eq!(s.catalog.len(), 2);
+ assert!(s.catalog.photos().all(|photo| !photo.local));
+ assert_eq!(s.undo.len(), 1);
+ let second = import(&mut s);
+ assert_eq!(second["imported"], 0);
+ assert_eq!(second["mapping"], first["mapping"]);
+ s.undo_step().unwrap();
+ s.undo_step().unwrap();
+ assert_eq!(s.catalog.len(), 1);
+ assert_eq!(s.catalog.photo(master_id), Some(&before));
+ assert!(s.catalog.albums().next().is_none());
+ let third = import(&mut s);
+ assert_eq!(third["imported"], 2);
+ assert!(s.catalog.photos().all(|photo| !photo.local));
+}
+
+#[test]
+fn imports_copies_collections_ratings_and_mapped_edits_in_one_undo_step() {
+ let mut s = crate::Session::new();
+ let data = sample();
+ let r = apply(&mut s, data.clone(), false).unwrap();
+ assert_eq!(r["photos"], 2);
+ assert_eq!(r["imported"], 2, "the offline master and virtual copy both count as added");
+ assert_eq!(r["missing"].as_array().unwrap().len(), 1);
+ let master = s.catalog.photo(PhotoId(r["mapping"]["1"].as_u64().unwrap())).unwrap();
+ assert_eq!(master.rating, 5);
+ assert_eq!(master.flag, Flag::Pick);
+ assert_eq!(master.meta.keywords, vec!["Travel|Goa"]);
+ assert_eq!(master.develop.light.exposure, 1.25);
+ let copy = s.catalog.photos().find(|p| p.copy_of.is_some()).unwrap();
+ assert_eq!(copy.copy_of, Some(master.id));
+ assert_eq!(copy.rating, 2);
+ assert_eq!(copy.flag, Flag::Reject);
+ assert_eq!(copy.develop.light.exposure, -0.5);
+ let album = s.catalog.albums().find(|a| a.name == "Keepers").unwrap();
+ assert_eq!(album.photos, vec![copy.id, master.id]);
+ assert!(album.parent.is_some());
+ assert!(r["unmapped"]["1"].as_array().unwrap().iter().any(|v| v.as_str() == Some("CameraProfile")));
+ assert_eq!(s.undo.len(), 1);
+ s.undo_step().unwrap();
+ assert!(s.catalog.is_empty());
+ assert!(s.catalog.albums().next().is_none());
+ assert!(data.photos[1].settings.contains("CameraProfile")); // unmapped source stays intact
+}
+#[test]
+fn preserves_existing_edits_and_rejects_invalid_structure_before_mutation() {
+ let mut s = crate::Session::new();
+ let data = sample();
+ apply(&mut s, data.clone(), false).unwrap();
+ let id = s.catalog.photos().find(|p| p.copy_of.is_none()).unwrap().id;
+ s.set_develop(id, lightcraft_develop::DevelopSettings::default(), "Personal edit").unwrap();
+ let r = apply(&mut s, data.clone(), false).unwrap();
+ assert!(r["preservedExistingEdits"].as_u64().unwrap() > 0);
+ assert_eq!(s.catalog.photo(id).unwrap().develop.light.exposure, 0.0);
+ let before = s.catalog.to_snapshot();
+ let mut cyclic = data;
+ cyclic.collections[0].insert("parent".into(), json!(10));
+ assert!(apply(&mut s, cyclic, false).is_err());
+ assert_eq!(s.catalog.to_snapshot(), before);
+ assert!(
+ mapped_settings(&format!("{}0{}", "{".repeat(1000), "}".repeat(1000)), crate::crs::Target::RawAbsolute, 1.0, Orientation::Normal, 1.5)
+ .is_err()
+ );
+}
+#[test]
+fn compressed_xmp_is_bounded_and_settings_are_data_only() {
+ let packet = b"<x:xmpmeta>example</x:xmpmeta>";
+ let mut encoded = (packet.len() as u32).to_be_bytes().to_vec();
+ encoded.extend(miniz_oxide::deflate::compress_to_vec_zlib(packet, 6));
+ assert_eq!(xmp(Some(&json!(encoded))).unwrap(), String::from_utf8_lossy(packet));
+ encoded[0] = 0xff;
+ assert!(xmp(Some(&json!(encoded))).is_err());
+ let (partial, _) = mapped_settings(
+ "s = { Exposure2012 = 0.75, ToneCurvePV2012 = {0,0,128,150,255,255} }",
+ crate::crs::Target::RawAbsolute,
+ 1.5,
+ Orientation::Normal,
+ 1.5,
+ )
+ .unwrap();
+ assert_eq!(partial["light"]["exposure"], 0.75);
+}
+
+#[test]
+fn custom_white_balance_on_relative_wb_raws_is_not_read_as_kelvin() {
+ // Issue #510: a catalog keeps no as-shot white for Custom photos, so on a raw developed
+ // relative to its as-shot look the edit stays As Shot and is reported; a DNG keeps the Kelvin
+ let settings =
+ "s = { WhiteBalance = \"Custom\", Temperature = 3578, Tint = -5, CustomTemperature = 3578.95, CustomTint = -5, Exposure2012 = 0.5 }";
+ let (partial, unknown) = mapped_settings(settings, crate::crs::Target::RawRelative, 1.5, Orientation::Normal, 1.5).unwrap();
+ assert_eq!(partial["wb"], json!({"mode": "asShot"}), "{partial}");
+ assert_eq!(partial["light"]["exposure"], 0.5);
+ assert!(unknown.iter().any(|k| k.starts_with("Temperature, Tint")), "{unknown:?}");
+ let (partial, unknown) = mapped_settings(settings, crate::crs::Target::RawAbsolute, 1.5, Orientation::Normal, 1.5).unwrap();
+ assert_eq!(
+ (partial["wb"]["mode"].as_str(), partial["wb"]["temp"].as_f64(), partial["wb"]["tint"].as_f64()),
+ (Some("custom"), Some(3578.0), Some(-5.0))
+ );
+ assert!(!unknown.iter().any(|k| k.starts_with("Temperature")), "{unknown:?}");
+}
+
+#[test]
+fn catalog_crops_without_has_crop_are_imported() {
+ // Lightroom Classic catalogs store crop edges and angle but never `HasCrop`
+ let (partial, unknown) = mapped_settings(
+ "s = { CropConstrainAspectRatio = true, CropLeft = 0.042702, CropRight = 0.957298, CropTop = 0.1 }",
+ crate::crs::Target::RawAbsolute,
+ 1.5,
+ Orientation::Normal,
+ 1.5,
+ )
+ .unwrap();
+ let crop = &partial["crop"]["geometry"];
+ assert_eq!(crop["rect"]["x0"], 0.042702);
+ assert_eq!(crop["rect"]["y0"], 0.1);
+ assert_eq!(crop["rect"]["x1"], 0.957298);
+ assert_eq!(crop["rect"]["y1"], 1.0);
+ assert_eq!(crop["angle"], 0.0);
+ assert!(!unknown.iter().any(|k| k.starts_with("CropLeft")), "{unknown:?}");
+ // an angle alone still means a crop (Lightroom's angle turns the other way to LightCraft's)
+ let (partial, unknown) = mapped_settings("s = { CropAngle = -1.5 }", crate::crs::Target::RawAbsolute, 1.5, Orientation::Normal, 1.5).unwrap();
+ assert_eq!(partial["crop"]["geometry"]["angle"], 1.5);
+ assert!(!unknown.iter().any(|k| k.starts_with("CropAngle")), "{unknown:?}");
+ // no crop fields: the crop stays untouched
+ let (partial, _) = mapped_settings("s = { Exposure2012 = 0.5 }", crate::crs::Target::RawAbsolute, 1.5, Orientation::Normal, 1.5).unwrap();
+ assert!(partial.get("crop").is_none());
+}
+
+#[test]
+fn lightroom_orientation_codes() {
+ // the three seen in a real catalog, checked against each file's EXIF orientation (1, 6, 8)
+ assert_eq!(lightroom_orientation("AB"), Some(Orientation::Normal));
+ assert_eq!(lightroom_orientation("BC"), Some(Orientation::Rotate90));
+ assert_eq!(lightroom_orientation("DA"), Some(Orientation::Rotate270));
+ assert_eq!(lightroom_orientation("CD"), Some(Orientation::Rotate180));
+ assert_eq!(lightroom_orientation("BA"), Some(Orientation::FlipH));
+ assert_eq!(lightroom_orientation("DC"), Some(Orientation::FlipV));
+ assert_eq!(lightroom_orientation("AD"), Some(Orientation::Transpose));
+ assert_eq!(lightroom_orientation("CB"), Some(Orientation::Transverse));
+ for code in ["", "A", "ABC", "AC", "ab", "XY"] {
+ assert_eq!(lightroom_orientation(code), None, "{code:?}");
+ }
+}
+
+#[test]
+fn catalog_crops_follow_the_photo_orientation() {
+ let crop = |o: Orientation| {
+ let settings = "s = { CropLeft = 0.1, CropRight = 0.6, CropTop = 0.2, CropBottom = 0.9 }";
+ let (partial, _) = mapped_settings(settings, crate::crs::Target::RawAbsolute, 1.5, o, 1.5).unwrap();
+ let g = &partial["crop"]["geometry"];
+ let r = &g["rect"];
+ [r["x0"].as_f64(), r["y0"].as_f64(), r["x1"].as_f64(), r["y1"].as_f64(), g["angle"].as_f64()].map(|v| (v.unwrap() * 1e9).round() / 1e9)
+ };
+ // (x, y) of the stored image → (1 − y, x) a quarter turn clockwise, (y, 1 − x) counter-clockwise
+ assert_eq!(crop(Orientation::Normal), [0.1, 0.2, 0.6, 0.9, 0.0]);
+ assert_eq!(crop(Orientation::Rotate90), [0.1, 0.1, 0.8, 0.6, 0.0]);
+ assert_eq!(crop(Orientation::Rotate270), [0.2, 0.4, 0.9, 0.9, 0.0]);
+ assert_eq!(crop(Orientation::Rotate180), [0.4, 0.1, 0.9, 0.8, 0.0]);
+ assert_eq!(crop(Orientation::FlipH), [0.4, 0.2, 0.9, 0.9, 0.0]);
+ // a mirror turns the straighten the other way
+ let angle = |o: Orientation| {
+ let (partial, _) = mapped_settings("s = { CropAngle = 2 }", crate::crs::Target::RawAbsolute, 1.5, o, 1.5).unwrap();
+ partial["crop"]["geometry"]["angle"].as_f64().unwrap()
+ };
+ assert_eq!(angle(Orientation::Rotate90), -2.0);
+ assert_eq!(angle(Orientation::FlipH), 2.0);
+ // no crop: nothing to orient
+ let (partial, _) = mapped_settings("s = { Exposure2012 = 0.5 }", crate::crs::Target::RawAbsolute, 1.5, Orientation::Rotate90, 1.5).unwrap();
+ assert!(partial.get("crop").is_none());
+}
+
+/// The `crs` corners and angle Lightroom would store for LightCraft crop `g` on a stored image
+/// of aspect `w` (height 1) shown with orientation `o`.
+fn lightroom_crop(g: CropGeometry, o: Orientation, w: f64) -> String {
+ let (ow, oh) = if o.swaps_axes() { (1.0, w) } else { (w, 1.0) };
+ let to_source = Affine::rotate_about(-g.angle.to_radians(), Point::new(ow / 2.0, oh / 2.0));
+ let stored = |x: f64, y: f64| {
+ let p = to_source.apply(Point::new(x * ow, y * oh));
+ o.inverse().map(p.x, p.y, ow, oh)
+ };
+ // the rectangle's corners that land top-left and bottom-right on the stored image
+ let corners = [stored(g.rect.x0, g.rect.y0), stored(g.rect.x1, g.rect.y0), stored(g.rect.x1, g.rect.y1), stored(g.rect.x0, g.rect.y1)];
+ let (tl, br) = (0..4).map(|i| (corners[i], corners[(i + 2) % 4])).find(|(a, b)| a.0 < b.0 && a.1 < b.1).unwrap();
+ let angle = if o.to_parts().0 { g.angle } else { -g.angle };
+ format!("s = {{ CropLeft = {}, CropTop = {}, CropRight = {}, CropBottom = {}, CropAngle = {angle} }}", tl.0 / w, tl.1, br.0 / w, br.1)
+}
+
+#[test]
+fn straightened_catalog_crops_round_trip() {
+ let g = CropGeometry { rect: Rect::new(0.2, 0.15, 0.7, 0.8), angle: 6.5 };
+ for o in [Orientation::Normal, Orientation::Rotate90, Orientation::Rotate270, Orientation::Rotate180, Orientation::FlipH] {
+ for angle in [6.5, -6.5] {
+ let g = CropGeometry { angle, ..g };
+ let (partial, _) = mapped_settings(&lightroom_crop(g, o, 1.5), crate::crs::Target::RawAbsolute, 1.5, o, 1.5).unwrap();
+ let got: CropGeometry = serde_json::from_value(partial["crop"]["geometry"].clone()).unwrap();
+ let close = |a: f64, b: f64| (a - b).abs() < 1e-9;
+ assert!(
+ close(got.angle, g.angle)
+ && [(got.rect.x0, g.rect.x0), (got.rect.y0, g.rect.y0), (got.rect.x1, g.rect.x1), (got.rect.y1, g.rect.y1)]
+ .iter()
+ .all(|&(a, b)| close(a, b)),
+ "{o:?} {angle}: {got:?}"
+ );
+ }
+ }
+}
+
+#[test]
+fn straightened_catalog_crops_match_lightroom_exports() {
+ // Settings and pixel sizes from a real Lightroom Classic catalog (9504 × 6336 stored) and the
+ // JPEGs Lightroom exported from it at full size.
+ for (settings, o, export) in [
+ (
+ "s = { CropAngle = -9.34444, CropBottom = 0.802034, CropLeft = 0.05499, CropRight = 0.94501, CropTop = 0.197966 }",
+ Orientation::Normal,
+ (7725.0, 5150.0),
+ ),
+ (
+ "s = { CropAngle = -1.48964, CropBottom = 0.962457, CropLeft = 0.010429, CropRight = 0.989571, CropTop = 0.037543 }",
+ Orientation::Rotate90,
+ (6100.0, 9150.0),
+ ),
+ ] {
+ let (partial, _) = mapped_settings(settings, crate::crs::Target::RawAbsolute, 1.5, o, 9504.0 / 6336.0).unwrap();
+ let r: Rect = serde_json::from_value(partial["crop"]["geometry"]["rect"].clone()).unwrap();
+ let (ow, oh) = if o.swaps_axes() { (6336.0, 9504.0) } else { (9504.0, 6336.0) };
+ let (w, h) = (r.width() * ow, r.height() * oh);
+ assert!((w - export.0).abs() <= 3.0 && (h - export.1).abs() <= 3.0, "{o:?}: {w:.1} × {h:.1}, Lightroom exported {export:?}");
+ }
+}
+
+#[test]
+fn imported_crops_use_the_catalog_orientation() {
+ let mut data = sample();
+ data.photos.truncate(1);
+ data.photos[0].image.remove("masterImage");
+ data.photos[0].image.insert("orientation".into(), json!("BC"));
+ data.photos[0].settings = "s = { CropLeft = 0.1, CropRight = 0.6, CropTop = 0.2, CropBottom = 0.9 }".into();
+ data.photos[0].xmp = String::new();
+ let mut s = crate::Session::new();
+ apply(&mut s, data, false).unwrap();
+ let g = s.catalog.photos().next().unwrap().develop.crop.geometry;
+ let r = [g.rect.x0, g.rect.y0, g.rect.x1, g.rect.y1].map(|v| (v * 1e9).round() / 1e9);
+ assert_eq!(r, [0.1, 0.1, 0.8, 0.6]);
+}
+
+#[test]
+fn deferred_auto_tone_sentinels_never_become_real_slider_values() {
+ let mut data = sample();
+ data.photos.truncate(1);
+ data.photos[0].image.remove("masterImage");
+ data.photos[0].settings = "s = { AutoTone = true, Exposure2012 = -999999, Contrast2012 = -999999, Shadows2012 = 65, Temperature = 6150 }".into();
+ data.photos[0].xmp = r#"<x:xmpmeta xmlns:x="adobe:ns:meta/"><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description xmlns:crs="http://ns.adobe.com/camera-raw-settings/1.0/" crs:Exposure2012="-999999" crs:Contrast2012="-999999" crs:Blacks2012="-22"/></rdf:RDF></x:xmpmeta>"#.into();
+ let mut s = crate::Session::new();
+ let report = apply(&mut s, data, false).unwrap();
+ let p = s.catalog.photos().next().unwrap();
+ assert_eq!(p.develop.light.exposure, 0.0);
+ assert_eq!(p.develop.light.contrast, 0.0);
+ assert_eq!(p.develop.light.shadows, 65.0);
+ assert_eq!(p.develop.light.blacks, -22.0);
+ assert!(report["unmapped"]["2"].as_array().unwrap().iter().any(|v| v.as_str().is_some_and(|v| v.contains("Deferred"))));
+ let (partial, _) =
+ mapped_settings("s = { Exposure2012 = -5, Contrast2012 = -100 }", crate::crs::Target::RawAbsolute, 1.0, Orientation::Normal, 1.5).unwrap();
+ assert_eq!(partial["light"]["exposure"], -5.0);
+ assert_eq!(partial["light"]["contrast"], -100.0);
+}
+
+#[test]
+fn wal_checksums_cover_commits_without_materializing_historical_databases() {
+ let mut main = vec![0; 512];
+ main[16..18].copy_from_slice(&512u16.to_be_bytes());
+ assert_eq!(wal_checksum(&[1, 0, 0, 0, 2, 0, 0, 0], false, (0, 0)), (1, 3));
+ for big in [false, true] {
+ let mut wal = vec![0; 32];
+ wal[0..4].copy_from_slice(&(if big { 0x377f0683u32 } else { 0x377f0682u32 }).to_be_bytes());
+ wal[4..8].copy_from_slice(&3_007_000u32.to_be_bytes());
+ wal[8..12].copy_from_slice(&512u32.to_be_bytes());
+ wal[16..20].copy_from_slice(&123u32.to_be_bytes());
+ let mut sum = wal_checksum(&wal[..24], big, (0, 0));
+ wal[24..28].copy_from_slice(&sum.0.to_be_bytes());
+ wal[28..32].copy_from_slice(&sum.1.to_be_bytes());
+ for _ in 0..128 {
+ let mut frame = vec![0; 536];
+ frame[0..4].copy_from_slice(&1u32.to_be_bytes());
+ frame[4..8].copy_from_slice(&1u32.to_be_bytes());
+ frame[8..12].copy_from_slice(&123u32.to_be_bytes());
+ sum = wal_checksum(&frame[..8], big, sum);
+ sum = wal_checksum(&frame[24..], big, sum);
+ frame[16..20].copy_from_slice(&sum.0.to_be_bytes());
+ frame[20..24].copy_from_slice(&sum.1.to_be_bytes());
+ wal.extend(frame);
+ }
+ assert_eq!(committed_wal_len(&main, &wal).unwrap(), wal.len());
+ let end = wal.len();
+ wal[end - 1] ^= 1;
+ assert_eq!(committed_wal_len(&main, &wal).unwrap(), end - 536);
+ wal[24] ^= 1;
+ assert!(committed_wal_len(&main, &wal).is_err());
+ main[17] = 0;
+ assert!(committed_wal_len(&main, &wal).is_err());
+ main[16..18].copy_from_slice(&512u16.to_be_bytes());
+ }
+}
+
+#[test]
+fn persistent_reimport_keeps_copy_and_collection_ids_and_capture_time() {
+ let dir = std::env::temp_dir().join(format!("lightcraft-lrcat-reimport-{}", std::process::id()));
+ let mut s = crate::Session::new();
+ s.open_library(&dir, false).unwrap();
+ let mut data = sample();
+ data.collections.reverse(); // Parent must be committed before its child regardless of row order.
+ let first = apply(&mut s, data.clone(), false).unwrap();
+ s.close_library().unwrap();
+ s.open_library(&dir, false).unwrap();
+ let id = PhotoId(first["mapping"]["1"].as_u64().unwrap());
+ s.commit("Changed time", Op::SetCaptured { id, captured: None }).unwrap();
+ let second = apply(&mut s, data, true).unwrap();
+ assert_eq!(first["mapping"], second["mapping"]);
+ assert_eq!(first["imported"], 2);
+ assert_eq!(second["imported"], 0, "reimport updates records instead of adding them");
+ assert_eq!(second["missing"].as_array().unwrap().len(), 1, "offline originals are reported on reimport too");
+ assert_eq!(second["library"], dir.to_string_lossy().as_ref());
+ assert_eq!(s.catalog.len(), 2);
+ assert_eq!(s.catalog.albums().count(), 2);
+ assert_eq!(s.catalog.photo(id).unwrap().captured.as_deref(), Some("2024-01-16T12:34:56"));
+ s.close_library().unwrap();
+ std::fs::remove_dir_all(dir).unwrap();
+}
+
+// Construct a small SQLite fixture from public file-format records, never private media.
+fn varint(mut n: u64) -> Vec<u8> {
+ let mut out = vec![(n & 127) as u8];
+ n >>= 7;
+ while n > 0 {
+ out.push((n & 127) as u8 | 128);
+ n >>= 7;
+ }
+ out.reverse();
+ out
+}
+fn record(values: &[SqlValue]) -> Vec<u8> {
+ let mut header = Vec::new();
+ let mut body = Vec::new();
+ for value in values {
+ let serial = match value {
+ SqlValue::Null => 0,
+ SqlValue::Integer(n) => {
+ body.extend(n.to_be_bytes());
+ 6
+ }
+ SqlValue::Text(s) => {
+ body.extend(s.as_bytes());
+ 13 + 2 * s.len() as u64
+ }
+ _ => unreachable!(),
+ };
+ header.extend(varint(serial));
+ }
+ let mut out = varint(1 + header.len() as u64);
+ out.extend(header);
+ out.extend(body);
+ out
+}
+fn leaf(page: &mut [u8], offset: usize, rows: &[Vec<SqlValue>]) {
+ page[offset] = 13;
+ page[offset + 3..offset + 5].copy_from_slice(&(rows.len() as u16).to_be_bytes());
+ let mut end = page.len();
+ for (i, values) in rows.iter().enumerate() {
+ let payload = record(values);
+ let mut cell = varint(payload.len() as u64);
+ cell.extend(varint(i as u64 + 1));
+ cell.extend(payload);
+ end -= cell.len();
+ page[end..end + cell.len()].copy_from_slice(&cell);
+ page[offset + 8 + i * 2..offset + 10 + i * 2].copy_from_slice(&(end as u16).to_be_bytes());
+ }
+ page[offset + 5..offset + 7].copy_from_slice(&(end as u16).to_be_bytes());
+}
+/// A one-row-per-table SQLite file: `(name, columns, row)` each.
+fn native_catalog(tables: &[(&str, &str, Vec<SqlValue>)]) -> Vec<u8> {
+ native_catalog_with_last_table_page(tables, None)
+}
+/// [`native_catalog`] whose last table claims `last_page` as its root page.
+fn native_catalog_with_last_table_page(tables: &[(&str, &str, Vec<SqlValue>)], last_page: Option<i64>) -> Vec<u8> {
+ let tables: Vec<_> = tables.iter().map(|(name, columns, row)| (*name, *columns, vec![row.clone()])).collect();
+ native_catalog_rows(&tables, last_page)
+}
+/// A SQLite file with one leaf page per table: `(name, columns, rows)` each. `last_page` overrides the last
+/// table's root page.
+fn native_catalog_rows(tables: &[(&str, &str, Vec<Vec<SqlValue>>)], last_page: Option<i64>) -> Vec<u8> {
+ use SqlValue::{Integer as I, Text as T};
+ let mut bytes = vec![0u8; 5 * 2048];
+ bytes[..16].copy_from_slice(b"SQLite format 3\0");
+ bytes[16..18].copy_from_slice(&2048u16.to_be_bytes());
+ bytes[18] = 1;
+ bytes[19] = 1;
+ bytes[21] = 64;
+ bytes[22] = 32;
+ bytes[23] = 32;
+ bytes[28..32].copy_from_slice(&5u32.to_be_bytes());
+ bytes[44..48].copy_from_slice(&4u32.to_be_bytes());
+ bytes[56..60].copy_from_slice(&1u32.to_be_bytes());
+ let mut schema = Vec::new();
+ for (i, (name, columns, rows)) in tables.iter().enumerate() {
+ schema.push(vec![
+ T("table".into()),
+ T((*name).into()),
+ T((*name).into()),
+ I(if i + 1 == tables.len() { last_page.unwrap_or(i as i64 + 2) } else { i as i64 + 2 }),
+ T(format!("CREATE TABLE {name} ({columns})")),
+ ]);
+ leaf(&mut bytes[(i + 1) * 2048..(i + 2) * 2048], 0, rows);
+ }
+ leaf(&mut bytes[..2048], 100, &schema);
+ bytes
+}
+
+fn photo_tables(root: (&str, &str)) -> Vec<(&'static str, &'static str, Vec<SqlValue>)> {
+ use SqlValue::{Integer as I, Null as N, Text as T};
+ vec![
+ (
+ "AgLibraryRootFolder",
+ "id_local INTEGER PRIMARY KEY, absolutePath, name, relativePathFromCatalog",
+ vec![N, T(root.0.into()), T("Photos".into()), T(root.1.into())],
+ ),
+ ("AgLibraryFolder", "id_local INTEGER PRIMARY KEY, rootFolder, pathFromRoot", vec![N, I(1), T("Photos/".into())]),
+ ("AgLibraryFile", "id_local INTEGER PRIMARY KEY, folder, idx_filename", vec![N, I(1), T("test.ARW".into())]),
+ (
+ "Adobe_images",
+ "id_local INTEGER PRIMARY KEY, id_global, rootFile, fileFormat, fileWidth, fileHeight, rating, pick",
+ vec![N, T("fixture-image".into()), I(1), T("ARW".into()), I(20), I(10), I(5), I(1)],
+ ),
+ ]
+}
+
++#[test]
++fn native_video_import_is_visible_in_video_filter() {
++ let dir = std::env::temp_dir().join(format!("lightcraft-lrcat-video-filter-{}", std::process::id()));
++ std::fs::create_dir_all(&dir).unwrap();
++ let path = dir.join("videos.lrcat");
++ let mut tables = photo_tables((dir.to_str().unwrap(), ""));
++ tables[2].2[2] = SqlValue::Text("clip.MOV".into());
++ tables[3].2[3] = SqlValue::Text("VIDEO".into());
++ std::fs::write(&path, native_catalog(&tables)).unwrap();
++ let mut s = crate::Session::new();
++ let imported = s.execute("library.importLightroom", &json!({"path": path})).unwrap();
++ let id = PhotoId(imported["mapping"]["1"].as_u64().unwrap());
++ assert_eq!(s.catalog.photo(id).unwrap().kind, lightcraft_catalog::MediaKind::Video);
++ s.execute("library.filter", &json!({"kind": "video"})).unwrap();
++ assert_eq!(s.visible(), &[id]);
++ s.execute("library.filter", &json!({"kind": "image"})).unwrap();
++ assert!(s.visible().is_empty());
++ s.execute("edit.undo", &json!({})).unwrap();
++ assert!(s.catalog.is_empty());
++ s.execute("edit.redo", &json!({})).unwrap();
++ s.execute("library.filter", &json!({"kind": "video"})).unwrap();
++ assert_eq!(s.visible(), &[id]);
++ std::fs::remove_dir_all(dir).unwrap();
++}
++
++#[test]
++fn native_video_reimport_repairs_kind_without_losing_edits_or_memberships() {
++ let dir = std::env::temp_dir().join(format!("lightcraft-lrcat-video-reimport-{}", std::process::id()));
++ std::fs::create_dir_all(&dir).unwrap();
++ let path = dir.join("videos.lrcat");
++ let mut tables = photo_tables((dir.to_str().unwrap(), ""));
++ tables[2].2[2] = SqlValue::Text("clip.MOV".into());
++ tables[3].2[3] = SqlValue::Text("VIDEO".into());
++ std::fs::write(&path, native_catalog(&tables)).unwrap();
++ let mut s = crate::Session::new();
++ let id = s.catalog.alloc_photo_id();
++ let mut photo =
++ Photo::new(id, Source::File { path: dir.join("Photos/clip.MOV").to_string_lossy().into() }, "clip.MOV", "VIDEO", 1920, 1080, "before");
++ photo.rating = 5;
++ photo.flag = Flag::Pick;
++ photo.file_size = 1234;
++ photo.content_hash = Some("existing-content".into());
++ s.commit("Previous import", Op::AddPhoto { photo: Box::new(photo) }).unwrap();
++ let mut settings = lightcraft_develop::DevelopSettings::default();
++ settings.light.exposure = 0.75;
++ s.set_develop(id, settings, "Personal edit").unwrap();
++ let peer_id = s.catalog.alloc_photo_id();
++ let peer = Photo::new(peer_id, Source::File { path: "/missing/peer.jpg".into() }, "peer.jpg", "JPEG", 20, 10, "before");
++ s.commit("Peer", Op::AddPhoto { photo: Box::new(peer) }).unwrap();
++ let mut album = Album::new(s.catalog.alloc_album_id(), "Personal album");
++ album.photos = vec![id, peer_id];
++ s.commit("Album", Op::AddAlbum { album: album.clone() }).unwrap();
++ let stack = lightcraft_catalog::Stack { id: s.catalog.alloc_stack_id(), photos: vec![id, peer_id], collapsed: false };
++ s.commit("Stack", Op::AddStack { stack: stack.clone() }).unwrap();
++ let before = s.catalog.to_snapshot();
++ let mut expected = (**s.catalog.photo(id).unwrap()).clone();
++ expected.kind = lightcraft_catalog::MediaKind::Video;
++ s.execute("library.filter", &json!({"kind": "video"})).unwrap();
++ assert!(s.visible().is_empty());
++ let result = s.execute("library.importLightroom", &json!({"path": path})).unwrap();
++ assert_eq!(result["mapping"]["1"], id.0);
++ assert_eq!(result["imported"], 0);
++ assert_eq!(result["preservedExistingEdits"], 1);
++ assert_eq!(s.catalog.photo(id).unwrap().as_ref(), &expected);
++ assert_eq!(s.visible(), &[id]);
++ let after = s.catalog.to_snapshot();
++ assert_eq!(s.catalog.album(album.id), Some(&album));
++ assert_eq!(s.catalog.stack(stack.id), Some(&stack));
++ s.execute("edit.undo", &json!({})).unwrap();
++ assert_eq!(s.catalog.to_snapshot(), before);
++ assert!(s.visible().is_empty());
++ s.execute("edit.redo", &json!({})).unwrap();
++ assert_eq!(s.catalog.to_snapshot(), after);
++ assert_eq!(s.visible(), &[id]);
++ std::fs::remove_dir_all(dir).unwrap();
++}
++
+#[test]
+fn reads_native_sqlite_tables_without_lightroom_or_external_processes() {
+ let bytes = native_catalog(&photo_tables(("/catalog/", "")));
+ let path = std::env::temp_dir().join(format!("lightcraft-native-catalog-{}.lrcat", std::process::id()));
+ std::fs::write(&path, &bytes).unwrap();
+ let catalog = read(&path).unwrap();
+ assert_eq!(catalog.photos.len(), 1);
+ assert_eq!(catalog.photos[0].uuid, "fixture-image");
+ assert_eq!(number(&catalog.photos[0].image, "rating"), 5);
+ assert!(catalog.photos[0].path.ends_with("test.ARW"));
+ // Put the required image table beyond the old 1 GiB cutoff without allocating it.
+ // A main-file-sized allocation would defeat the purpose of the page-backed reader.
+ // The large fixture relies on Unix sparse-file behavior; small parity runs everywhere.
+ #[cfg(unix)]
+ {
+ let far_offset = 1u64 << 30;
+ let bytes = native_catalog_with_last_table_page(&photo_tables(("/catalog/", "")), Some((far_offset / 2048 + 1) as i64));
+ use std::io::{Seek, SeekFrom, Write};
+ let mut sparse = std::fs::OpenOptions::new().write(true).truncate(true).open(&path).unwrap();
+ sparse.write_all(&bytes).unwrap();
+ sparse.set_len(far_offset + 2048).unwrap();
+ sparse.seek(SeekFrom::Start(far_offset)).unwrap();
+ sparse.write_all(&bytes[4 * 2048..5 * 2048]).unwrap();
+ drop(sparse);
+ let large = read(&path).unwrap();
+ assert_eq!(serde_json::to_value(&large.photos).unwrap(), serde_json::to_value(&catalog.photos).unwrap());
+ let mut session = crate::Session::new();
+ session.execute("library.importLightroom", &json!({"path": path.to_string_lossy()})).unwrap();
+ assert_eq!(session.catalog.len(), 1);
+ assert_eq!(session.catalog.photos().next().unwrap().rating, 5);
+ session.execute("edit.undo", &json!({})).unwrap();
+ assert!(session.catalog.is_empty());
+ }
+ std::fs::write(&path, b"bad catalog").unwrap();
+ assert!(read(&path).is_err());
+ std::fs::remove_file(path).unwrap();
+}
+
+/// Reads `tables` as a catalog file and returns what the reader made of it.
+fn read_tables(tables: &[(&str, &str, Vec<Vec<SqlValue>>)], name: &str) -> CatalogImport {
+ let path = std::env::temp_dir().join(format!("lightcraft-{name}-{}.lrcat", std::process::id()));
+ std::fs::write(&path, native_catalog_rows(tables, None)).unwrap();
+ let catalog = read(&path).unwrap();
+ std::fs::remove_file(path).unwrap();
+ catalog
+}
+
+/// `tables` with each row as a one-row table, for [`native_catalog_rows`].
+fn one_row(tables: Vec<(&'static str, &'static str, Vec<SqlValue>)>) -> Vec<(&'static str, &'static str, Vec<Vec<SqlValue>>)> {
+ tables.into_iter().map(|(name, columns, row)| (name, columns, vec![row])).collect()
+}
+
+#[test]
+fn images_with_incomplete_records_are_skipped_not_fatal() {
+ use SqlValue::{Integer as I, Text as T};
+ // (table, column, value): the record that breaks, and the reason the import gives
+ let cases = [
+ (3, 2, I(2), SkipReason::MissingFile), // Adobe_images.rootFile → no such file
+ (2, 1, I(2), SkipReason::MissingFolder), // AgLibraryFile.folder → no such folder
+ (1, 1, I(2), SkipReason::MissingRoot), // AgLibraryFolder.rootFolder → no such root
+ (2, 2, T(String::new()), SkipReason::IncompletePath), // AgLibraryFile.idx_filename empty
+ ];
+ for (table, column, value, reason) in cases {
+ let mut tables = one_row(photo_tables(("/catalog/", "")));
+ tables[table].2[0][column] = value;
+ let catalog = read_tables(&tables, &format!("skipped-{reason:?}"));
+ assert!(catalog.photos.is_empty(), "{reason:?}");
+ assert_eq!(catalog.skipped, [SkippedImage { image: 1, reason }]);
+ assert!(catalog.warnings.is_empty(), "{reason:?}: {:?}", catalog.warnings);
+ }
+}
+
+#[test]
+fn a_virtual_copy_of_a_skipped_master_is_skipped_too() {
+ use SqlValue::{Integer as I, Null as N, Text as T};
+ let mut tables = one_row(photo_tables(("/catalog/", "")));
+ tables[3] = (
+ "Adobe_images",
+ "id_local INTEGER PRIMARY KEY, id_global, rootFile, masterImage, fileFormat, fileWidth, fileHeight, rating, pick",
+ vec![
+ // the master's file record is gone, so it is skipped …
+ vec![N, T("master".into()), I(2), N, T("ARW".into()), I(20), I(10), I(5), I(1)],
+ // … and its virtual copy goes with it, although its own file record is there
+ vec![N, T("copy".into()), I(1), I(1), T("ARW".into()), I(20), I(10), I(3), I(0)],
+ ],
+ );
+ let catalog = read_tables(&tables, "skipped-copy");
+ assert!(catalog.photos.is_empty());
+ assert_eq!(
+ catalog.skipped,
+ [SkippedImage { image: 1, reason: SkipReason::MissingFile }, SkippedImage { image: 2, reason: SkipReason::MasterSkipped }]
+ );
+ validate(&catalog).unwrap();
+}
+
+#[test]
+fn skipped_images_are_in_the_import_report() {
+ let mut data = sample();
+ data.photos.retain(|p| p.source_id != 1);
+ drop_copies_of(&mut data, &HashSet::from([1]));
+ data.skipped.insert(0, SkippedImage { image: 1, reason: SkipReason::MissingFile });
+ let mut s = crate::Session::new();
+ let report = apply(&mut s, data, false).unwrap();
+ assert_eq!(report["photos"], 0);
+ assert_eq!(report["skipped"], json!([{"image": 1, "reason": "missingFile"}, {"image": 2, "reason": "masterSkipped"}]));
+ assert_eq!(report["warnings"], json!([]));
+}
+
+#[test]
+fn preparation_skips_missing_original_probes_but_keeps_catalog_records() {
+ let dir = std::env::temp_dir().join(format!("lightcraft-lrcat-offline-probes-{}", std::process::id()));
+ std::fs::create_dir_all(&dir).unwrap();
+ let source = dir.join("source.lrcat");
+ let root = dir.join("offline");
+ let tables = photo_tables((root.to_str().unwrap(), ""));
+ std::fs::write(&source, native_catalog(&tables)).unwrap();
+ let mut s = crate::Session::new();
+ let probes = Arc::new(AtomicUsize::new(0));
+ let calls = probes.clone();
+ s.media.file_probe = Some(Arc::new(move |_| {
+ calls.fetch_add(1, Ordering::Relaxed);
+ Err("a known-missing original must not be probed".into())
+ }));
+ let mut job = crate::lightroom_job::LightroomJob::new(&mut s, source, false).unwrap();
+ let prepared = job.prepare(&AtomicBool::new(false)).unwrap();
+ assert_eq!(probes.load(Ordering::Relaxed), 0);
+ let result = crate::lightroom_job::commit_prepared(&mut s, prepared).unwrap();
+ assert_eq!(result.report["imported"], 1);
+ assert_eq!(result.report["failed"], json!([]));
+ assert_eq!(result.report["missing"].as_array().unwrap().len(), 1);
+ let photo = s.catalog.photos().next().unwrap();
+ assert_eq!(photo.rating, 5);
+ assert_eq!((photo.width, photo.height), (20, 10));
+ s.execute("edit.undo", &json!({})).unwrap();
+ assert!(s.catalog.is_empty());
+ std::fs::remove_dir_all(dir).unwrap();
+}
+
+#[test]
+fn probed_original_is_counted_once_and_reimport_adds_nothing() {
+ let dir = std::env::temp_dir().join(format!("lightcraft-lrcat-present-probes-{}", std::process::id()));
+ std::fs::create_dir_all(dir.join("Photos")).unwrap();
+ let source = dir.join("source.lrcat");
+ std::fs::write(dir.join("Photos/test.ARW"), b"original").unwrap();
+ std::fs::write(&source, native_catalog(&photo_tables((dir.to_str().unwrap(), "")))).unwrap();
+ let mut s = crate::Session::new();
+ let probes = Arc::new(AtomicUsize::new(0));
+ let calls = probes.clone();
+ s.media.file_probe = Some(Arc::new(move |_| {
+ calls.fetch_add(1, Ordering::Relaxed);
+ Ok(crate::media::ProbeInfo { format: "ARW".into(), width: 20, height: 10, ..Default::default() })
+ }));
+ for expected in [1, 0] {
+ let mut job = crate::lightroom_job::LightroomJob::new(&mut s, source.clone(), false).unwrap();
+ let prepared = job.prepare(&AtomicBool::new(false)).unwrap();
+ let completion = crate::lightroom_job::commit_prepared(&mut s, prepared).unwrap();
+ assert_eq!(completion.report["imported"], expected);
+ assert_eq!(completion.report["missing"], json!([]));
+ assert_eq!(completion.report["failed"], json!([]));
+ assert_eq!(s.catalog.len(), 1);
+ }
+ assert_eq!(probes.load(Ordering::Relaxed), 1);
+ std::fs::remove_dir_all(dir).unwrap();
+}
+
+#[test]
+fn a_root_missing_here_is_found_relative_to_the_catalog() {
+ let dir = std::env::temp_dir().join(format!("lightcraft-relocated-catalog-{}", std::process::id()));
+ let _ = std::fs::remove_dir_all(&dir);
+ std::fs::create_dir_all(dir.join("Lightroom")).unwrap();
+ std::fs::create_dir_all(dir.join("RAW")).unwrap();
+ let path = dir.join("Lightroom").join("Lightroom.lrcat");
+ std::fs::write(&path, native_catalog(&photo_tables(("C:/Users/me/Project/RAW/", "../RAW/")))).unwrap();
+ let catalog = read(&path).unwrap();
+ assert_eq!(Path::new(&catalog.photos[0].path), dir.join("RAW").join("Photos").join("test.ARW"));
+ assert!(catalog.warnings.iter().any(|w| w.contains("relative to the catalog")), "{:?}", catalog.warnings);
+ // a relative path that leads nowhere keeps the recorded one
+ std::fs::write(&path, native_catalog(&photo_tables(("C:/Users/me/Project/RAW/", "../Elsewhere/")))).unwrap();
+ let catalog = read(&path).unwrap();
+ assert!(Path::new(&catalog.photos[0].path).starts_with("C:/Users/me/Project/RAW/"), "{}", catalog.photos[0].path);
+ assert!(catalog.warnings.is_empty(), "{:?}", catalog.warnings);
+ std::fs::remove_dir_all(dir).unwrap();
+}
+
+#[test]
+fn originals_on_other_computers_are_never_looked_at_or_added() {
+ let dir = std::env::temp_dir().join(format!("lightcraft-lrcat-remote-roots-{}", std::process::id()));
+ let _ = std::fs::remove_dir_all(&dir);
+ std::fs::create_dir_all(dir.join("Photos")).unwrap();
+ std::fs::write(dir.join("Photos/test.ARW"), b"original").unwrap();
+ let source = dir.join("source.lrcat");
+ let mut roots = vec![r"\\192.0.2.1\share\".to_string(), "file://192.0.2.1/s/".to_string()];
+ if cfg!(unix) {
+ // `//<local folder>/` is a local folder to Linux, but a network path to the resolver.
+ roots.push(format!("/{}/", dir.display()));
+ }
+ for root in &roots {
+ std::fs::write(&source, native_catalog(&photo_tables((root, "")))).unwrap();
+ let catalog = read(&source).unwrap();
+ assert!(matches!(catalog.photos[0].original, Original::Refused(_)), "{root}: {:?}", catalog.photos[0]);
+ assert!(catalog.warnings.iter().any(|w| w.contains("not opened")), "{root}: {:?}", catalog.warnings);
+ let mut s = crate::Session::new();
+ let probes = Arc::new(AtomicUsize::new(0));
+ let calls = probes.clone();
+ s.media.file_probe = Some(Arc::new(move |_| {
+ calls.fetch_add(1, Ordering::Relaxed);
+ Err("a refused original must not be probed".into())
+ }));
+ let report = import(&mut s, &source, false).unwrap();
+ assert_eq!(probes.load(Ordering::Relaxed), 0, "{root}");
+ assert_eq!(report["missing"].as_array().map(Vec::len), Some(1), "{root}: {report}");
+ assert!(s.catalog.is_empty(), "{root}");
+ }
+ // An absolute folder path would replace the root.
+ let mut tables = photo_tables((dir.to_str().unwrap(), ""));
+ tables[1].2[2] = SqlValue::Text(format!("{}/Photos/", dir.display()));
+ std::fs::write(&source, native_catalog(&tables)).unwrap();
+ assert!(matches!(read(&source).unwrap().photos[0].original, Original::Refused(_)));
+ // A root beside the catalog is followed.
+ std::fs::write(&source, native_catalog(&photo_tables((dir.to_str().unwrap(), "")))).unwrap();
+ let catalog = read(&source).unwrap();
+ assert_eq!(catalog.photos[0].original, Original::Local);
+ assert!(catalog.photos[0].original_is_file());
+ // A root that moved is found through its path relative to the catalog.
+ std::fs::write(&source, native_catalog(&photo_tables((r"\\192.0.2.1\share\", "./")))).unwrap();
+ let catalog = read(&source).unwrap();
+ assert!(catalog.photos[0].original_is_file(), "{:?}", catalog.photos[0]);
+ std::fs::remove_dir_all(dir).unwrap();
+}
+
+#[test]
+fn oversized_optional_table_warns_and_is_skipped() {
+ let mut main = vec![0u8; 2 * 512];
+ main[..16].copy_from_slice(b"SQLite format 3\0");
+ main[16..18].copy_from_slice(&512u16.to_be_bytes());
+ main[18] = 1;
+ main[19] = 1;
+ main[21] = 64;
+ main[22] = 32;
+ main[23] = 32;
+ main[28..32].copy_from_slice(&2u32.to_be_bytes());
+ main[44..48].copy_from_slice(&4u32.to_be_bytes());
+ main[56..60].copy_from_slice(&1u32.to_be_bytes());
+ main[100] = 0x0d;
+ let page = &mut main[512..];
+ page[0] = 0x0d;
+ page[3..5].copy_from_slice(&1u16.to_be_bytes());
+ let mut cell = varint((64 * 1024 * 1024 + 1) as u64);
+ cell.extend(varint(1));
+ let start = 500 - cell.len();
+ page[start..start + cell.len()].copy_from_slice(&cell);
+ page[8..10].copy_from_slice(&u16::try_from(start).unwrap_or(0).to_be_bytes());
+ page[5..7].copy_from_slice(&u16::try_from(start).unwrap_or(0).to_be_bytes());
+ let db = Database::open_with_wal(main, &[]).unwrap();
+ let reader = Reader { db, tables: vec![LiveTable { name: "optional_history".into(), rootpage: 2, column_names: Some(vec!["payload".into()]) }] };
+ let mut warnings = Vec::new();
+ let rows = reader.optional_table("optional_history", &mut warnings).unwrap();
+ assert!(rows.is_empty());
+ assert!(warnings.iter().any(|warning| warning.contains("optional_history")));
+}
diff --cc docs/gaps.md
index 671f3089c,c3d89b157..8918541c7
--- a/docs/gaps.md
+++ b/docs/gaps.md
@@@ -22,14 -22,14 +22,14 @@@ Hours are Opus 5.5 agent wall-clock hou
| 5 B | **AI masks: Subject, Sky, People, Background, Landscape** are heuristics; Object / Describe run SAM 3 but its download has no mirror configured | `crates/segment`; ai-masks.md; MASK rows 67% | masking is how most Lightroom users edit today | 40–70 + model decision | [target-app-parity](target-app-parity.md#ai) |
| 6 B | **Compressed ORF** (every Olympus / OM body since ~2008) | measured: 66 of 78 Olympus / OM models preview-only; `orf.rs` refuses; OM bucket 3% of photographers, 3% of them fully work | +2.6 points; best gain per hour of any raw gap (~0.2) | 8–15 | [raw-parity](raw-parity.md#compressed-orf-a-clean-room-starting-point) (the two Olympus patents that describe the method) |
| 7 | **Nikon High Efficiency NEF** (HE / HE★ on Z 8, Z 9, Z 6III, Z f, Z50II, Z5II when set to HE) | named and preview only (#193); needs a pure-Rust JPEG XS decoder | +1.1 points (only shots taken in HE; lossless works on the same bodies); low gain per hour (~0.04), so not a beta blocker | 20–40 | [raw-parity](raw-parity.md) |
-| 8 B | **No lens profile database** (LR-EDIT-OPTICS-PROFILE): only DNG opcodes, RW2 in-file distortion, Sony ILCE-7RM4A and ILCE-7RM6 distortion (`docs/sony-ilce7rm6-lens-corrections.md`) and Nikon Z 6II / Z 8 / Z f distortion (`docs/nikon-lens-corrections.md`) | Adobe ships 3,635 lens profiles; we never use them | distortion / vignetting correction is a default step for many | 40–80 + calibration shots | [raw-parity](raw-parity.md#lens-profiles) |
-| 9 B | **Tests don't run in CI on macOS, Windows or Linux x64**: only FreeBSD runs `cargo test`; the others build packages | `.github/workflows/` (freebsd, packaging-lint, release, windows-arm64); the linux-riscv64 release job added in 0.6.0 (#844) runs only `lightcraft-cli --version` under QEMU | regressions reach users on the main platforms; `cargo xtask ci` runs only locally | 6–12 | [target-app-parity](target-app-parity.md#by-dimension) |
-| 10 B | **Per-model verification thin, plus cheap per-body decode fixes**: 545 of 1,446 Adobe models verified (38%), ~85% of photographers on a verified body; Nikon 5 bodies verified, Canon 34, Leica 14 (the Q3 by a recorded check of 38 private DNGs). Cheap fixes: Z 6II packed 14-bit NEF (#769, PR #671), Sony A100 / F828 regression (#702), DSLR-A200…A390 / A850 12-bit ARW (#535) | measured: [raw/coverage.tsv](raw/coverage.tsv) | per-body bugs (levels, crops, WB) surface only from users | 25–45 | [raw-parity](raw-parity.md#by-maker-measured) |
+| 8 B | **No lens profile database** (LR-EDIT-OPTICS-PROFILE): only DNG opcodes, RW2 in-file distortion, Sony ILCE-7RM4A, full-frame ILCE-7CR distortion (Auto only) and ILCE-7RM6 distortion (`docs/sony-ilce7rm6-lens-corrections.md`) and Nikon Z 6II / Z 8 / Z f distortion (`docs/nikon-lens-corrections.md`); tracked in #329 | Adobe ships 3,635 lens profiles; we never use them | distortion / vignetting correction is a default step for many | 40–80 + calibration shots | [raw-parity](raw-parity.md#lens-profiles) |
+| 9 B | **Tests don't run in CI on macOS or Windows**: Linux x64 runs `cargo xtask ci` on every PR and push to main (`.github/workflows/ci.yml`) and FreeBSD runs `cargo test`; the others build packages | `.github/workflows/` (ci, freebsd, packaging-lint, release, windows-arm64); the linux-riscv64 release job added in 0.6.0 (#844) runs only `lightcraft-cli --version` under QEMU; macOS / Windows jobs: #1148 | regressions in `cfg(target_os)` code reach macOS and Windows users | 6–12 | [target-app-parity](target-app-parity.md#by-dimension) |
+| 10 B | **Per-model verification thin, plus cheap per-body decode fixes**: 551 of 1,446 Adobe models verified (38%), ~85% of photographers on a verified body; Nikon 5 bodies verified, Canon 34, Leica 14 (the Q3 by a recorded check of 38 private DNGs). Cheap fixes: Z 6II packed 14-bit NEF (#769, PR #671), Sony A100 regression (#702); F828 SRF now discovered and imported as preview-only, sensor decoding still missing, DSLR-A200…A390 / A850 12-bit ARW (#535) | measured: [raw/coverage.tsv](raw/coverage.tsv) | per-body bugs (levels, crops, WB) surface only from users | 25–45 | [raw-parity](raw-parity.md#by-maker-measured) |
| 11 | **Enhance: Raw Details, Super Resolution; AI denoise without shippable weights or X-Trans** | ENH rows 0%; denoise Bayer only, RawNIND weights GPL and opt-in | Fujifilm users get no AI denoise; nobody gets it out of the box | 30–60 + model decision | [raw-parity](raw-parity.md#demosaic-levels-crops-and-lens-metadata) |
| 12 | **Content-aware / generative remove, detect distractions, reflections removal** | REM rows 75%; patch synthesis missing | cleanup work goes back to Photoshop | 25–45 (+ generative model) | [target-app-parity](target-app-parity.md#ai) |
- | 13 | **Lightroom catalog migration is one-way and approximate**: unsupported Adobe profiles / AI settings archived, history kept as data; main-file pages read on demand up to 16 GiB, with dense-table and WAL bounds retained (#798); offline record counts and destination are now shown in a lasting import result; before an import the app asks whether the catalog merges into the open library or goes into a new library (opt-out in Settings, #2672) | lightroom-catalog-import.md | switching users lose some looks | 8–12 | [file-format-parity](file-format-parity.md) |
-| 13 | **Lightroom catalog migration is one-way and approximate**: unsupported Adobe profiles / AI settings archived, history kept as data; offline record counts and destination are now shown in a lasting import result; catalog VIDEO records match the Videos filter, with older classification repaired on reimport | lightroom-catalog-import.md | switching users lose some looks | 8–12 | [file-format-parity](file-format-parity.md) |
++| 13 | **Lightroom catalog migration is one-way and approximate**: unsupported Adobe profiles / AI settings archived, history kept as data; main-file pages read on demand up to 16 GiB, with dense-table and WAL bounds retained (#798); offline record counts and destination are now shown in a lasting import result; catalog VIDEO records match the Videos filter, with older classification repaired on reimport; before an import the app asks whether the catalog merges into the open library or goes into a new library (opt-out in Settings, #2672) | lightroom-catalog-import.md | switching users lose some looks | 8–12 | [file-format-parity](file-format-parity.md) |
| 14 | **HDR display** (EDR / Windows HDR); the headroom limit and SDR rendition from `crs` XMP (the HDR switch, `HDREditMode`, is read). HLG AVIF export done; the display's SDR/HDR decision is tested, blocked on eframe's 8-bit surface | HDR rows 70%; LR-VIEW-HDR-DISPLAY ⬜ | HDR editing works blind on HDR monitors | 12–25 | [hardware-parity](hardware-parity.md) |
-| 15 | **Print module**: identity plate / watermark / page numbers / crop marks / photo info overlays, Custom Package Auto Layout, printer-driver Page Setup and direct printing, JPEG file output (the Print dialog writes a colour-managed PDF) | LRC-PRINT rows | Classic users who print | 15–25 | [target-app-parity](target-app-parity.md#features) |
+| 15 | **Print module**: identity plate / watermark / photo info overlays, Cut Guides for the packages, Custom Package Auto Layout, printer-driver Page Setup and direct printing, JPEG file output (the Print dialog writes a colour-managed PDF) | LRC-PRINT rows | Classic users who print | 15–25 | [target-app-parity](target-app-parity.md#features) |
| 16 | **Map view, Book, Slideshow module, publish services** | LRC-MAP / BOOK / SS rows ⬜ | Classic users; publish services matter for Flickr / SmugMug workflows | 60–100 | [target-app-parity](target-app-parity.md#features) |
| 17 | **Tethered capture** | ⬜ | studio photographers | 25–45 + cameras | [hardware-parity](hardware-parity.md) |
| 18 | **Video**: playback, trim, global edits, export | VID rows 0% | users who mix stills and clips | 25–45 | [target-app-parity](target-app-parity.md#features) |
@@@ -84,28 -77,7 +84,29 @@@ Beta-blocking gaps (B) total **~230–4
| Date | Change | Summary |
|---|---|---|
+| 2026-10-24 | minor | Gap 8: lens profile work is tracked in #329; hours unchanged |
+| 2026-10-24 | minor | Gap 28: ⌘⌥⇧C / ⌘⌥⇧V (Ctrl+Alt+Shift+C / V on Windows and Linux) copy and paste metadata; no key leaves the entry; hours unchanged |
+| 2026-10-24 | minor | Gap 30 shrinks: the Info panel's Show Metadata For (Target Photo / Selected Photos, `view.infoSelectedPhotos`) shows the selected photos' shared values and marks fields that differ as Mixed; the All Metadata dialog remains; 1–3 h (was 4–8) |
+| 2026-10-23 | minor | Gap 13: before a Lightroom catalog import the app asks whether it merges into the open library or goes into a new one (opt-out in Settings, #2672); hours unchanged |
+| 2026-10-22 | patch | Gap 28: View shows the current grid-cycle key beside Photo Grid and Square Grid (#2500); no new binding and no change to the remaining shortcut gap or hours |
+| 2026-10-22 | minor | Gap 15: the Print page setup and PDF gain the Japanese photo and postcard paper sizes (L判 89×127, 2L判 127×178, KG判 102×152, はがき 100×148, 往復はがき 148×200, 六切 203×254, 四切 254×305, 名刺 55×91 mm), by their customary names; gap not closed |
+| 2026-10-22 | minor | #2052: Thai glyphs added to shared export text; gap 21 retains Thai mark positioning, Arabic joining and bidi limits. No ranked gap closes; estimates unchanged |
+| 2026-10-24 | minor | LR-LIB-SMARTALBUM: relative-date views and source totals expire on the session-clock minute, including nested smart albums; ranked gaps and readiness counts unchanged |
+| 2026-10-22 | patch | XMP namespace-prefix collisions no longer overwrite foreign metadata; ranked gaps and estimates unchanged |
+| 2026-10-22 | patch | Issue #2519: PSD/PSB EXIF resource 1058 and XMP resource 1060 now use the common metadata extractor, and `.psb` files are accepted by import; no ranked gap or readiness count changes |
+| 2026-10-22 | minor | Gap 30 added: multi-select metadata editing — Info panel and All Metadata dialog show one photo's values with no mixed-value indication |
+| 2026-10-21 | minor | Gap 28 shrinks: F8 shows / hides the right panel (`view.rightPanel`); rating `[` `]`, flag cycling and F1 help were already bound, so the entry lists only filter-bar keys, Tab / ⇧Tab and F5; 2–4 h (was 4–8) |
+| 2026-10-20 | minor | #2362: import destination albums use the shared hierarchy/search picker instead of a flat name list; existing import workflows retained; ranked gaps/readiness counts unchanged |
+| 2026-10-19 | minor | Gap 9 shrinks: `.github/workflows/ci.yml` runs `cargo xtask ci` on Linux x64 for every PR and push to main; macOS and Windows remain |
+| 2026-10-19 | minor | Gap 21: Indonesian (`id`) shipped with every catalog message but What's New; four new languages left (Hindi, Arabic, Korean, Vietnamese), 135–239 h |
+| 2026-10-19 | minor | Gap 27: the released 0.9.1 x64 MSI is tested on Windows 11 Pro 24H2 (a fresh install and an upgrade from 0.8.0 end on the completion page, so #790 is fixed; the upgrade keeps a custom folder; Launch starts the app; removal leaves nothing behind); uninstalling from Settings → Apps still ends with no confirmation (#892, #931); hours unchanged |
+| 2026-10-18 | patch | Gap 1: six X-Trans CMOS 4 Fujifilm bodies (X-T30 …) take the X-T3's spectral matrices instead of the neutral matrix |
+| 2026-10-15 | minor | Gap 15 shrinks: the Page panel's Page Options (Page Numbers, Page Info, Crop Marks) print on Single Image and Contact Sheet pages; identity plate, watermark, photo info, Cut Guides, direct printing and JPEG output remain |
+| 2026-10-14 | minor | Gap 4 follow-up: the diagnostic overlays (Visualize Spots, Point Color range, HDR range) render zoom windows too; soft proofing runs on the GPU |
+| 2026-10-12 | minor | Gap 10: SR2/SRF folder discovery fixed; F828 imports as preview-only. Sensor decoding remains a gap; readiness scores unchanged |
+| 2026-10-23 | minor | Gap 28: ⌘L / Ctrl+L (Library ▸ Enable Filters) puts the filter aside and brings it back as it was; the entry drops ⌘L; hours unchanged |
+| 2026-10-15 | minor | Gap 28: `\` shows / hides the Filter Bar in the grids; the entry drops `[` `]` (#509), flag cycling (#1490) and F1 (Help), already on main; ⌘L is the filter-bar key left; hours unchanged |
+ | 2026-10-16 | patch | Gap 13: catalog VIDEO records match the Videos filter, including after reimport of older records (#1940, filter issue only). Video playback, frame previews and folder-sync discovery remain outside this repair; no gap closed or counts changed. |
| 2026-10-14 | minor | Gap 26: at 100k photos stack and album lookups are indexed, so an "In a Stack" or "Album" smart album counts in ~14 ms (was 0.6–2.7 s); open time unchanged |
| 2026-10-14 | minor | Gap 10: Camera-coverage sweep (#1327): 30 models verified on 40 CC0 files (coverage.py 515 → 545 verified); sensor verification does not establish colour parity (#1277) |
| 2026-10-14 | minor | Gap 21: de, es, fr, ja and uk catalogs filled (97–99%); 55–90 h → 40–70 h |
diff --cc docs/parity-checklist.md
index 08dab300b,7d6642ad3..ead8e6f14
--- a/docs/parity-checklist.md
+++ b/docs/parity-checklist.md
@@@ -695,19 -694,19 +695,19 @@@ From `08-lightroom-classic-extras.md` (
| LRC-LIB-AUTOIMPORT | Watched-folder import | P2 | ✅ | `cmd:library.autoImport` | see LR-IMP-AUTO |
| LRC-LIB-TETHER | Tethered capture | P2 | ⬜ | | |
| LRC-LIB-VIEWS | Grid / loupe / compare / survey / people | P1 | 🟡 | `cmd:view.photoGrid`, `cmd:view.squareGrid`, `cmd:view.detail`, `cmd:view.compare`, `cmd:view.survey`, `cmd:view.gridInfo` | grid, square grid, loupe, compare, survey, second window; square-grid captions: file name, exposure or capture date (View ▸ Grid Info; no people view; picking one in Photo Grid switches to Square Grid) |
-| LRC-LIB-COMPARE | Compare view | P1 | ✅ | `cmd:view.compare` | ⇧C (C is Crop here); swap, make select; a filmstrip click replaces the active side, a ⌘/Ctrl- or Shift-click changes the selection without touching the pair; zoom always linked; each pane says “Rendering…” or that the photo can't be opened, as the loupe does (see LR-VIEW-COMPARE) |
+| LRC-LIB-COMPARE | Compare view | P1 | ✅ | `cmd:view.compare` | ⇧C (C is Crop here); swap, make select; a filmstrip click replaces the active side, a ⌘/Ctrl- or Shift-click changes the selection without touching the pair; zoom always linked; each pane says “Rendering…” or that the photo can't be opened, as the loupe does (see LR-VIEW-COMPARE); the Info panel's stars and colour labels (and the Set Color Label menu) act on the active photo only, and each pane's caption shows its colour label (#2398) |
| LRC-LIB-SURVEY | Survey view | P2 | ✅ | `cmd:view.survey` | N |
-| LRC-LIB-REFVIEW | Reference view | P2 | ✅ | `cmd:view.reference`, `cmd:photo.setReference`, `crates/ui-egui/src/panels/compare.rs` (`show_reference`) | View ▸ Reference View (⇧R): the reference photo beside the active one (edited with the Edit panel); photo menu ▸ Set as Reference Photo; each pane says “Rendering…” (widget `compare:rendering:<pane>`) or “This photo can't be opened” (`compare:renderFailed:<pane>`) as the loupe does |
+| LRC-LIB-REFVIEW | Reference view | P2 | ✅ | `cmd:view.reference`, `cmd:photo.setReference`, `crates/ui-egui/src/panels/compare.rs` (`show_reference`) | View ▸ Reference View (⇧R): the reference photo beside the active one (edited with the Edit panel); photo menu ▸ Set as Reference Photo; each pane says “Rendering…” (widget `compare:rendering:<pane>`) or “This photo can't be opened” (`compare:renderFailed:<pane>`) as the loupe does. Escape → Detail without losing edits; pins are catalog-local; missing/deleted photos refused and deleted references no longer drawn (Windows regression/native smoke verified) |
| LRC-LIB-CATALOG-PANEL | Catalog sets | P1 | ✅ | `cmd:library.source` (`missing`) | all, recently added, picks, recently deleted, missing photos (when any) |
- | LRC-LIB-CATALOG-IMPORT | Native Lightroom Classic catalog import | P1 | 🟡 | `cmd:library.inspectLightroom`, `cmd:library.importLightroom`, `cmd:file.importLightroom`, `crates/engine/src/lightroom_catalog.rs`, `crates/ui-egui/src/dialogs/lightroom_destination.rs`, `crates/ui-egui/src/tests/lightroom_destination.rs`, `docs/lightroom-catalog-import.md` | before the import starts, File ▸ Import Lightroom Catalog… asks where the catalog goes: merge into the open library (named, with its photo count; preselected when it is empty) or create a new library (named after the catalog file, next to the open library, both editable), which is made and opened following File ▸ New Library…'s rules before the import; Cancel does nothing; Settings ▸ General ▸ "When importing a Lightroom catalog" (Ask where to import it / Always merge into the open library) or the window's "Don't ask again" turns it off; `file.importLightroom` takes `into` (`open` / `new`), `name`, `location` to choose without the window; a session in memory merges without asking (issue #2672); read-only `.lrcat` plus committed WAL pages (also WAL-only tables with main schema format 0), in-tree read-only Rust SQLite B-tree reader; on-demand main-file pages up to 16 GiB with existing table/record bounds (WAL still capped at 1 GiB, issue #798); background inspection/import with progress/cancellation, per-open library identity checks; persistent result with destination library, offline-original counts and Show in Library, dismissed when switching libraries; offline Local records are promoted without probing missing files; originals in place, ratings/flags/labels, XMP, hierarchical keywords, collection sets/regular collections, virtual copies, mapped develop settings; stable reimport identities, undo, missing-file placeholders, a root folder not found at its recorded path looked up relative to the catalog (Lightroom's `relativePathFromCatalog`, so a project folder copied from another computer stays linked; reported as a warning), existing edits preserved. Best-effort deduplicated recovery archives retain settings/history/snapshots/collection rules (32 MiB each, eight archives/128 MiB aggregate); archive limits/write failures and optional-table limits warn without blocking photo import; unrelated unsupported tables and opaque SQL BLOBs skipped. Custom white balance on relative-WB raws (`RAW` in Lightroom's terms) stays As Shot and is reported, since the catalog keeps no as-shot white to shift from (issue #510). An image whose file, folder or root folder record is missing from the catalog, or whose original path is empty, is skipped with its virtual copies instead of failing the whole import; the report lists them as data (`skipped`: image id and reason) and the result window counts them in the UI language (PR #2230). Adobe rendering, AI data and native history replay remain incomplete; no writes to Lightroom catalogs. Open Library given a Lightroom catalog folder, an `.lrdata` / `.lrcat-data` folder or the `.lrcat` makes no library there and offers this import with the catalog found (`cmd:app.openLibrary`, `crates/engine/src/lightroom_folder.rs`; issue #891) |
-| LRC-LIB-CATALOG-IMPORT | Native Lightroom Classic catalog import | P1 | 🟡 | `cmd:library.inspectLightroom`, `cmd:library.importLightroom`, `crates/engine/src/lightroom_catalog.rs`, `docs/lightroom-catalog-import.md` | read-only `.lrcat` plus committed WAL pages (also WAL-only tables with main schema format 0), in-tree read-only Rust SQLite B-tree reader; background inspection/import with progress/cancellation, per-open library identity checks; persistent result with destination library, offline-original counts and Show in Library, dismissed when switching libraries; offline Local records are promoted without probing missing files; originals in place, ratings/flags/labels, XMP, hierarchical keywords, collection sets/regular collections, virtual copies, mapped develop settings; stable reimport identities, undo, missing-file placeholders; VIDEO records match the Videos filter, with reimport repairing older image classification while keeping edits and memberships; a root folder not found at its recorded path looked up relative to the catalog (Lightroom's `relativePathFromCatalog`, so a project folder copied from another computer stays linked; reported as a warning), existing edits preserved. Best-effort deduplicated recovery archives retain settings/history/snapshots/collection rules (32 MiB each, eight archives/128 MiB aggregate); archive limits/write failures and optional-table limits warn without blocking photo import; unrelated unsupported tables and opaque SQL BLOBs skipped. Custom white balance on relative-WB raws (`RAW` in Lightroom's terms) stays As Shot and is reported, since the catalog keeps no as-shot white to shift from (issue #510). Adobe rendering, AI data and native history replay remain incomplete; no writes to Lightroom catalogs. Open Library given a Lightroom catalog folder, an `.lrdata` / `.lrcat-data` folder or the `.lrcat` makes no library there and offers this import with the catalog found (`cmd:app.openLibrary`, `crates/engine/src/lightroom_folder.rs`; issue #891) |
++| LRC-LIB-CATALOG-IMPORT | Native Lightroom Classic catalog import | P1 | 🟡 | `cmd:library.inspectLightroom`, `cmd:library.importLightroom`, `cmd:file.importLightroom`, `crates/engine/src/lightroom_catalog.rs`, `crates/ui-egui/src/dialogs/lightroom_destination.rs`, `crates/ui-egui/src/tests/lightroom_destination.rs`, `docs/lightroom-catalog-import.md` | before the import starts, File ▸ Import Lightroom Catalog… asks where the catalog goes: merge into the open library (named, with its photo count; preselected when it is empty) or create a new library (named after the catalog file, next to the open library, both editable), which is made and opened following File ▸ New Library…'s rules before the import; Cancel does nothing; Settings ▸ General ▸ "When importing a Lightroom catalog" (Ask where to import it / Always merge into the open library) or the window's "Don't ask again" turns it off; `file.importLightroom` takes `into` (`open` / `new`), `name`, `location` to choose without the window; a session in memory merges without asking (issue #2672); read-only `.lrcat` plus committed WAL pages (also WAL-only tables with main schema format 0), in-tree read-only Rust SQLite B-tree reader; on-demand main-file pages up to 16 GiB with existing table/record bounds (WAL still capped at 1 GiB, issue #798); background inspection/import with progress/cancellation, per-open library identity checks; persistent result with destination library, offline-original counts and Show in Library, dismissed when switching libraries; offline Local records are promoted without probing missing files; originals in place, ratings/flags/labels, XMP, hierarchical keywords, collection sets/regular collections, virtual copies, mapped develop settings; stable reimport identities, undo, missing-file placeholders; VIDEO records match the Videos filter, with reimport repairing older image classification while keeping edits and memberships; a root folder not found at its recorded path looked up relative to the catalog (Lightroom's `relativePathFromCatalog`, so a project folder copied from another computer stays linked; reported as a warning), existing edits preserved. Best-effort deduplicated recovery archives retain settings/history/snapshots/collection rules (32 MiB each, eight archives/128 MiB aggregate); archive limits/write failures and optional-table limits warn without blocking photo import; unrelated unsupported tables and opaque SQL BLOBs skipped. Custom white balance on relative-WB raws (`RAW` in Lightroom's terms) stays As Shot and is reported, since the catalog keeps no as-shot white to shift from (issue #510). An image whose file, folder or root folder record is missing from the catalog, or whose original path is empty, is skipped with its virtual copies instead of failing the whole import; the report lists them as data (`skipped`: image id and reason) and the result window counts them in the UI language (PR #2230). Adobe rendering, AI data and native history replay remain incomplete; no writes to Lightroom catalogs. Open Library given a Lightroom catalog folder, an `.lrdata` / `.lrcat-data` folder or the `.lrcat` makes no library there and offers this import with the catalog found (`cmd:app.openLibrary`, `crates/engine/src/lightroom_folder.rs`; issue #891) |
| LRC-LIB-CATALOG-LOCK | Catalog open in one program at a time | P1 | ✅ | `cmd:app.openLibrary`, `crates/catalog/src/lock.rs`, `crates/engine/src/library.rs` (`open_library`) | exclusive OS lock on `catalog.lock` for the session (app and `lightcraft-cli --library`); a second opener is refused with who has it (`catalog.lock.owner`: program, process, computer); released by the OS on a crash, so never stale; file systems without locks open unprotected with a warning (the app's notices, `library.info` → `settingsWarnings`, and the CLI's stderr; issue #171); no read-only mode; the browser build (OPFS) has no guard across tabs yet. A library that can't be opened at launch (locked, unreadable, newer format, drive missing) shows a window — Try Again, Choose Another Library…, Continue Without Saving (then a banner; nothing written), Quit — instead of a silent demo session (`crates/ui-egui/src/panels/library_problem.rs`); the lock is released explicitly when the library closes, not by letting its file handle close, so a program another thread is starting at that moment (which holds a copy of every file handle until it is launched) cannot keep the library "already open" for a moment (issue #680) |
-| LRC-LIB-CATALOG-SWITCH | New / Open Recent catalog, catalog name shown | P1 | ✅ | `cmd:app.newLibrary`, `cmd:app.openLibrary`, `cmd:app.recentLibraries`, `cmd:app.clearRecentLibraries`, `crates/ui-egui/src/panels/settings.rs`, `crates/ui-egui/src/panels/left.rs` | File ▸ New Library… (name, then location), File ▸ Open Recent Library (last 8; missing ones greyed out, dropped when opened; Clear), the open library's name under My Photos and in the window title (issue #902); a library that can't be opened leaves the current one open; ⌘O (Ctrl+O on Windows and Linux) runs Open Library… and asks for a folder once (`crates/ui-egui/src/tests_keymap.rs`: `cmd_o_opens_the_library_picker_once`); a dialog or a text field with the focus keeps the key |
+| LRC-LIB-CATALOG-SWITCH | New / Open Recent catalog, catalog name shown | P1 | ✅ | `cmd:app.newLibrary`, `cmd:app.openLibrary`, `cmd:app.recentLibraries`, `cmd:app.clearRecentLibraries`, `crates/ui-egui/src/dialogs/settings.rs`, `crates/ui-egui/src/panels/left.rs`, `crates/ui-egui/src/panels/library_problem.rs` (`launch_plan`, `show_chooser`), `crates/ui-egui/src/tests/launch_library.rs` | File ▸ New Library… (name, then location), File ▸ Open Recent Library (last 8; missing ones greyed out, dropped when opened; Remove from List ▸ one entry, or `app.recentLibraries {remove}`, which forgets only the path; Clear), the open library's name under My Photos and in the window title (issue #902); Open/New refused during imports and their folder scans; a library that can't be opened leaves the current one and its reference pin intact; a successful switch clears the catalog-local reference pin; ⌘O (Ctrl+O on Windows and Linux) runs Open Library… and asks for a folder once (`crates/ui-egui/src/tests/keymap.rs`: `cmd_o_opens_the_library_picker_once`); a dialog or a text field with the focus keeps the key; Settings ▸ General ▸ At launch: Open the last library (default) or Ask me, a window listing the recent libraries (name, folder, when last opened; missing, unreadable or no-longer-library ones greyed out with the reason, checked read-only — nothing is locked or written, so a library another program has open is reported, with who has it, when Open is pressed; the last one selected; Open, Open Another…, New Library…, Remove from List, Quit; ↑ ↓ Return Esc), also shown once when Alt/Option is held in the first 2 s after the window appears (macOS reports an Option key held since before launch only once it changes); `--library` and `LIGHTCRAFT_LIBRARY` come first and `lightcraft-cli` never asks (issue #1290) |
| LRC-LIB-FOLDERS | Disk folder tree | P1 | ✅ | `cmd:library.browse`, `cmd:folder.rename`, `cmd:folder.move`, `crates/ui-egui/src/panels/left.rs` (`local_section`, `folder_tree`) | standard places + the browsed folder + Browse Folder…, each an expandable tree of subfolders, breadcrumb navigation; context menu: Rename Folder…, Move Folder To…, Show in Finder (on disk, photos relinked; one undo step each: undo / redo move the folder back and forth, refused when the destination is taken) |
-| LRC-LIB-LIBFOLDERS | Library folders | P1 | ✅ | `cmd:library.folders`, `cmd:library.source` (`libraryFolder`), `cmd:library.filter` (`libraryFolder`), `cmd:library.removeFolder`, `cmd:folder.rename`, `cmd:folder.move`, `cmd:folder.label`, `cmd:folder.create`, `cmd:photo.moveToFolder`, `cmd:folder.scanChanges`, `cmd:folder.synchronize`, `crates/catalog/src/folders.rs`, `crates/engine/src/sync.rs`, `crates/ui-egui/src/sync.rs`, `crates/ui-egui/src/panels/left.rs` (`folders_section`, `folder_menu_for_library`, `row_menu`), `crates/ui-egui/src/tests_panels.rs` | sidebar Folders: the folders the library's photos were imported from, with photo counts (subfolders included), as another way to explore the library next to By Date and Keywords; Local stays the way to browse any folder on disk. Each disk is a row of its own and starts open: a drive letter, a Windows share (`\\server\share`, `\\?\UNC\…`, `\\wsl$\…`), a macOS share or disk (`/Volumes/tokyo`), a Linux mount (`/media`, `/run/media`, `/mnt`, gvfs `smb-share:…`, `/net/<host>`), NFS (`/Network/Servers/<host>`), else “This Computer” — told apart from the stored paths alone, so an offline share lists like a mounted one and the sidebar never waits on a network. Only folders that hold imported photos are listed (browsed, deleted and demo photos don't count); every folder is a row of its own (`Users` → `me` → `Pictures`), and a folder that holds nothing itself and leads to one folder starts open; every level indents one step more than its parent however deep it goes: the whole sidebar (Albums, Local, By Date, Folders, Keywords) scrolls sideways when its widest row is wider than the panel (rows are measured one frame behind; Create Album and the counts stay at the visible edge); a name that does not fit ends in an ellipsis at the count (the full name on hover; a row asks for room for at most 140 pt of its name, so depth, not one long name, makes the sidebar scroll), as does the grid title; selection and hover bars end at the panel's edge; click makes the folder the source, like an album or a Local folder (its photos and those of the folders inside it fill the grid, titled “photos/travel”; the filter bar narrows it further; `library.source` `libraryFolder` + `path`; kept with the library's view), and its row is always opened into view; the shown folder follows a rename or move and their undo (engine-tested; the sidebar test covers rename), is dropped back to All Photos when it is removed or no longer holds a photo, and a smart album made from the view keeps it, also when its rules are edited (the editor has no folder field). Only a folder that shows exactly its own photos can be shown (not the startup disk, not `/Volumes`-like folders above disks, not an empty one). A row that would cover other disks' photos too (the startup disk, `/Volumes`, `/mnt`…) only opens. Right-click (row or triangle): Rename Folder…, Move Folder To…, New Folder on Disk… (`folder.create`; one undo step, undo removes it while empty), Move Selected Photos Here (`photo.moveToFolder`, also *Move to Folder…* in the photo context menu, and photos dragged from the grid onto a Folders row: the row lights up, the dragged label says “Move 3 photos to “Trip””, a closed folder held under the pointer opens, a row covering several disks and Local photos are refused with the reason, photos already there say so; a drop asks first (“Move 2 photos to “Porto”?”, Don't ask again, Settings → Confirm before moving photos to another folder on disk), and photos that leave the view leave the selection; files and XMP sidecars move, virtual copies follow, across volumes copied (streamed) and verified before the source goes, a name taken in the destination refuses the whole move, one undo step; an undo with the share offline or read-only is refused with the reason and kept until it can run, nothing deleted), Show in Finder (on disk, photos relinked, as in Local), Set Color Label ▸ (the five colours with their custom names, None, Edit Label Names…; `folder.label`, one undo step; the row shows the label's dot before its count and says it with its name; kept in the catalog as a folder record under the folder's identity, so it follows Rename / Move and their undo and redo, the folders inside going along), Synchronize Folder… (the dialog opens at once and scans the folder and the folders inside it on a worker thread — the look for new files beside parallel checks of the library's photos — then offers Import new photos (checked; files only browsed in Local count as new), Relink photos whose file was renamed or moved within the folder (checked; matched by content — a Duplicate's too — or, for a photo with no hash on record such as one from a Lightroom catalog, by file size and dimensions when exactly one file agrees), Remove missing photos from the library (to Recently Deleted) and Read metadata updates from XMP sidecars (saved after the photo came in or was last edited here, and saying something the library doesn't; the sidecar wins), with counts and skipped duplicates / unreadable files; `folder.scanChanges` / `folder.synchronize`, which acts on exactly the scan shown — a scan whose folder's photos changed meanwhile is refused and made again in the background — and is one undo step, also with a full history; a folder that isn't there (an unplugged disk) is reported as such, not as every photo missing; a whole disk or a folder holding disks needs `disk: true`; Esc stops the scan; Synchronize hands everything to a worker thread — the import, the checks that moved and missing files are still as found, the sidecar reads — and commits its steps between frames, shown in the activity stack with ✕ to stop, so no file is touched on the UI thread) and Remove from Library… (asks; moves the folder's photos to Recently Deleted, one undo step, no file touched); a disk row (not the startup disk) offers Set Color Label ▸, Synchronize Folder… and Remove Disk from Library… (the command needs `disk: true` for a whole disk or a folder spanning several). Limits: names are compared as written (macOS `/Volumes/tokyo` vs `/Volumes/TOKYO` are two disks; `/Volumes/Macintosh HD/…` and `/…` two rows); no disk capacity / online status; no “include subfolders” switch (a folder always includes the ones inside it); photos can't yet be dragged onto a folder row (use the menus); a name clash on moving photos is refused rather than renamed -1, -2; folders can't be filtered or sorted by label, and a label stays with the old path when the folder is moved outside LightCraft (Find Missing relinks photos, not folder records); Synchronize has no “show import dialog first” or “show missing photos” option, and only knows when a photo came in or was last developed here: a rating, label or metadata change made here (auto-write off) after another app saved the sidecar is listed as an update, and reading it restores the sidecar's older value (reading is never the default); the walk for new files isn't cancelled midway and its depth/entry limits are only logged |
+| LRC-LIB-LIBFOLDERS | Library folders | P1 | ✅ | `cmd:library.folders`, `cmd:library.source` (`libraryFolder`), `cmd:library.filter` (`libraryFolder`), `cmd:library.removeFolder`, `cmd:folder.rename`, `cmd:folder.move`, `cmd:folder.label`, `cmd:folder.create`, `cmd:photo.moveToFolder`, `cmd:folder.scanChanges`, `cmd:folder.synchronize`, `crates/catalog/src/folders.rs`, `crates/engine/src/sync.rs`, `crates/ui-egui/src/sync.rs`, `crates/ui-egui/src/panels/left.rs` (`folders_section`, `folder_menu_for_library`, `row_menu`), `crates/ui-egui/src/tests/panels.rs` | sidebar Folders: the folders the library's photos were imported from, with photo counts (subfolders included), as another way to explore the library next to By Date and Keywords; Local stays the way to browse any folder on disk. Each disk is a row of its own and starts open: a drive letter, a Windows share (`\\server\share`, `\\?\UNC\…`, `\\wsl$\…`), a macOS share or disk (`/Volumes/tokyo`), a Linux mount (`/media`, `/run/media`, `/mnt`, gvfs `smb-share:…`, `/net/<host>`), NFS (`/Network/Servers/<host>`), else “This Computer” — told apart from the stored paths alone, so an offline share lists like a mounted one and the sidebar never waits on a network. Only folders that hold imported photos are listed (browsed, deleted and demo photos don't count); every folder is a row of its own (`Users` → `me` → `Pictures`), and a folder that holds nothing itself and leads to one folder starts open; every level indents one step more than its parent however deep it goes (16 pt while the deepest open row of any sidebar tree fits the panel with room for its name and count; narrower in bands of 14, 12, 10 and 8 pt when it would not, the same for every tree, chosen from the last frame; issue #2298): past 8 pt the whole sidebar (Albums, Local, By Date, Folders, Keywords) scrolls sideways when its widest row is wider than the panel (rows are measured one frame behind; Create Album and the counts stay at the visible edge); a name that does not fit ends in an ellipsis at the count (the full name on hover; a row asks for room for at most 140 pt of its name, so depth, not one long name, makes the sidebar scroll), as does the grid title; selection and hover bars end at the panel's edge; click makes the folder the source, like an album or a Local folder (its photos and those of the folders inside it fill the grid, titled “photos/travel”; the filter bar narrows it further; `library.source` `libraryFolder` + `path`; kept with the library's view), and its row is always opened into view; the shown folder follows a rename or move and their undo (engine-tested; the sidebar test covers rename), is dropped back to All Photos when it is removed or no longer holds a photo, and a smart album made from the view keeps it, also when its rules are edited (the editor has no folder field). Only a folder that shows exactly its own photos can be shown (not the startup disk, not `/Volumes`-like folders above disks, not an empty one). A row that would cover other disks' photos too (the startup disk, `/Volumes`, `/mnt`…) only opens. Right-click (row or triangle): Rename Folder…, Move Folder To…, New Folder on Disk… (`folder.create`; one undo step, undo removes it while empty), Move Selected Photos Here (`photo.moveToFolder`, also *Move to Folder…* in the photo context menu, and photos dragged from the grid onto a Folders row: the row lights up, the dragged label says “Move 3 photos to “Trip””, a closed folder held under the pointer opens, a row covering several disks and Local photos are refused with the reason, photos already there say so; a drop asks first (“Move 2 photos to “Porto”?”, Don't ask again, Settings → Confirm before moving photos to another folder on disk), and photos that leave the view leave the selection; files and XMP sidecars move, virtual copies follow, across volumes copied (streamed) and verified before the source goes, a name taken in the destination refuses the whole move, one undo step; an undo with the share offline or read-only is refused with the reason and kept until it can run, nothing deleted), Show in Finder (on disk, photos relinked, as in Local), Set Color Label ▸ (the five colours with their custom names, None, Edit Label Names…; `folder.label`, one undo step; the row shows the label's dot before its count and says it with its name; kept in the catalog as a folder record under the folder's identity, so it follows Rename / Move and their undo and redo, the folders inside going along), Synchronize Folder… (the dialog opens at once and scans the folder and the folders inside it on a worker thread — the look for new files beside parallel checks of the library's photos — then offers Import new photos (checked; files only browsed in Local count as new), Relink photos whose file was renamed or moved within the folder (checked; matched by content — a Duplicate's too — or, for a photo with no hash on record such as one from a Lightroom catalog, by file size and dimensions when exactly one file agrees), Remove missing photos from the library (to Recently Deleted) and Read metadata updates from XMP sidecars (saved after the photo came in or was last edited here, and saying something the library doesn't; the sidecar wins), with counts and skipped duplicates / unreadable files; a folder with none of these changes only says the library is up to date with it, with one Close and no choices, and closing it starts no job; `folder.scanChanges` / `folder.synchronize`, which acts on exactly the scan shown — a scan whose folder's photos changed meanwhile is refused and made again in the background — and is one undo step, also with a full history; a folder that isn't there (an unplugged disk) is reported as such, not as every photo missing; a whole disk or a folder holding disks needs `disk: true`; Esc stops the scan; Synchronize hands everything to a worker thread — the import, the checks that moved and missing files are still as found, the sidecar reads — and commits its steps between frames, shown in the activity stack with ✕ to stop, so no file is touched on the UI thread) and Remove from Library… (asks; moves the folder's photos to Recently Deleted, one undo step, no file touched); a disk row (not the startup disk) offers Set Color Label ▸, Synchronize Folder… and Remove Disk from Library… (the command needs `disk: true` for a whole disk or a folder spanning several). Limits: names are compared as written (macOS `/Volumes/tokyo` vs `/Volumes/TOKYO` are two disks; `/Volumes/Macintosh HD/…` and `/…` two rows); no disk capacity / online status; no “include subfolders” switch (a folder always includes the ones inside it); photos can't yet be dragged onto a folder row (use the menus); a name clash on moving photos is refused rather than renamed -1, -2; folders can't be filtered or sorted by label, and a label stays with the old path when the folder is moved outside LightCraft (Find Missing relinks photos, not folder records); Synchronize has no “show import dialog first” or “show missing photos” option, and only knows when a photo came in or was last developed here: a rating, label or metadata change made here (auto-write off) after another app saved the sidecar is listed as an update, and reading it restores the sidecar's older value (reading is never the default); the walk for new files stops when the scan is cancelled, and its depth/entry limits are only logged |
| LRC-LIB-COLLECTIONS | Collections & sets | P1 | ✅ | `cmd:album.create`, `cmd:album.createSmart`, `cmd:album.toggleTarget`, `cmd:album.setTarget`, `cmd:album.clearQuick` | albums + folders (sets), smart albums (rule editor; rules incl. File Path — the whole string, either separator, case-insensitive), Quick Collection and target album (B in the grids adds / removes the selection; album menu ▸ Set as Target Album; the target is marked +) |
-| LRC-LIB-SMARTCOLL | Smart-collection rules | P1 | ✅ | `cmd:album.createSmart`, `cmd:album.setRules`, `cmd:album.ruleFields`, `cmd:dialog.smartAlbum`, `crates/catalog/src/rules.rs`, `crates/ui-egui/src/panels/rules_editor.rs` | rule editor: match all / any / none, nested groups (⌥+ or + Group), 47 fields. The field menu shows Rating, Pick Flag, Color Label and Any Searchable Text, then one submenu per group (`FIELD_GROUPS`; `album.ruleFields` reports each field's `group`): Source (album — a plain or a smart album, so one smart album can include or exclude another; a rule that would make an album include itself, directly or through others, is refused, and a loop saved anyway can't recurse: inside it, the album being evaluated counts as holding no photos, so an "isn't" rule on it matches every photo, and the sidebar marks it ⚠ —, virtual copy, copy name, in a stack), File (filename, extension, file path, type, format, video duration), Date (capture / import / edit), Keywords & People (keywords, keyword count, people on named faces, people count), Description (title, caption, alt text, creator, copyright, copyright status), Camera Info (camera, lens, focal length, aperture, shutter speed as 1/250, ISO), Location (any, city, state / province, country, GPS), Size (long / short edge, aspect ratio and megapixels, all of the photo as shown: oriented and cropped), Develop (has edits, cropped, treatment), Assisted Culling (focus, best of similar shots); text / number / date / in-the-last operators; live match count; also usable as a library filter (`ruleSet`). Missing vs Classic: develop preset, flash, exposure bias, camera serial, colour profile / bit depth, IPTC Job, smart-preview status. Choice values read as words in every language (Public Domain, Black & White; `album.ruleFields` gives `choiceLabels`), while rules store the ids; yes/no fields read Yes / No and take `true`/`false`, `"yes"`/`"no"`, `"true"`/`"false"` or 1/0. Every value is checked against its field (`RuleSet::check`): numbers (rating 0–5), shutter speeds, dates (`2026`, `2026-08`, `2026-08-14`, then `T10`, `T10:00` or `T10:00:00`, a space working as the `T`, and after whole seconds a fraction and a time zone as imported capture times carry them (`.250+02:00`); no 30 February; `rules::rule_date` is the one reading for the check and the matcher; each date field has a calendar picker, `crates/ui-egui/src/date_picker.rs`, that picks a year, a month or a day and keeps a "between" in order), between = two bounds in order, in the last = more than 0 of a known unit, choices (ids, the flag's picked / rejected, a colour label's custom name), text with something to look for, an existing album (plain or smart, not a folder), no empty groups; each problem names its rule (`rule 2.1: no rating 0–5 is 9`), and album.createSmart / setRules / library.filter refuse them. The editor marks each bad rule under its row (inside groups too), keeps OK disabled until they are fixed (and its confirm refuses them before renaming anything), picks an Album rule's album with an album picker (`crates/ui-egui/src/album_picker.rs`: the sidebar's tree with folders, or type part of a name or folder; ↑ / ↓ / Enter; albums that can't be picked shown greyed with the reason) (is / isn't; a folder can't be tested), and drawing it never changes a rule: a rating of 9, "in the last 0 days" or 20,000 days, a "between" that isn't a pair all stay as stored (and are marked where they can't match) until edited. Album rules saved with an old operator (≥, between) are read as the "isn't" they always meant (`RuleSet::upgrade`). Saved smart albums whose rules no longer check are marked ⚠ in the sidebar (tooltip: what to fix; `albums.list` `problems`, `Catalog::smart_album_problems`); the name and rules of an album are saved as one undo step (`album.setRules` `name`). Problems read as the field's name and the issue in the editor's language (“Titel: braucht einen Suchbegriff”; `Problem::issue` / `field`, `Issue::text`, translated in every locale), while commands keep the English `rule 2.1: …` message for agents |
+| LRC-LIB-SMARTCOLL | Smart-collection rules | P1 | ✅ | `cmd:album.createSmart`, `cmd:album.setRules`, `cmd:album.ruleFields`, `cmd:dialog.smartAlbum`, `crates/catalog/src/rules.rs`, `crates/ui-egui/src/dialogs/rules_editor.rs` | rule editor: match all / any / none, nested groups (⌥+ or + Group), 47 fields. The field menu shows Rating, Pick Flag, Color Label and Any Searchable Text, then one submenu per group (`FIELD_GROUPS`; `album.ruleFields` reports each field's `group`): Source (album — a plain or a smart album, so one smart album can include or exclude another; a rule that would make an album include itself, directly or through others, is refused, and a loop saved anyway can't recurse: inside it, the album being evaluated counts as holding no photos, so an "isn't" rule on it matches every photo, and the sidebar marks it ⚠ —, virtual copy, copy name, in a stack), File (filename, extension, file path, type, format, video duration), Date (capture / import / edit), Keywords & People (keywords, keyword count, people on named faces, people count), Description (title, caption, alt text, creator, copyright, copyright status), Camera Info (camera, lens, focal length, aperture, shutter speed as 1/250, ISO), Location (any, city, state / province, country, GPS), Size (long / short edge, aspect ratio and megapixels, all of the photo as shown: oriented and cropped), Develop (has edits, cropped, treatment), Assisted Culling (focus, best of similar shots); text / number / date / in-the-last operators; live match count; also usable as a library filter (`ruleSet`). Missing vs Classic: develop preset, flash, exposure bias, camera serial, colour profile / bit depth, IPTC Job, smart-preview status. Choice values read as words in every language (Public Domain, Black & White; `album.ruleFields` gives `choiceLabels`), while rules store the ids; yes/no fields read Yes / No and take `true`/`false`, `"yes"`/`"no"`, `"true"`/`"false"` or 1/0. Every value is checked against its field (`RuleSet::check`): numbers (rating 0–5), shutter speeds, dates (`2026`, `2026-08`, `2026-08-14`, then `T10`, `T10:00` or `T10:00:00`, a space working as the `T`, and after whole seconds a fraction and a time zone as imported capture times carry them (`.250+02:00`); no 30 February; `rules::rule_date` is the one reading for the check and the matcher; each date field has a calendar picker, `crates/ui-egui/src/widgets/date_picker.rs`, that picks a year, a month or a day and keeps a "between" in order), between = two bounds in order, in the last = more than 0 of a known unit, choices (ids, the flag's picked / rejected, a colour label's custom name), text with something to look for, an existing album (plain or smart, not a folder), no empty groups; each problem names its rule (`rule 2.1: no rating 0–5 is 9`), and album.createSmart / setRules / library.filter refuse them. The editor marks each bad rule under its row (inside groups too), keeps OK disabled until they are fixed (and its confirm refuses them before renaming anything), picks an Album rule's album with an album picker (`crates/ui-egui/src/widgets/album_picker.rs`: the sidebar's tree with folders, or type part of a name or folder; ↑ / ↓ / Enter; albums that can't be picked shown greyed with the reason) (is / isn't; a folder can't be tested), and drawing it never changes a rule: a rating of 9, "in the last 0 days" or 20,000 days, a "between" that isn't a pair all stay as stored (and are marked where they can't match) until edited. Album rules saved with an old operator (≥, between) are read as the "isn't" they always meant (`RuleSet::upgrade`). Saved smart albums whose rules no longer check are marked ⚠ in the sidebar (tooltip: what to fix; `albums.list` `problems`, `Catalog::smart_album_problems`); the name and rules of an album are saved as one undo step (`album.setRules` `name`). Problems read as the field's name and the issue in the editor's language (“Titel: braucht einen Suchbegriff”; `Problem::issue` / `field`, `Issue::text`, translated in every locale), while commands keep the English `rule 2.1: …` message for agents |
| LRC-LIB-PUBLISH | Publish services | P2 | ⬜ | | |
-| LRC-LIB-FILTERBAR | Library filter bar | P1 | ✅ | `cmd:view.filterBar`, `cmd:filter.applyPreset`, `cmd:library.filter` (`labels`, `ruleSet`), `crates/ui-egui/src/panels/filterbar.rs` | rating/flag/label (several labels at once = any of them)/kind/edited/camera/lens/keyword, clear, save as smart album, filter presets; the filter stays as you change albums (always locked, as in the desktop app); arbitrary conditions via the smart-album rule editor |
+| LRC-LIB-FILTERBAR | Library filter bar | P1 | ✅ | `cmd:view.filterBar`, `cmd:filter.applyPreset`, `cmd:library.filter` (`labels`, `ruleSet`), `crates/ui-egui/src/panels/filterbar.rs` | rating/flag/label (several labels at once = any of them)/kind/edited/camera/lens/keyword, clear, save as smart album, filter presets; the filter stays as you change albums (an album the filter held is replaced by the album you show; always locked, as in the desktop app); arbitrary conditions via the smart-album rule editor |
| LRC-LIB-STACKS | Stacks (full) | P1 | ✅ | `crates/catalog/src/stacks.rs`, `cmd:stack.group`, `cmd:stack.split`, `cmd:stack.moveUp`, `cmd:stack.moveDown` | group / ungroup / toggle / set top / remove / auto by time / split / move up and down |
| LRC-LIB-VC | Virtual copies | P1 | ✅ | `cmd:photo.virtualCopy` | ⌘' |
| LRC-LIB-LABELS | Colour-label sets | P1 | ✅ | `cmd:label.sets`, `cmd:label.applySet`, `cmd:label.saveSet`, `cmd:label.deleteSet`, `cmd:label.setNames`, `crates/engine/src/cmd/manage.rs` | built-in Colors / Review sets + user sets (Photo ▸ Set Color Label, Edit Label Names… dialog); names written to and read from `xmp:Label` |
@@@ -799,53 -797,7 +799,54 @@@ Latin stays upright. Advanced Japanese
| Date | Change | Summary |
|---|---|---|
+| 2026-10-25 | patch | LR-BEHAV-TITLEBAR: the top bar's title-bar gestures come from craft-window's `title_bar`: a double-click follows the system setting, and a press on a button, the search field or a panel floating over the bar never moves the window; status counts unchanged |
+| 2026-10-24 | minor | KEYC-METADATA, LRC-LIB-KEYWORDS: ⌥0 / ⌥⇧0 (`keyword.nextSet`, `keyword.previousSet`) go to the next / previous keyword set; status counts unchanged (KEYC-METADATA stays 🟡) |
+| 2026-10-24 | minor | KEYC-METADATA: ⌘K / Ctrl+K (`panel.addKeywords`, Add Keywords) shows the Keywords panel, opens Keywording and puts the cursor in the Add keyword box; status counts unchanged (KEYC-METADATA stays 🟡) |
+| 2026-10-24 | patch | LR-LIB-RATING, LR-LIB-DELETE: a slider drag still open when a rating, flag or label takes the photo out of the view, or when the photo is deleted, ends as its own undo step before the selection moves on, as moving to the next photo does; LR-BEHAV-LOCALIZE lists all 18 languages; status unchanged |
+| 2026-10-24 | patch | Integration batch 43: Integrated main 98702b5c, preserving the new fail-closed GPS metadata check for Original export. Watermark geometry/orientation and HDR JPEG size-limit fixes remain in their shared helpers; no feature-count changes. |
+| 2026-10-23 | patch | Export integration: Integrated main 5ca49b3e, retaining Width & Height resizing, export format/bit-depth validation and batch panic cancellation alongside the existing watermark and HDR JPEG size-limit fixes. No feature-count changes. |
+| 2026-10-23 | minor | LRC-LIB-CATALOG-SWITCH, LR-PREF-GENERAL: Settings ▸ General ▸ At launch (Open the last library / Ask me) with a launch window listing the recent libraries, Alt/Option at launch asks once, File ▸ Open Recent Library ▸ Remove from List and `app.recentLibraries {remove}` (issue #1290); photos dropped while no library is open wait for the one opened (presets are refused then); status and counts unchanged (✅) |
+| 2026-10-23 | minor | LRC-LIB-CATALOG-IMPORT: Import Lightroom Catalog… (and Open Library's offer for a Lightroom catalog) asks whether the catalog merges into the open library or goes into a new library made next to it; Settings ▸ General or "Don't ask again" switches the question off; `file.importLightroom` takes `into` / `name` / `location` (#2672); status unchanged (🟡) |
+| 2026-10-22 | minor | LR-VIEW-INFOOVERLAY: the info overlay shows the star rating and flag, and in the full-screen preview on macOS it starts below the window controls (issue #2460); status unchanged |
+| 2026-10-22 | patch | KEY-GRID: both grid rows in View show the cycle shortcut and follow keymap changes; direct bindings and native accelerator ownership are preserved (#2500); status and counts unchanged |
+| 2026-10-22 | minor | LRC-PRINT-LAYOUT: the Japanese photo and postcard paper sizes (L判, 2L判, KG判, はがき, 往復はがき, 六切, 四切, 名刺) are selectable in the page setup and Print dialog and print to PDF at their metric sizes |
+| 2026-10-22 | minor | #2052 (partial): shared export text adds only Thai faces after Inter and the existing CJK chain. Thai horizontal mark positioning remains incomplete; Arabic fallback is deferred until joining and bidi reordering exist. LR-EXP-WATERMARK reassessed as partial for these layout and font limits; UI fallback unchanged |
+| 2026-10-24 | patch | LR-LIB-SMARTALBUM: relative-date view and source-count caches expire on the session-clock minute, including nested smart albums; held views retain expired photos until refresh and admit new matches; status and feature counts unchanged |
+| 2026-10-22 | patch | LR-META-XMP: namespace URI determines ownership; foreign namespaces using recognized prefixes survive saves and cannot supply native settings or ratings; status and counts unchanged |
+| 2026-10-22 | patch | LR-EXP-PSD, LR-META-EXIF-FULL: PSD/PSB imports and image resources 1058/1060 now supply EXIF and XMP to metadata readers and All Metadata; Original with Remove Location Info refuses detected PSD/PSB GPS; statuses and feature counts unchanged |
+| 2026-10-21 | patch | LR-LIB-CAPTURETIME: a capture time that doesn't fully read is left as it is and counted (`unreadable`) instead of shifted into a wrong one; it can't anchor a set that moves other photos; status unchanged |
+| 2026-10-21 | patch | LR-IMP-ADD-DIALOG: reconcile #2362 with current main; deleted-album guard and hierarchical picker retained; counts unchanged |
+| 2026-10-21 | patch | KEY-SLIDER-NUDGE: vertical wheel nudges need a click or drag in the slider's row; leaving it (even between two frames) or Tab focus alone does not arm them (issue #1355); status unchanged |
+| 2026-10-21 | minor | KEYC-PANELS: F8 shows / hides the right panel (`view.rightPanel`), with F6 / F7 already bound; ⬜ → 🟡 |
+| 2026-10-20 | patch | Graphic watermark inset regression: Oversized graphics fit the space remaining after the applicable anchor insets, with one aspect-preserving scale before quarter-turn rotation. Centered axes continue to ignore insets. Pixel-bound regressions cover edge/corner anchors, centered placement and all four rotations. Main d999e382 is integrated; HDR size-limit and EXIF-orientation fixes are unchanged. |
+| 2026-10-20 | minor | LR-IMP-ADD-DIALOG: #2362 gives the import review the shared hierarchy/search album picker while retaining None/New album and existing destination IDs; status and feature counts unchanged |
+| 2026-10-20 | minor | LR-PRE-PANEL: the preset applied to a photo is marked again (with its Amount slider) on returning to the photo, until the photo is edited further (#2392); status unchanged (✅) |
+| 2026-10-20 | minor | LR-MASK-OVERLAY: creating, picking, duplicating or adding to a mask shows the overlay a mask slider hid (#1800); status unchanged (✅) |
+| 2026-10-20 | patch | LRC-LIB-COMPARE, LR-VIEW-SURVEY: in Compare and Survey the Info panel's stars and colour labels and the Set Color Label menu act on the active photo only (they labelled the whole selection), and the panes show the colour label (#2398); statuses unchanged |
+| 2026-10-20 | patch | LR-VIEW-ZOOM: the 20 ms rule clears a slow-drag verdict only on a drag timed at full size; a drag that drafts small leaves it unchanged, as the code does; status unchanged |
+| 2026-10-19 | minor | LR-CROP-ASPECT: Lock Aspect Ratio is its own row in Help ▸ Keyboard Shortcuts (`crop.lockAspect`, default A, sharing A with Visualize Spots as a contextual pair); statuses unchanged (✅) (`tests_keymap` `lock_aspect_ratio_is_a_listed_row_on_a`, `a_is_the_aspect_lock_under_crop_and_visualize_spots_elsewhere`) |
+| 2026-10-19 | patch | LR-LIB-RATING: a rating, flag or label that takes the active photo out of the view makes the photo after it active instead of leaving an unseen photo active (→ then went to the view's first photo), and Shift / Auto Advance doesn't step past it (#2312); status unchanged (✅) |
+| 2026-10-19 | patch | LR-LIB-CULL: Assisted Culling's burst gap and similarity are adjustable (dialog, `photo.analyze` `burstGap` / `similarity`; #2275). Statuses and feature counts unchanged. |
+| 2026-10-19 | patch | LR-CROP-RECT: on a straightened photo a moved crop slides along the tilted edges, so a box that fills the photo's height reaches its sides (#2299); status unchanged |
+| 2026-10-19 | patch | LR-VIEW-ZOOM: the slow slider-drag verdict is described as per photo and control, as the code keys it; status unchanged |
+| 2026-10-18 | patch | Export regression integration (maintenance): Graphic watermarks honour EXIF rotation/mirroring through the shared `read_graphic` path and keep their aspect ratio when fitted to the output. HDR JPEG `limitKb` includes the gain map and metadata. Refreshed onto main fb7ac08b, retaining upstream export bounds, colour metadata, JPEG encoding and opaque RGB/real-alpha handling (#1691); no feature-count or readiness estimate changes. |
+| 2026-10-18 | patch | LR-META-XMP: Lightroom's profile and version bookkeeping (`CompatibleVersion`, profile digests, lens profile identity, `CropConstrainToUnitSquare`, default-strength lens profile scales) is no longer reported as unimported XMP; status unchanged (✅) |
+| 2026-10-17 | minor | MENU-VIEW-DETAIL, MENU-VIEW-EDIT, MENU-VIEW-CLIPPING, MENU-VIEW-MASKOVERLAY, MENU-VIEW-PHOTOCOUNT, MENU-VIEW-BEFOREAFTER, LR-VIEW-FOCUSPOINT: menu labels renamed: switches are named for what they show (Photo Counts, Focus Point, Clipping, Mask Overlay, All Mask Overlays, Mask Pins, Layout Image), View ▸ Detail is Detail View, Window ▸ Edit is Edit Panel, Compare Before and After is Before/After Side by Side, Clear Preview Cache is Discard Preview Cache; shortcuts and commands unchanged; statuses unchanged |
+| 2026-10-17 | minor | LR-IMP-DRAGDROP: files dragged over the window show what dropping will do, and dropped photos and folders open the import review (Settings ▸ Import can import them at once); a drop while a dialog is open or an import is running is refused; a finished scan no longer replaces an open dialog; the web build tells the person when a dropped file can't be read or imported. LR-BEHAV-EMPTY-STATES, LR-BEHAV-DRAGDROP: text updated; status unchanged (✅) |
+| 2026-10-16 | patch | LR-BEHAV-BG-TASKS: progress bars and spinners come from one component (`progress.rs`): the activity stack, model downloads, denoise and the face scan share it; busy buttons and a themed thumbnail placeholder added; status unchanged |
+| 2026-10-15 | patch | LR-BEHAV-LOCALIZE: cites `docs/localization-pl.md` (Polish format messages finished, counts right for every number); status unchanged (🟡) |
+| 2026-10-15 | minor | LR-VIEW-ZOOM: a slow slider-drag verdict needs two drags over 20 ms and expires after 30 s (doubling to 240 s); hidden-window frame times are ignored; the slow set forgets its oldest entry, not all (issue #330); status unchanged |
+| 2026-10-15 | minor | LR-BEHAV-BG-TASKS: Reload from Disk reads its files on a worker thread with a cancellable activity row instead of freezing the window on a selection of raws; its result is committed through the command wrapper (XMP sidecars auto-written as before) and an older reload finishing late no longer overwrites a newer one; status unchanged (✅) |
+| 2026-10-19 | patch | LR-LIB-STACK: the filmstrip's stack badge expands / collapses the stack like the grid's, and a badge click works on a stack that isn't selected (it is selected first). Statuses and feature counts unchanged. |
+| 2026-10-14 | minor | LR-VIEW-ZOOM: Visualize Spots, Point Color range and Visualize HDR render zoom windows; LRC-DEV-SOFTPROOF: output-space proofs on the GPU |
+| 2026-10-14 | patch | LR-EXP-TYPE: opaque 8-bit PNG/TIFF/WebP use RGB; transparent exports retain alpha (#1670). Statuses and feature counts unchanged. |
+| 2026-10-15 | minor | LRC-PRINT-PAGE: Page Options (Page Numbers, Page Info, Crop Marks) on Single Image and Contact Sheet pages, in the Print dialog, `print.set` and templates; still 🟡 (no identity plate, watermark, photo info or Cut Guides) |
+| 2026-10-15 | minor | LR-IMP-FORMATS: Hasselblad 3FR and FFF show their uncompressed RGB preview (no JPEG in these files) in the grid and loupe until developed, and as the stand-in when a file fails to decode; status unchanged (🟡) |
+| 2026-10-15 | minor | LR-IMP-FORMATS: a Hasselblad FFF develops with the camera's colour matrix from the original 3FR header it embeds (tag `0xC51B`) instead of the neutral matrix; status unchanged (🟡) |
+| 2026-10-13 | minor | LRC-LIB-KEYWORDS: the Keyword List marks a keyword that has an applied keyword inside it (a dot in its box); status unchanged |
+| 2026-10-12 | minor | LR-IMP-FORMATS: folder discovery includes SR2/SRF; MCP and CLI reuse the engine extension list. DSC-F828 remains preview-only; decoder support and row status unchanged |
+| 2026-10-15 | patch | KEYC-RATING: `\` shows / hides the Filter Bar in Photo Grid and Square Grid (Show Original in Detail); status unchanged (🟡) |
+ | 2026-10-16 | patch | LRC-LIB-CATALOG-IMPORT: VIDEO records appear in the Videos filter; reimport repairs older classification with edits, memberships and undo preserved (#1940, filter issue only). Status and summary counts unchanged. |
| 2026-10-12 | minor | LR-EDIT-OPTICS-PROFILE: Sony ARW shading, CA and distortion tables decoded with settings and provenance (raw IFD, `SR2SubIFD` fallback); applied corrections unchanged (ILCE-7RM4A and ILCE-7RM6 distortion); status unchanged (🟡) |
| 2026-10-14 | minor | LR-IMP-CAMERA-COVERAGE: Camera-coverage sweep (#1327): 30 models verified on 40 CC0 files (coverage.py 515 → 545 verified); sensor verification does not establish colour parity (#1277); status unchanged (🟡) |
| 2026-10-13 | minor | LR-MERGE-PANO: a panorama's DNG takes its `AsShotNeutral` from the median of its frames' vendor white-balance multipliers (CR2, NEF, ARW…) instead of the first frame's tags, and frames now carry the multipliers (issue #1144); status unchanged (✅) |