Skip to content

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

LR-CLOUD-SMARTPREVIEW + LR-LIB-DUPLICATE: smart previews for offline originals, Duplicate

Brandon Thomas544914bb6674
diff --git a/apps/lightcraft-web/src/wire.rs b/apps/lightcraft-web/src/wire.rs
index 84017432f..8c85a0058 100644
--- a/apps/lightcraft-web/src/wire.rs
+++ b/apps/lightcraft-web/src/wire.rs
@@ -56,6 +56,7 @@ impl WireJob {
let max_edge = match &job.source {
SourceRef::Demo { max_edge, .. } | SourceRef::File { max_edge, .. } => *max_edge,
SourceRef::Loaded(img) => img.width.max(img.height),
+ SourceRef::Smart { .. } => 2560,
};
WireJob {
level: job.level,
diff --git a/crates/engine/src/cmd/convert.rs b/crates/engine/src/cmd/convert.rs
index 1d3b3ab92..5eb172836 100644
--- a/crates/engine/src/cmd/convert.rs
+++ b/crates/engine/src/cmd/convert.rs
@@ -183,8 +183,63 @@ fn reload(s: &mut Session, p: &Value) -> Result<Value> {
Ok(json!({"reloaded": reloaded.iter().map(|i| i.0).collect::<Vec<_>>()}))
}
+/// Duplicate: copy the file next to itself (`<name>-copy`, never overwriting) and add it with the
+/// same settings, metadata, rating, flag, label and albums. → {ids}
+fn duplicate(s: &mut Session, p: &Value) -> Result<Value> {
+ const C: &str = "photo.duplicate";
+ let mut made = Vec::new();
+ for id in s.targets(p) {
+ let Some(ph) = s.catalog.photo(id).map(|p| (**p).clone()) else { continue };
+ let Source::File { path } = &ph.source else { return Err(bad(C, "a generated demo photo has no file to duplicate")) };
+ let src = Path::new(path);
+ let stem = src.file_stem().map(|x| x.to_string_lossy().to_string()).unwrap_or_else(|| "photo".into());
+ let ext = src.extension().map(|e| format!(".{}", e.to_string_lossy())).unwrap_or_default();
+ let dir = src.parent().unwrap_or(Path::new(""));
+ let mut dst = dir.join(format!("{stem}-copy{ext}"));
+ let mut n = 2;
+ while dst.exists() {
+ dst = dir.join(format!("{stem}-copy-{n}{ext}"));
+ n += 1;
+ }
+ std::fs::copy(src, &dst).map_err(|e| bad(C, format!("{path}: {e}")))?;
+ let new = s.catalog.alloc_photo_id();
+ let mut q = ph.clone();
+ q.id = new;
+ q.source = Source::File { path: dst.to_string_lossy().to_string() };
+ q.file_name = dst.file_name().map(|x| x.to_string_lossy().to_string()).unwrap_or_default();
+ // the same bytes, but its own photo: no duplicate-content clash, no shared history
+ q.content_hash = q.content_hash.map(|h| format!("{h}:dup{}", new.0));
+ q.copy_of = None;
+ q.copy_name = None;
+ q.history.clear();
+ q.versions.retain(|v| !v.auto);
+ let mut ops = vec![Op::AddPhoto { photo: Box::new(q) }];
+ for a in s.catalog.albums().filter(|a| !a.is_smart() && !a.folder && a.photos.contains(&id)) {
+ let mut photos = a.photos.clone();
+ photos.push(new);
+ ops.push(Op::SetAlbumPhotos { id: a.id, photos });
+ }
+ s.commit("Duplicate", Op::Batch { ops })?;
+ made.push(new);
+ }
+ s.merge_undo(made.len(), "Duplicate");
+ if let Some(last) = made.last() {
+ s.selection = crate::Selection { ids: made.clone(), active: Some(*last) };
+ }
+ Ok(json!({"ids": made.iter().map(|i| i.0).collect::<Vec<_>>()}))
+}
+
pub fn edit_specs() -> Vec<CommandSpec> {
vec![
+ cmd!(
+ "photo.duplicate",
+ "Duplicate",
+ ["Photo"],
+ None,
+ "{ids?} — copy each photo's file next to it (`-copy`) and add it with the same settings, metadata and albums (a real file, unlike a virtual copy) → {ids}",
+ has_selection,
+ duplicate
+ ),
cmd!(
"photo.reload",
"Reload from Disk",
diff --git a/crates/engine/src/cmd/previews.rs b/crates/engine/src/cmd/previews.rs
index 918949b1a..dfeaecfbd 100644
--- a/crates/engine/src/cmd/previews.rs
+++ b/crates/engine/src/cmd/previews.rs
@@ -94,8 +94,74 @@ fn build(s: &mut Session, p: &Value) -> Result<Value> {
Ok(state.json())
}
+/// Smart previews: build (from the original, at preview size) or discard the proxies that keep
+/// photos editable while their originals are offline.
+#[cfg(not(target_arch = "wasm32"))]
+fn smart(s: &mut Session, p: &Value) -> Result<Value> {
+ const C: &str = "library.smartPreviews";
+ let dir = s.media.smart_dir.clone().ok_or_else(|| bad(C, "smart previews need a library on disk"))?;
+ let discard = p.get("discard").and_then(Value::as_bool).unwrap_or(false);
+ let ids = if p.get("ids").is_some() || !s.selection.ids.is_empty() { s.targets(p) } else { s.visible_cloned() };
+ let (mut built, mut removed, mut failed) = (0usize, 0usize, Vec::new());
+ if !discard {
+ std::fs::create_dir_all(&dir).map_err(|e| bad(C, format!("{}: {e}", dir.display())))?;
+ }
+ for id in ids {
+ let Some(ph) = s.catalog.photo(id).cloned() else { continue };
+ if !matches!(ph.source, lightcraft_catalog::Source::File { .. }) {
+ continue;
+ }
+ let path = dir.join(crate::smart::file_name(&ph));
+ if discard {
+ if std::fs::remove_file(&path).is_ok() {
+ removed += 1;
+ }
+ continue;
+ }
+ if path.exists() {
+ built += 1;
+ continue;
+ }
+ let r = s
+ .source_now(id, crate::media::SourceLevel::Preview)
+ .and_then(|src| crate::smart::encode(&src))
+ .and_then(|b| std::fs::write(&path, b).map_err(|e| e.to_string()));
+ match r {
+ Ok(()) => built += 1,
+ Err(e) => failed.push(json!([id.0, e])),
+ }
+ }
+ Ok(json!({"built": built, "removed": removed, "failed": failed}))
+}
+
+/// Whether photo `id` has a smart preview.
+pub fn has_smart_preview(s: &Session, id: lightcraft_catalog::PhotoId) -> bool {
+ match (&s.media.smart_dir, s.catalog.photo(id)) {
+ (Some(dir), Some(p)) => dir.join(crate::smart::file_name(p)).exists(),
+ _ => false,
+ }
+}
+
pub fn specs() -> Vec<CommandSpec> {
vec![
+ #[cfg(not(target_arch = "wasm32"))]
+ cmd!(
+ "library.smartPreviews",
+ "Build Smart Previews",
+ [],
+ None,
+ "{ids?, discard?: bool} — build (or discard) the smart previews of the selected photos (else all in view): compact proxies in the library that keep photos editable and exportable (at proxy size) while their originals are offline → {built, removed, failed}",
+ always,
+ smart
+ ),
+ cmd!(query "photo.smartPreview", "Smart Preview Status", [], None, "{id?} → {smartPreview: bool, originalOnline: bool}", always, |s, p| {
+ let id = s.targets(p).first().copied().ok_or_else(|| bad("photo.smartPreview", "no photo"))?;
+ let online = match s.catalog.photo(id).map(|p| p.source.clone()) {
+ Some(lightcraft_catalog::Source::File { path }) => std::path::Path::new(&path).exists(),
+ _ => true,
+ };
+ Ok(json!({"smartPreview": has_smart_preview(s, id), "originalOnline": online}))
+ }),
cmd!(
"library.buildPreviews",
"Build Previews",
diff --git a/crates/engine/src/lib.rs b/crates/engine/src/lib.rs
index 3093148f6..87e3d073a 100644
--- a/crates/engine/src/lib.rs
+++ b/crates/engine/src/lib.rs
@@ -26,6 +26,7 @@ pub mod preset_import;
pub mod presets;
pub mod rename;
pub mod sidecar;
+pub mod smart;
mod view;
use std::sync::Arc;
diff --git a/crates/engine/src/library.rs b/crates/engine/src/library.rs
index 6f31ca44a..7926f97ef 100644
--- a/crates/engine/src/library.rs
+++ b/crates/engine/src/library.rs
@@ -153,6 +153,7 @@ impl Session {
/// this session's catalog.
pub fn open_library_in(&mut self, stores: LibraryStores, seed_demo: bool) -> Result<&LoadReport> {
let LibraryStores { dir, catalog, mut files, on_disk } = stores;
+ self.media.smart_dir = on_disk.then(|| crate::smart::dir(&dir));
let (mut journal, catalog, report) = Journal::open(catalog)?;
self.catalog = catalog;
self.undo.clear();
diff --git a/crates/engine/src/media.rs b/crates/engine/src/media.rs
index 5cb9155df..209bbc667 100644
--- a/crates/engine/src/media.rs
+++ b/crates/engine/src/media.rs
@@ -74,8 +74,19 @@ pub type PreviewLoader = Arc<dyn Fn(&str, usize) -> Option<Rgba8> + Send + Sync>
#[derive(Clone)]
pub enum SourceRef {
Loaded(Arc<Rgb32f>),
- Demo { scene: Box<lightcraft_scenes::Scene>, max_edge: usize },
- File { path: String, max_edge: usize, loader: Option<FileLoader> },
+ Demo {
+ scene: Box<lightcraft_scenes::Scene>,
+ max_edge: usize,
+ },
+ File {
+ path: String,
+ max_edge: usize,
+ loader: Option<FileLoader>,
+ },
+ /// A smart preview standing in for a missing original.
+ Smart {
+ path: std::path::PathBuf,
+ },
}
impl SourceRef {
@@ -87,6 +98,10 @@ impl SourceRef {
Some(l) => l(path, *max_edge).map(|(img, _)| Arc::new(img)),
None => Err(format!("no decoder available for {path}")),
},
+ #[cfg(not(target_arch = "wasm32"))]
+ SourceRef::Smart { path } => crate::smart::load(path),
+ #[cfg(target_arch = "wasm32")]
+ SourceRef::Smart { .. } => Err("smart previews are not available here".into()),
}
}
}
@@ -108,6 +123,8 @@ pub struct MediaCache {
pub preview_loader: Option<PreviewLoader>,
/// Reads a photo file's bytes (Photo Merge); `None` = the local file system.
pub file_bytes: Option<crate::merge::ByteReader>,
+ /// The library's smart previews folder (originals offline: render from the proxy).
+ pub smart_dir: Option<std::path::PathBuf>,
scenes: Vec<lightcraft_scenes::Scene>,
/// Rendered thumbnails (memory, plus disk once a library is attached).
pub rendered: Arc<PreviewCache>,
@@ -126,6 +143,7 @@ impl Default for MediaCache {
file_probe: None,
preview_loader: None,
file_bytes: None,
+ smart_dir: None,
scenes: Vec::new(),
rendered: Arc::new(PreviewCache::memory(rendered_budget(budget))),
}
@@ -266,6 +284,16 @@ impl MediaCache {
(Source::Demo { .. }, SourceLevel::Full) => p.width.max(p.height).max(1) as usize,
_ => usize::MAX,
});
+ // the original is offline: its smart preview, when there is one
+ #[cfg(not(target_arch = "wasm32"))]
+ if let (Source::File { path }, Some(dir)) = (&p.source, &self.smart_dir)
+ && !std::path::Path::new(path).exists()
+ {
+ let sp = dir.join(crate::smart::file_name(p));
+ if sp.exists() {
+ return SourceRef::Smart { path: sp };
+ }
+ }
self.origin_ref(&p.source, max_edge)
}
diff --git a/crates/engine/src/smart.rs b/crates/engine/src/smart.rs
new file mode 100644
index 000000000..a5d243e14
--- /dev/null
+++ b/crates/engine/src/smart.rs
@@ -0,0 +1,99 @@
+//! Smart previews: a compact proxy of each photo (its decoded preview-size source, about 1 MB)
+//! kept in the library, so photos stay editable — and exportable at proxy size — while their
+//! originals are offline (an unplugged drive). The proxy is the scene-linear source scaled into
+//! 0..1 by a stored factor, sRGB-encoded and saved as a JPEG after a one-line header.
+
+use std::path::{Path, PathBuf};
+use std::sync::Arc;
+
+use lightcraft_catalog::Photo;
+use lightcraft_color::transfer::linear_to_srgb;
+use lightcraft_raster::{Rgb32f, Rgba8};
+
+const MAGIC: &[u8] = b"LCSP1\n";
+
+/// The proxy's file name for a photo (by its content, so copies share one).
+pub fn file_name(p: &Photo) -> String {
+ let h = lightcraft_preview::Hasher128::new().str(&crate::media::content_key(p)).finish();
+ format!("{:032x}.lcsp", h.0)
+}
+
+/// Encode a source image as a smart preview.
+pub fn encode(img: &Rgb32f) -> Result<Vec<u8>, String> {
+ // scale so all but the brightest 0.05 % fit into 0..1
+ let mut lum: Vec<f32> = img.data.iter().map(|c| c[0].max(c[1]).max(c[2])).filter(|v| v.is_finite()).collect();
+ let scale = if lum.is_empty() {
+ 1.0
+ } else {
+ let k = ((lum.len() as f64) * 0.9995) as usize;
+ let k = k.min(lum.len() - 1);
+ let (_, v, _) = lum.select_nth_unstable_by(k, f32::total_cmp);
+ v.max(1.0)
+ };
+ let data: Vec<[u8; 4]> = img
+ .data
+ .iter()
+ .map(|c| {
+ let e = |v: f32| (linear_to_srgb((v / scale).clamp(0.0, 1.0)) * 255.0).round() as u8;
+ [e(c[0]), e(c[1]), e(c[2]), 255]
+ })
+ .collect();
+ let rgba = Rgba8 { width: img.width, height: img.height, data };
+ let jpg = lightcraft_codecs::encode_jpeg(
+ &lightcraft_codecs::EncodeImage::rgba8(&rgba),
+ 92,
+ lightcraft_codecs::ChromaSubsampling::S444,
+ &Default::default(),
+ )
+ .map_err(|e| e.to_string())?;
+ let mut out = MAGIC.to_vec();
+ out.extend_from_slice(format!("{{\"w\":{},\"h\":{},\"scale\":{scale}}}\n", img.width, img.height).as_bytes());
+ out.extend_from_slice(&jpg);
+ Ok(out)
+}
+
+/// Decode a smart preview back into a source image.
+pub fn decode(bytes: &[u8]) -> Result<Rgb32f, String> {
+ let rest = bytes.strip_prefix(MAGIC).ok_or("not a smart preview")?;
+ let nl = rest.iter().position(|b| *b == b'\n').ok_or("bad smart preview")?;
+ let head: serde_json::Value = serde_json::from_slice(&rest[..nl]).map_err(|e| e.to_string())?;
+ let scale = head["scale"].as_f64().unwrap_or(1.0) as f32;
+ let d = lightcraft_codecs::decode(&rest[nl + 1..], Default::default()).map_err(|e| e.to_string())?;
+ // the decoder undoes the sRGB encoding; the values are the source's own primaries
+ let mut img = d.image;
+ img.data.iter_mut().for_each(|c| *c = c.map(|v| v * scale));
+ Ok(img)
+}
+
+/// Where a library keeps its smart previews.
+pub fn dir(library: &Path) -> PathBuf {
+ library.join("Smart Previews")
+}
+
+/// Load the proxy at `path`.
+pub fn load(path: &Path) -> Result<Arc<Rgb32f>, String> {
+ let b = std::fs::read(path).map_err(|e| format!("{}: {e}", path.display()))?;
+ decode(&b).map(Arc::new)
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ #[test]
+ fn roundtrip_keeps_the_picture() {
+ let img = lightcraft_scenes::demo_library()[0].render(160, 100);
+ let back = decode(&encode(&img).unwrap()).unwrap();
+ assert_eq!((back.width, back.height), (img.width, img.height));
+ let mut err = 0.0f64;
+ for (a, b) in img.data.iter().zip(&back.data) {
+ for k in 0..3 {
+ let (x, y) = (linear_to_srgb(a[k].clamp(0.0, 1.0)), linear_to_srgb(b[k].clamp(0.0, 1.0)));
+ err += ((x - y) as f64).abs();
+ }
+ }
+ let mean = err / (img.data.len() * 3) as f64;
+ assert!(mean < 0.02, "mean encoded error {mean}");
+ assert!(decode(b"nope").is_err());
+ }
+}
diff --git a/crates/engine/src/tests_import.rs b/crates/engine/src/tests_import.rs
index c4a03c2bb..dcce7d613 100644
--- a/crates/engine/src/tests_import.rs
+++ b/crates/engine/src/tests_import.rs
@@ -287,3 +287,36 @@ fn auto_import_watched_folder() {
assert_eq!(s.execute("library.autoImportScan", &json!({})).unwrap()["folder"], json!(null));
let _ = std::fs::remove_dir_all(&dir);
}
+
+/// Smart previews: with the original offline the photo still renders (and edits apply) from
+/// its proxy; without the proxy it can't be opened.
+#[test]
+fn smart_previews_stand_in_for_offline_originals() {
+ let src = temp_dir("smartsrc");
+ let lib = temp_dir("smartlib");
+ write_png(&src.join("a.png"), 7);
+ let mut s = Session::new().with_fs();
+ s.open_library(&lib, false).unwrap();
+ s.execute("library.import", &json!({"paths": [src.join("a.png").to_string_lossy()]})).unwrap();
+ let id = s.active().unwrap();
+ let r = s.execute("library.smartPreviews", &json!({})).unwrap();
+ assert_eq!(r["built"], 1, "{r}");
+ assert_eq!(s.execute("photo.smartPreview", &json!({})).unwrap(), json!({"smartPreview": true, "originalOnline": true}));
+ let online = s.render_now(id, 48, 32).unwrap().image;
+ // the drive goes away
+ std::fs::rename(&src, src.with_extension("offline")).unwrap();
+ s.media.forget(id);
+ assert_eq!(s.execute("photo.smartPreview", &json!({})).unwrap()["originalOnline"], false);
+ let offline = s.render_now(id, 48, 32).expect("renders from the smart preview").image;
+ let diff: f64 = online.data.iter().zip(&offline.data).map(|(a, b)| (a[0] as f64 - b[0] as f64).abs()).sum::<f64>() / online.data.len() as f64;
+ assert!(diff < 6.0, "the proxy looks like the original: {diff}");
+ s.execute("develop.set", &json!({"control": "light.exposure", "value": 1.0})).unwrap();
+ s.media.forget(id);
+ assert_ne!(s.render_now(id, 48, 32).unwrap().image.data, offline.data, "edits apply offline");
+ // without the proxy it can't be opened
+ s.execute("library.smartPreviews", &json!({"discard": true})).unwrap();
+ s.media.forget(id);
+ assert!(s.render_now(id, 48, 32).is_err());
+ let _ = std::fs::remove_dir_all(src.with_extension("offline"));
+ let _ = std::fs::remove_dir_all(&lib);
+}
diff --git a/crates/engine/src/tests_xmp.rs b/crates/engine/src/tests_xmp.rs
index 685d439b9..bc80afc0e 100644
--- a/crates/engine/src/tests_xmp.rs
+++ b/crates/engine/src/tests_xmp.rs
@@ -375,3 +375,27 @@ fn reload_picks_up_changed_files() {
assert_ne!(s.render_now(id, 32, 32).unwrap().image.data, before, "renders the new pixels");
let _ = std::fs::remove_dir_all(&dir);
}
+
+#[test]
+fn duplicate_copies_the_file_and_the_edits() {
+ let dir = temp_dir("dup");
+ let f = dir.join("pic.png");
+ write_png(&f, 5);
+ let mut s = Session::new().with_fs();
+ s.execute("library.import", &json!({"paths": [f.to_string_lossy()]})).unwrap();
+ let orig = s.active().unwrap();
+ s.execute("develop.set", &json!({"control": "light.exposure", "value": 0.8})).unwrap();
+ s.execute("photo.rate", &json!({"rating": 4})).unwrap();
+ let alb = s.execute("album.create", &json!({"name": "Keep", "addSelected": true})).unwrap()["id"].as_u64().unwrap();
+ let r = s.execute("photo.duplicate", &json!({})).unwrap();
+ let dup = lightcraft_catalog::PhotoId(r["ids"][0].as_u64().unwrap());
+ let d = s.catalog.photo(dup).unwrap().clone();
+ assert_eq!(d.file_name, "pic-copy.png");
+ assert!(dir.join("pic-copy.png").exists());
+ assert_eq!((d.develop.light.exposure, d.rating), (0.8, 4));
+ assert_eq!(s.catalog.album_count(lightcraft_catalog::AlbumId(alb)), 2);
+ assert_ne!(dup, orig);
+ s.execute("edit.undo", &json!({})).unwrap();
+ assert!(s.catalog.photo(dup).is_none(), "one undo step");
+ let _ = std::fs::remove_dir_all(&dir);
+}
diff --git a/crates/ui-egui/src/menubar.rs b/crates/ui-egui/src/menubar.rs
index ffa693b31..d771b9094 100644
--- a/crates/ui-egui/src/menubar.rs
+++ b/crates/ui-egui/src/menubar.rs
@@ -296,6 +296,23 @@ fn expanded(app: &LightcraftApp, name: &str) -> Option<Vec<MenuNode>> {
item("library.buildPreviews", json!({"size": "full"}), format!("Build 1:1 Previews ({scope})"), None, !running, None),
item("library.cancelPreviews", Value::Null, "Stop Building Previews", None, running, None),
MenuNode::Separator,
+ item(
+ "library.smartPreviews",
+ Value::Null,
+ format!("Build Smart Previews ({scope})"),
+ None,
+ app.session.media.smart_dir.is_some(),
+ None,
+ ),
+ item(
+ "library.smartPreviews",
+ json!({"discard": true}),
+ format!("Discard Smart Previews ({scope})"),
+ None,
+ app.session.media.smart_dir.is_some(),
+ None,
+ ),
+ MenuNode::Separator,
item("library.clearPreviews", Value::Null, "Discard Preview Cache", None, true, None),
]
}
diff --git a/crates/ui-egui/src/panels/right.rs b/crates/ui-egui/src/panels/right.rs
index 743f3b4fb..3332bc030 100644
--- a/crates/ui-egui/src/panels/right.rs
+++ b/crates/ui-egui/src/panels/right.rs
@@ -468,6 +468,20 @@ fn info(app: &mut LightcraftApp, ui: &mut egui::Ui, id: PhotoId) {
format!("{:.5}° {}, {:.5}° {}", la.abs(), if la >= 0.0 { "N" } else { "S" }, lo.abs(), if lo >= 0.0 { "E" } else { "W" })
});
ui.label(egui::RichText::new(gps.unwrap_or_else(|| "—".into())).color(t.text_label));
+ // offline originals / smart previews
+ if let lightcraft_catalog::Source::File { path } = &p.source {
+ let online = std::path::Path::new(path).exists();
+ let smart = lightcraft_engine::cmd::previews::has_smart_preview(&app.session, p.id);
+ if !online || smart {
+ let text = match (online, smart) {
+ (false, true) => "Original offline · editing the smart preview",
+ (false, false) => "Original offline · no smart preview",
+ _ => "Smart preview available",
+ };
+ ui.add_space(6.0);
+ ui.label(egui::RichText::new(text).color(if online { t.text_dim } else { t.accent }));
+ }
+ }
ui.add_space(10.0);
if text_button(ui, "allMetadata", "All Metadata…", false).on_hover_text("Every EXIF, GPS and XMP field in the file").clicked() {
let _ = app.run("dialog.allMetadata", json!({}));
diff --git a/docs/parity.md b/docs/parity.md
index 2c4889ebd..e115490d1 100644
--- a/docs/parity.md
+++ b/docs/parity.md
@@ -22,7 +22,7 @@ and prints the summary; `cargo xtask parity --write` refreshes the summary table
| Section | ✅ | 🟡 | ⬜ | 🚫 | P0 done | P1 done |
|---|---:|---:|---:|---:|---:|---:|
| A. Import (IMP) | 9 | 2 | 2 | 1 | 3/4 (75%) | 3/4 (75%) |
-| B. Library management (LIB) | 21 | 0 | 4 | 2 | 9/9 (100%) | 9/9 (100%) |
+| B. Library management (LIB) | 22 | 0 | 3 | 2 | 9/9 (100%) | 9/9 (100%) |
| C. Views & navigation (VIEW) | 15 | 0 | 2 | 0 | 9/9 (100%) | 4/4 (100%) |
| D. Search & filter (FILT) | 10 | 0 | 3 | 0 | 4/4 (100%) | 4/4 (100%) |
| E. Metadata (META) | 5 | 1 | 0 | 0 | 2/2 (100%) | 2/2 (100%) |
@@ -43,14 +43,14 @@ and prints the summary; `cargo xtask parity --write` refreshes the summary table
| T. Share (SHARE) | 0 | 0 | 0 | 4 | — | — |
| U. Map & location (MAP) | 0 | 1 | 1 | 0 | — | 0/1 (0%) |
| V. Preferences (PREF) | 5 | 0 | 3 | 3 | 1/1 (100%) | 4/4 (100%) |
-| W. Cloud & AI infrastructure (CLOUD / AI) | 0 | 1 | 1 | 2 | — | — |
+| W. Cloud & AI infrastructure (CLOUD / AI) | 1 | 0 | 1 | 2 | — | — |
| X. Cross-cutting behaviours (BEHAV) | 13 | 0 | 4 | 1 | 8/8 (100%) | 5/5 (100%) |
| Y. Menus | 77 | 2 | 6 | 8 | 46/47 (98%) | 22/23 (96%) |
| Z. Keyboard shortcuts (desktop) | 74 | 3 | 3 | 1 | 49/52 (94%) | 22/23 (96%) |
| Lightroom Classic extras | 22 | 10 | 47 | 9 | — | 18/21 (86%) |
-| **Total** | 364 | 25 | 111 | 37 | 193/198 (97%) | 132/144 (92%) |
+| **Total** | 366 | 24 | 110 | 37 | 193/198 (97%) | 132/144 (92%) |
-Weighted completion (✅ = 1, 🟡 = ½, 🚫 left out): **75.3%** of 500 in-scope rows — P0 98.7% of 198 · P1 94.4% of 144 · P2 28.5% of 158.
+Weighted completion (✅ = 1, 🟡 = ½, 🚫 left out): **75.6%** of 500 in-scope rows — P0 98.7% of 198 · P1 94.4% of 144 · P2 29.4% of 158.
<!-- /parity:summary -->
## Top gaps
@@ -135,7 +135,7 @@ under the UI command that wraps it (a no-op error); the UI command now wins.
| LR-LIB-VERSIONS | Versions | P1 | ✅ | `cmd:version.create` | see section M |
| LR-LIB-DELETE | Delete / Recently Deleted | P0 | ✅ | `cmd:photo.delete`, `cmd:photo.restore`, `cmd:photo.deletePermanently` | no confirmation dialog, no auto-purge after N days, no "Empty" |
| LR-LIB-REMOVE-ALBUM | Remove from album | P0 | ✅ | `cmd:album.removePhotos` | |
-| LR-LIB-DUPLICATE | Duplicate a photo | P2 | ⬜ | | |
+| LR-LIB-DUPLICATE | Duplicate a photo | P2 | ✅ | `cmd:photo.duplicate` | Photo ▸ Duplicate: a real `-copy` file with the same settings, metadata and albums (virtual copies share the file) |
| LR-LIB-RENAME | Batch rename | P1 | ✅ | `cmd:photo.rename`, `cmd:photo.renamePreview`, `cmd:dialog.rename`, `crates/engine/src/rename.rs` | template tokens {name} {seq:N} {date:%Y%m%d} {camera} {title}; preview; renames files on disk with their XMP sidecars, never overwriting (-1, -2… suffixes), rolls back on failure; undo/redo move the files; virtual copies follow |
| LR-LIB-CAPTURETIME | Edit capture time | P1 | ✅ | `cmd:photo.setCaptureTime`, `cmd:dialog.captureTime`, `crates/catalog/src/dates.rs` | set (the other selected photos shift by the same amount, or `each`), shift by days/hours/minutes, time-zone shift; one undo step, journaled; Info panel button; no “revert to original capture time” |
| LR-LIB-SHOWFINDER | Reveal original in file manager | P0 | ✅ | `cmd:app.showInFinder` | ⌘R (see MENU-FILE-SHOWFINDER) |
@@ -462,7 +462,7 @@ under the UI command that wraps it (a no-op error); the UI command now wins.
| Id | Feature | Tier | Status | Evidence | Missing / notes |
|---|---|---|---|---|---|
| LR-CLOUD-SYNC | Cloud sync | OOS | 🚫 | | |
-| LR-CLOUD-SMARTPREVIEW | Editable proxies | P2 | 🟡 | `crates/engine/src/media.rs` | preview-size proxies drive the loupe; editing needs the original |
+| LR-CLOUD-SMARTPREVIEW | Editable proxies | P2 | ✅ | `cmd:library.smartPreviews`, `cmd:photo.smartPreview`, `crates/engine/src/smart.rs` | File ▸ Previews ▸ Build / Discard Smart Previews: ~1 MB proxies in the library; with the original offline the photo renders, edits and exports (at proxy size) from its proxy; Info shows the status |
| LR-AI-UPDATE-INDICATOR | AI-settings update indicator | P2 | ⬜ | | |
| LR-AI-CREDITS | Generative credits | OOS | 🚫 | | |