Skip to content

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

Merge PR #1138

Brandon Thomase6b2e6eefb62
diff --cc crates/catalog/src/lib.rs
index df2713657,eec22fa9c..1776c895c
--- a/crates/catalog/src/lib.rs
+++ b/crates/catalog/src/lib.rs
@@@ -286,73 -276,11 +287,76 @@@ pub struct Catalog
/// Increments on every applied op.
#[serde(skip)]
pub revision: u64,
+ /// Which photos the latest ops touched ([`Catalog::touched_since`]).
+ #[serde(skip)]
+ changes: Changes,
+ /// Lookups derived from the above (never saved), see [`index`].
+ #[serde(skip)]
+ index: index::Indexes,
}
+/// What of a photo an op changed: enough to tell which tallies of the library an edit leaves as they were (a
+/// rating changes no folder's count; a slider changes none at all).
+#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
+pub struct Aspects(u16);
+
+impl Aspects {
+ pub const NONE: Aspects = Aspects(0);
+ pub const RATING: Aspects = Aspects(1);
+ pub const FLAG: Aspects = Aspects(1 << 1);
+ pub const LABEL: Aspects = Aspects(1 << 2);
+ /// Develop settings, versions and history.
+ pub const DEVELOP: Aspects = Aspects(1 << 3);
+ /// Title, caption, keywords, people, place and the rest of the metadata.
+ pub const META: Aspects = Aspects(1 << 4);
+ pub const CAPTURED: Aspects = Aspects(1 << 5);
+ /// Where its file is.
+ pub const FILE: Aspects = Aspects(1 << 6);
+ pub const ANALYSIS: Aspects = Aspects(1 << 7);
+ /// Whether it is in the library at all: added, removed, deleted, restored, taken in from Local.
+ pub const PRESENCE: Aspects = Aspects(1 << 8);
+ /// Everything: the photo may count differently for any tally.
+ pub const ALL: Aspects = Aspects(u16::MAX);
+
+ pub const fn with(self, other: Aspects) -> Aspects {
+ Aspects(self.0 | other.0)
+ }
+
+ /// Whether any of `other` is among these.
+ pub const fn any_of(self, other: Aspects) -> bool {
+ self.0 & other.0 != 0
+ }
+}
+
+/// The most photos remembered as touched; older changes are then answered with "anything may have changed".
+const MAX_TOUCHED: usize = 8192;
+
+/// A short memory of what the latest ops changed, so that what is derived from the catalog (the grid's list) can
+/// follow a small edit without being worked out again from every photo.
+#[derive(Clone, Debug, Default)]
+struct Changes {
+ /// The photos ops changed, each with the revision the op made and what of the photo it changed. Oldest first.
+ touched: std::collections::VecDeque<(u64, PhotoId, Aspects)>,
+ /// What the op being applied changes of its photo.
+ now: Aspects,
+ /// The latest revision made by an op that changed more than photos of its own (an album, a stack, a keyword of
+ /// the list…): what it changed for which photos is not known.
+ broad: u64,
+ /// Changes up to this revision are no longer all in `touched`.
+ floor: u64,
+ /// The revision the last op recorded here made. When the catalog's revision is another, it was set from
+ /// outside (a library just loaded takes a range of its own, so that nothing kept from another library is
+ /// taken for this one's): nothing is known of how the catalog got to where it is.
+ seen: u64,
+}
+
+impl PartialEq for Changes {
+ /// Two catalogs are the same catalog whatever each remembers of how it got there.
+ fn eq(&self, _: &Self) -> bool {
+ true
+ }
+}
+
impl Catalog {
pub fn new() -> Catalog {
Catalog { next_photo: 1, next_album: 1, next_stack: 1, ..Default::default() }
@@@ -749,7 -583,8 +764,8 @@@
self.validate_rules(rules)?;
}
let id = album.id;
- self.next_album = self.next_album.max(id.0 + 1);
+ self.next_album = self.next_album.max(id.0.saturating_add(1));
+ self.index.album_changed(id, Some(&album.photos));
self.albums.insert(id, album);
Op::RemoveAlbum { id }
}
@@@ -823,7 -660,8 +843,8 @@@
}
self.validate_stack(stack.id, &stack.photos)?;
let id = stack.id;
- self.next_stack = self.next_stack.max(id.0 + 1);
+ self.next_stack = self.next_stack.max(id.0.saturating_add(1));
+ self.index.stack_changed(id, &[], &stack.photos);
self.stacks.insert(id, stack);
Op::RemoveStack { id }
}
@@@ -988,94 -828,7 +1012,98 @@@
}
pub fn from_snapshot(s: &str) -> Result<Catalog> {
- serde_json::from_str(s).map_err(|e| CatalogError::Corrupt(e.to_string()))
+ let mut c: Catalog = serde_json::from_str(s).map_err(|e| CatalogError::Corrupt(e.to_string()))?;
+ c.repair();
+ Ok(c)
+ }
+
+ /// Make a catalog read from a snapshot hold together where a damaged or hand-edited file left
+ /// it inconsistent, so nothing that relies on it can fail (code indexes stacks by the ids it
+ /// finds in them, and walks folders up to the top): every photo, album and stack carries the
+ /// id it is filed under; the id counters lie past every id in use; a stack keeps only photos
+ /// in the catalog, once each, and goes when fewer than two are left; an album whose parent is
+ /// missing, not a folder or inside itself moves to the top level. Returns what was changed
+ /// (nothing, for a catalog this build wrote).
+ pub fn repair(&mut self) -> Vec<String> {
+ let mut changed = Vec::new();
+ for (id, p) in self.photos.iter_mut() {
+ if p.id != *id {
+ changed.push(format!("photo {} was filed as {}", p.id.0, id.0));
+ Arc::make_mut(p).id = *id;
+ }
+ }
+ for (id, a) in self.albums.iter_mut() {
+ if a.id != *id {
+ changed.push(format!("album {} was filed as {}", a.id.0, id.0));
+ a.id = *id;
+ }
+ }
+ let photos = &self.photos;
+ self.stacks.retain(|id, st| {
+ if st.id != *id {
+ changed.push(format!("stack {} was filed as {}", st.id.0, id.0));
+ st.id = *id;
+ }
+ let mut seen = std::collections::HashSet::new();
+ let before = st.photos.len();
+ st.photos.retain(|p| photos.contains_key(p) && seen.insert(*p));
+ if st.photos.len() != before {
+ changed.push(format!("stack {}: {} missing or repeated photo(s) left out", id.0, before - st.photos.len()));
+ }
+ let keep = st.photos.len() >= 2;
+ if !keep {
+ changed.push(format!("stack {} had fewer than two photos: removed", id.0));
+ }
+ keep
+ });
+ // a photo in two stacks stays in the first
+ let mut stacked = std::collections::HashSet::new();
+ self.stacks.retain(|id, st| {
+ let before = st.photos.len();
+ st.photos.retain(|p| stacked.insert(*p));
+ if st.photos.len() != before {
+ changed.push(format!("stack {}: {} photo(s) already in another stack left out", id.0, before - st.photos.len()));
+ }
+ st.photos.len() >= 2
+ });
+ let parents: Vec<(AlbumId, Option<AlbumId>)> = self.albums.values().map(|a| (a.id, a.parent)).collect();
+ for (id, parent) in parents {
+ let Some(p) = parent else { continue };
+ let mut cur = Some(p);
+ let mut steps = 0usize;
+ let ok = loop {
+ match cur {
+ None => break true,
+ Some(c) if c == id || steps > self.albums.len() => break false,
+ Some(c) => match self.albums.get(&c) {
+ Some(a) if a.folder => cur = a.parent,
+ _ => break false,
+ },
+ }
+ steps += 1;
+ };
+ if !ok && let Some(a) = self.albums.get_mut(&id) {
+ changed.push(format!("album {}: its folder {} is missing, not a folder or inside it: moved to the top level", id.0, p.0));
+ a.parent = None;
+ }
+ }
+ let past = |last: Option<u64>| last.map_or(1, |v| v.saturating_add(1));
+ let (photo, album, stack) = (
+ past(self.photos.keys().last().map(|k| k.0)),
+ past(self.albums.keys().last().map(|k| k.0)),
+ past(self.stacks.keys().last().map(|k| k.0)),
+ );
+ if self.next_photo < photo || self.next_album < album || self.next_stack < stack {
+ changed.push("id counters behind the ids in use: moved past them".into());
+ self.next_photo = self.next_photo.max(photo);
+ self.next_album = self.next_album.max(album);
+ self.next_stack = self.next_stack.max(stack);
+ }
++ if !changed.is_empty() {
++ // stacks and albums changed outside `apply`: the lookups are built again when asked
++ self.index = index::Indexes::default();
++ }
+ changed
}
/// Replay an op log (JSON lines) on top of `self`. A torn final line (crash mid-write) is ignored.
@@@ -1130,6 -885,6 +1160,8 @@@ mod tests_local
#[cfg(test)]
mod tests_lock;
#[cfg(test)]
+mod tests_repair;
+#[cfg(test)]
+ mod tests_scale;
+ #[cfg(test)]
mod tests_torn_append;
diff --cc crates/catalog/src/query.rs
index 883319b32,9d3eb90c7..d1548f8bd
--- a/crates/catalog/src/query.rs
+++ b/crates/catalog/src/query.rs
@@@ -135,6 -112,21 +135,12 @@@ fn shuffle_rank(seed: u64, id: PhotoId
mix64(mix64(seed) ^ id.0)
}
+ /// What [`Filter::prepare`] works out once for a pass over many photos.
+ pub(crate) struct Prepared {
+ root: Option<String>,
+ only: Option<std::collections::HashSet<PhotoId>>,
+ }
+
-/// The ids of `photos` by `key`, ties by id (so the order is total and the same every time),
-/// reversed when not `ascending`. Each photo's key is worked out once.
-fn sorted<'a, K: Ord>(photos: &[&'a Photo], ascending: bool, key: impl Fn(&'a Photo) -> K) -> Vec<PhotoId> {
- let mut keyed: Vec<(K, PhotoId)> = photos.iter().map(|p| (key(p), p.id)).collect();
- // ids differ, so there are no ties and an unstable sort gives the one order there is
- keyed.sort_unstable_by(|a, b| if ascending { a.cmp(b) } else { b.cmp(a) });
- keyed.into_iter().map(|(_, id)| id).collect()
-}
-
fn token_matches(p: &Photo, tok: &str) -> bool {
let t = tok.to_lowercase();
if let Some((field, val)) = t.split_once(':') {
@@@ -382,58 -385,22 +399,59 @@@ impl Filter
}
}
+/// Case-insensitive file name order without allocating (compares per-character lowercase via `char::to_lowercase`).
+pub fn cmp_name(a: &str, b: &str) -> std::cmp::Ordering {
+ a.chars().flat_map(char::to_lowercase).cmp(b.chars().flat_map(char::to_lowercase))
+}
+
impl Catalog {
- /// Photos matching `filter`, in `sort` order (ties broken by id for stability).
+ /// Photos matching `filter`, in `sort` order (ties broken by file name, then id).
pub fn query(&self, filter: &Filter, sort: &Sort) -> Vec<PhotoId> {
+ self.query_keeping(filter, sort, &std::collections::HashSet::new(), filter)
+ }
+
+ /// [`Catalog::query`], and with them the photos of `keep` that still match `within`, each at its place in `sort`
+ /// order: a view that holds the photos it showed when an edit makes them stop matching `filter` (a smart
+ /// album's rules, the filter bar), as long as they are still where the view looks (`within`: in the library,
+ /// the album, the folder; not deleted).
+ pub fn query_keeping(&self, filter: &Filter, sort: &Sort, keep: &std::collections::HashSet<PhotoId>, within: &Filter) -> Vec<PhotoId> {
- let root = filter.library_root();
- let within_root = within.library_root();
+ let prepared = filter.prepare();
- let v: Vec<&Photo> = self.photos().map(|p| p.as_ref()).filter(|p| filter.matches_in(p, self, &prepared)).collect();
- let asc = sort.ascending;
- match sort.key {
- SortKey::CaptureDate => sorted(&v, asc, |p| (p.captured.as_deref(), p.imported.as_str())),
- SortKey::ImportDate => sorted(&v, asc, |p| p.imported.as_str()),
- SortKey::EditDate => sorted(&v, asc, |p| p.edited.as_deref()),
- // each name lower-cased once, not twice per comparison
- SortKey::FileName => sorted(&v, asc, |p| p.file_name.to_lowercase()),
- SortKey::Rating => sorted(&v, asc, |p| p.rating),
- SortKey::FileSize => sorted(&v, asc, |p| p.file_size),
- SortKey::Random => sorted(&v, asc, |p| shuffle_rank(sort.seed, p.id)),
++ // `within` only decides for the few kept photos: worked out per photo, not hashed
++ let within_prepared = within.prepare_one();
+ let mut v: Vec<&Photo> = self
+ .photos()
+ .map(|p| p.as_ref())
- .filter(|p| filter.matches_in(p, self, root.as_deref()) || (keep.contains(&p.id) && within.matches_in(p, self, within_root.as_deref())))
++ .filter(|p| filter.matches_in(p, self, &prepared) || (keep.contains(&p.id) && within.matches_in(p, self, &within_prepared)))
+ .collect();
+ v.sort_by(|a, b| sort.order(a, b));
+ v.into_iter().map(|p| p.id).collect()
+ }
+
+ /// The list `was` (a [`Catalog::query`] of `filter` in `sort` order, or a [`Catalog::query_keeping`]), after ops
+ /// that touched only the photos `touched` (sorted by id, each once: [`Catalog::touched_since`]): those photos
+ /// taken out, and the ones that match `filter` now put back at their place in the order. With `within`, a
+ /// touched photo that was in the list and still matches `within` stays, as `query_keeping` would keep it. What
+ /// the query would give, without asking every photo again.
+ pub fn follow(&self, was: &[PhotoId], touched: &[PhotoId], filter: &Filter, sort: &Sort, within: Option<&Filter>) -> Vec<PhotoId> {
+ let listed: std::collections::HashSet<PhotoId> = was.iter().copied().filter(|id| touched.binary_search(id).is_ok()).collect();
+ let mut ids: Vec<PhotoId> = was.iter().copied().filter(|id| !listed.contains(id)).collect();
- let (root, within_root) = (filter.library_root(), within.and_then(Filter::library_root));
++ let (prepared, within_prepared) = (filter.prepare_one(), within.map(Filter::prepare_one));
+ for id in touched {
+ let Some(p) = self.photo(*id) else { continue };
- let kept = within.is_some_and(|w| listed.contains(id) && w.matches_in(p, self, within_root.as_deref()));
- if filter.matches_in(p, self, root.as_deref()) || kept {
++ let kept = within.zip(within_prepared.as_ref()).is_some_and(|(w, wp)| listed.contains(id) && w.matches_in(p, self, wp));
++ if filter.matches_in(p, self, &prepared) || kept {
+ // (the list is in order without the touched photos, and stays so as each is put back)
+ let at = ids.partition_point(|other| self.photo(*other).is_some_and(|o| sort.order(o, p).is_lt()));
+ ids.insert(at, *id);
+ }
}
+ ids
+ }
+
+ /// How many photos match `filter`: [`Catalog::query`]'s length without its sorting.
+ pub fn count(&self, filter: &Filter) -> usize {
- let root = filter.library_root();
- self.photos().filter(|p| filter.matches_in(p, self, root.as_deref())).count()
++ let prepared = filter.prepare();
++ self.photos().filter(|p| filter.matches_in(p, self, &prepared)).count()
}
/// Year → month → day counts for the "By Date" section (newest first).
diff --cc crates/catalog/src/tests_index.rs
index 000000000,abfd4ef51..f1f41501b
mode 000000,100644..100644
--- a/crates/catalog/src/tests_index.rs
+++ b/crates/catalog/src/tests_index.rs
@@@ -1,0 -1,222 +1,211 @@@
+ //! The derived indexes ([`crate::index`]) answer as a scan of the catalog would, through every op,
+ //! inverse, failed batch, snapshot, replay and clone; and the faster query paths give the same
+ //! results as before.
+
+ use proptest::prelude::*;
+
+ use super::*;
+
+ const PHOTOS: u64 = 8;
+
+ fn library() -> Catalog {
+ let mut c = Catalog::new();
+ for i in 0..PHOTOS {
+ let p = Photo::new(PhotoId(i + 1), Source::Demo { scene: 1 }, &format!("p{i}.jpg"), "JPEG", 60, 40, "2026-01-01T00:00:00");
+ c.apply(Op::AddPhoto { photo: Box::new(p) }).unwrap();
+ }
+ c
+ }
+
+ /// What the indexes must say, worked out by scanning (as the catalog did before it had them).
+ fn scanned(c: &Catalog) -> (Vec<Option<StackId>>, Vec<Vec<bool>>) {
+ let photos: Vec<PhotoId> = (1..=PHOTOS + 1).map(PhotoId).collect();
+ let stacks = photos.iter().map(|p| c.stacks().find(|s| s.photos.contains(p)).map(|s| s.id)).collect();
+ let albums = (1..=4)
+ .map(|a| {
+ photos
+ .iter()
+ .map(|p| c.photo(*p).is_some() && c.album(AlbumId(a)).is_some_and(|al| al.smart.is_none() && al.photos.contains(p)))
+ .collect()
+ })
+ .collect();
+ (stacks, albums)
+ }
+
+ /// What the indexes say.
+ fn indexed(c: &Catalog) -> (Vec<Option<StackId>>, Vec<Vec<bool>>) {
+ let photos: Vec<PhotoId> = (1..=PHOTOS + 1).map(PhotoId).collect();
+ let stacks = photos.iter().map(|p| c.stack_of(*p).map(|s| s.id)).collect();
+ let albums = (1..=4)
+ .map(|a| {
+ photos
+ .iter()
+ .map(|p| c.album(AlbumId(a)).is_some_and(|al| al.smart.is_none()) && c.photo(*p).is_some_and(|ph| c.album_contains(AlbumId(a), ph)))
+ .collect()
+ })
+ .collect();
+ (stacks, albums)
+ }
+
+ /// Photo ids from bits (the extra id names a photo that isn't there: such ops fail).
+ fn ids(bits: u16) -> Vec<PhotoId> {
+ (0..=PHOTOS).filter(|i| bits & (1 << i) != 0).map(|i| PhotoId(i + 1)).collect()
+ }
+
+ fn op(c: &Catalog, kind: u8, n: u64, bits: u16, collapsed: bool) -> Op {
+ match kind % 8 {
+ 0 => Op::AddStack { stack: Stack { id: StackId(n % 4 + 1), photos: ids(bits), collapsed } },
+ 1 => Op::RemoveStack { id: StackId(n % 4 + 1) },
+ 2 => Op::SetStack { id: StackId(n % 4 + 1), photos: ids(bits), collapsed },
+ 3 => {
+ let mut a = Album::new(AlbumId(n % 4 + 1), "A");
+ a.photos = ids(bits);
+ Op::AddAlbum { album: a }
+ }
+ 4 => Op::RemoveAlbum { id: AlbumId(n % 4 + 1) },
+ 5 => Op::SetAlbumPhotos { id: AlbumId(n % 4 + 1), photos: ids(bits) },
+ // a batch whose last op fails half the time: what it did is rolled back
+ 6 => Op::Batch {
+ ops: vec![
+ Op::SetAlbumPhotos { id: AlbumId(n % 4 + 1), photos: ids(bits) },
+ Op::SetStack { id: StackId(n % 4 + 1), photos: ids(bits.rotate_left(3)), collapsed },
+ Op::AddStack { stack: Stack { id: StackId(n % 4 + 1), photos: ids(!bits), collapsed } },
+ ],
+ },
+ // as the engine deletes a photo: out of its albums and stacks too, in one batch
+ _ => c.delete_permanently_ops(PhotoId(n % (PHOTOS + 1) + 1)),
+ }
+ }
+
+ proptest! {
+ #![proptest_config(ProptestConfig::with_cases(256))]
+
+ #[test]
+ fn indexes_agree_with_a_scan(steps in proptest::collection::vec((0u8..8, 0u64..16, 0u16..512, any::<bool>()), 1..40)) {
+ let mut c = library();
+ let start = c.to_snapshot();
+ // built before the ops, so every op has to keep them up to date
+ prop_assert_eq!(indexed(&c), scanned(&c));
+ let mut log = String::new();
+ let mut inverses = Vec::new();
+ for (kind, n, bits, collapsed) in steps {
+ let op = op(&c, kind, n, bits, collapsed);
+ if let Ok(inv) = c.apply(op.clone()) {
+ log.push_str(&Catalog::op_to_log_line(&op));
+ inverses.push(inv);
+ }
+ prop_assert_eq!(indexed(&c), scanned(&c));
+ }
+ // a snapshot, a replayed journal and a clone build their own
+ let snap = Catalog::from_snapshot(&c.to_snapshot()).unwrap();
+ prop_assert_eq!(indexed(&snap), scanned(&c));
+ let mut replayed = Catalog::from_snapshot(&start).unwrap();
+ prop_assert_eq!(indexed(&replayed), scanned(&replayed));
+ replayed.replay(&log).unwrap();
+ prop_assert_eq!(indexed(&replayed), scanned(&c));
+ prop_assert_eq!(indexed(&c.clone()), scanned(&c));
+ prop_assert!(c.clone() == c, "the indexes don't take part in equality");
+ // undone step by step
+ for inv in inverses.into_iter().rev() {
+ c.apply(inv).unwrap();
+ prop_assert_eq!(indexed(&c), scanned(&c));
+ }
+ prop_assert!(c.stacks().next().is_none() && c.albums().next().is_none(), "all undone");
+ }
+ }
+
+ #[test]
+ fn a_photo_in_another_stack_is_refused_by_the_index() {
+ let mut c = library();
+ c.apply(Op::AddStack { stack: Stack { id: StackId(1), photos: vec![PhotoId(1), PhotoId(2)], collapsed: false } }).unwrap();
+ let e = c.apply(Op::AddStack { stack: Stack { id: StackId(2), photos: vec![PhotoId(2), PhotoId(3)], collapsed: false } }).unwrap_err();
+ assert_eq!(e, CatalogError::Invalid("a photo can be in only one stack".into()));
+ // its own stack may keep it
+ c.apply(Op::SetStack { id: StackId(1), photos: vec![PhotoId(2), PhotoId(1), PhotoId(3)], collapsed: true }).unwrap();
+ assert_eq!(c.stack_of(PhotoId(3)).map(|s| s.id), Some(StackId(1)));
+ }
+
+ /// The sort keys are worked out once per photo now; the order is the one the comparisons gave.
+ #[test]
+ fn sorted_queries_keep_their_order() {
+ let mut c = Catalog::new();
+ let names = ["b.jpg", "A.jpg", "a.jpg", "Été.jpg", "été.jpg", "C.JPG", "b.jpg"];
+ for (i, n) in names.iter().enumerate() {
+ let mut p = Photo::new(PhotoId(i as u64 + 1), Source::Demo { scene: 1 }, n, "JPEG", 60, 40, &format!("2026-01-0{}T00:00:00", 7 - i % 3));
+ p.captured = (i % 2 == 0).then(|| format!("2025-0{}-01T00:00:00", 1 + i % 4));
+ p.rating = (i % 3) as u8;
+ c.apply(Op::AddPhoto { photo: Box::new(p) }).unwrap();
+ }
+ let all = Filter::default();
+ for key in [SortKey::CaptureDate, SortKey::ImportDate, SortKey::EditDate, SortKey::FileName, SortKey::Rating, SortKey::FileSize, SortKey::Random]
+ {
+ for ascending in [true, false] {
+ let sort = Sort { key, ascending, seed: 7, ..Default::default() };
- // the comparison the query used to sort by
++ // the comparison the query sorts by
+ let mut want: Vec<&Photo> = c.photos().map(|p| p.as_ref()).collect();
- want.sort_by(|a, b| {
- let o = match key {
- SortKey::CaptureDate => a.captured.cmp(&b.captured).then_with(|| a.imported.cmp(&b.imported)),
- SortKey::ImportDate => a.imported.cmp(&b.imported),
- SortKey::EditDate => a.edited.cmp(&b.edited),
- SortKey::FileName => a.file_name.to_lowercase().cmp(&b.file_name.to_lowercase()),
- SortKey::Rating => a.rating.cmp(&b.rating),
- SortKey::FileSize => a.file_size.cmp(&b.file_size),
- SortKey::Random => mix64(mix64(7) ^ a.id.0).cmp(&mix64(mix64(7) ^ b.id.0)),
- }
- .then(a.id.cmp(&b.id));
- if ascending { o } else { o.reverse() }
- });
++ want.sort_by(|a, b| sort.order(a, b));
+ let want: Vec<PhotoId> = want.iter().map(|p| p.id).collect();
+ assert_eq!(c.query(&all, &sort), want, "{key:?} ascending {ascending}");
+ }
+ }
+ // `only` as a set gives the photos it names
+ let only = Filter { only: vec![PhotoId(3), PhotoId(1), PhotoId(3)], ..Default::default() };
+ assert_eq!(c.query(&only, &Sort { key: SortKey::FileName, ascending: true, ..Default::default() }), vec![PhotoId(3), PhotoId(1)]);
+ }
+
+ /// Rules name flags, labels and kinds as their variants in lower case (what `{:?}` gave).
+ #[test]
+ fn rule_names_are_the_variants_in_lower_case() {
+ let mut c = Catalog::new();
+ let mut n = 0;
+ for flag in [Flag::None, Flag::Pick, Flag::Reject] {
+ for label in
+ [None, Some(ColorLabel::Red), Some(ColorLabel::Yellow), Some(ColorLabel::Green), Some(ColorLabel::Blue), Some(ColorLabel::Purple)]
+ {
+ for kind in [MediaKind::Image, MediaKind::Raw, MediaKind::Video] {
+ n += 1;
+ let mut p = Photo::new(PhotoId(n), Source::Demo { scene: 1 }, "x.jpg", "JPEG", 60, 40, "2026-01-01T00:00:00");
+ (p.flag, p.label, p.kind) = (flag, label, kind);
+ c.apply(Op::AddPhoto { photo: Box::new(p) }).unwrap();
+ }
+ }
+ }
+ c.apply(Op::SetLabelName { label: ColorLabel::Blue, name: Some("Sky".into()) }).unwrap();
+ let count = |field: &str, value: String| {
+ let rules: RuleSet =
+ serde_json::from_value(serde_json::json!({"match": "all", "rules": [{"field": field, "op": "is", "value": value}]})).unwrap();
+ c.query(&Filter { rule_set: Some(rules), ..Default::default() }, &Sort::default()).len()
+ };
+ for flag in [Flag::None, Flag::Pick, Flag::Reject] {
+ assert_eq!(count("flag", format!("{flag:?}").to_lowercase()), 18, "{flag:?}");
+ }
+ assert_eq!(count("flag", "picked".into()), 18);
+ for label in ColorLabel::ALL {
+ assert_eq!(count("label", format!("{label:?}").to_uppercase()), 9, "{label:?}");
+ }
+ assert_eq!(count("label", "sky".into()), 9, "a custom name");
+ assert_eq!(count("label", "none".into()), 9);
+ for kind in [MediaKind::Image, MediaKind::Raw, MediaKind::Video] {
+ assert_eq!(count("kind", format!("{kind:?}")), 18, "{kind:?}");
+ }
+ }
+
-/// A hand-edited file can put a photo in two stacks (ops refuse it): the stack index then gives
-/// the answers a scan of the stacks gives, before and after either stack goes.
++/// A hand-edited file can put a photo in two stacks (ops refuse it): loading repairs it (the photo
++/// stays in the first) and the stack index gives the answers a scan of the stacks gives, before
++/// and after either stack goes.
+ #[test]
+ fn a_photo_in_two_stacks_read_from_a_file_answers_as_a_scan() {
+ let mut c = library();
+ c.apply(Op::AddStack { stack: Stack { id: StackId(1), photos: vec![PhotoId(1), PhotoId(2)], collapsed: false } }).unwrap();
+ c.apply(Op::AddStack { stack: Stack { id: StackId(2), photos: vec![PhotoId(3), PhotoId(4)], collapsed: false } }).unwrap();
+ let mut v: serde_json::Value = serde_json::from_str(&c.to_snapshot()).unwrap();
+ v["stacks"]["2"]["photos"] = serde_json::json!([2, 3, 4]);
+ let mut c = Catalog::from_snapshot(&v.to_string()).unwrap();
+ assert_eq!(indexed(&c), scanned(&c));
+ assert_eq!(c.stack_of(PhotoId(2)).map(|s| s.id), Some(StackId(1)));
+ // the second stack can't be changed to keep it, as before
+ assert!(c.apply(Op::SetStack { id: StackId(2), photos: vec![PhotoId(2), PhotoId(3)], collapsed: false }).is_err());
+ c.apply(Op::RemoveStack { id: StackId(1) }).unwrap();
+ assert_eq!(indexed(&c), scanned(&c));
- assert_eq!(c.stack_of(PhotoId(2)).map(|s| s.id), Some(StackId(2)));
++ assert_eq!(c.stack_of(PhotoId(2)).map(|s| s.id), None, "the repair took it out of the second stack");
+ }
diff --cc crates/engine/src/cmd/library.rs
index cc3e654c7,9a5cb410b..cd31e8797
--- a/crates/engine/src/cmd/library.rs
+++ b/crates/engine/src/cmd/library.rs
@@@ -1439,38 -1315,18 +1444,39 @@@ pub fn specs() -> Vec<CommandSpec>
Ok(result)
}
),
- cmd!("album.removePhotos", "Remove from Album", [], None, "{id: albumId, ids?}", has_selection, |s, p| {
- let id = album_param(p, "id", "album.removePhotos")?;
- let targets = ids_param(p).unwrap_or_else(|| s.targets(&Value::Null));
- let al = s.catalog.album(id).ok_or_else(|| bad("album.removePhotos", "no such album"))?;
- if al.is_smart() {
- return Err(bad("album.removePhotos", "smart albums update automatically: change their rules"));
+ cmd!(
+ "album.removePhotos",
+ "Remove from Album",
+ ["Photo"],
+ None,
+ "{id?: albumId (default: the album on screen), ids?} — takes the photos out of the album only: they stay in the library and in their folders (issue #1805; photo.delete removes them from the library) → {removed, album: name}",
+ has_selection,
+ |s, p| {
+ let id = match p.get("id") {
+ Some(_) => album_param(p, "id", "album.removePhotos")?,
+ None => match s.source {
+ LibrarySource::Album(a) => a,
+ _ => return Err(bad("album.removePhotos", "no album: pass `id` or show an album")),
+ },
+ };
+ let targets = ids_param(p).unwrap_or_else(|| s.targets(&Value::Null));
+ let al = s.catalog.album(id).ok_or_else(|| bad("album.removePhotos", "no such album"))?;
+ if al.is_smart() {
+ return Err(bad("album.removePhotos", "smart albums update automatically: change their rules"));
+ }
+ if al.folder {
+ return Err(bad("album.removePhotos", "album folders don't hold photos"));
+ }
+ let name = al.name.clone();
++ let targets: std::collections::HashSet<PhotoId> = targets.into_iter().collect();
+ let photos: Vec<PhotoId> = al.photos.iter().copied().filter(|x| !targets.contains(x)).collect();
+ let removed = al.photos.len().saturating_sub(photos.len());
+ if removed > 0 {
+ s.commit("Remove from Album", Op::SetAlbumPhotos { id, photos })?;
+ }
+ Ok(json!({"removed": removed, "album": name}))
}
- let targets: std::collections::HashSet<PhotoId> = targets.into_iter().collect();
- let photos: Vec<PhotoId> = al.photos.iter().copied().filter(|x| !targets.contains(x)).collect();
- s.commit("Remove from Album", Op::SetAlbumPhotos { id, photos })?;
- ok()
- }),
+ ),
cmd!("album.setCover", "Set as Album Cover", [], None, "{id: albumId, photo?: photoId}", has_active, |s, p| {
let id = album_param(p, "id", "album.setCover")?;
let photo = p.get("photo").and_then(Value::as_u64).map(PhotoId).or(s.active());
diff --cc crates/ui-egui/src/panels/dialogs.rs
index a7779fcd6,60ccdb6e3..632ab710b
--- a/crates/ui-egui/src/panels/dialogs.rs
+++ b/crates/ui-egui/src/panels/dialogs.rs
@@@ -606,38 -578,10 +612,40 @@@ pub fn show(app: &mut LightcraftApp, ct
ui.label(egui::RichText::new(crate::i18n::tr_format!("… and {more} more", more = more)).color(t.text_dim));
}
}
+ Dialog::RenamePerson { from, to, merge } => {
+ let submitted = dialog_field(ui, "field:personName", to, "Name");
+ let plan = person_rename_plan(&app.session.catalog, from, to);
+ if !plan.needs_merge {
+ *merge = false;
+ }
+ if submitted && plan.block.is_none() && (!plan.needs_merge || *merge) {
+ confirm = true;
+ }
+ if let Some(why) = plan.block {
+ ui.label(egui::RichText::new(crate::i18n::tr(why)).color(t.caution));
+ } else {
+ ui.label(
+ egui::RichText::new(crate::i18n::tr_format!(
+ "Renames {n} face{} across the library. The files are not changed.",
+ if plan.faces == 1 { "" } else { "s" },
+ n = plan.faces
+ ))
+ .color(t.text_dim),
+ );
+ }
+ if plan.needs_merge {
+ ui.label(
+ egui::RichText::new(crate::i18n::tr_format!("“{to}” is already a person. Combining them makes one person; Undo separates them again.", to = to.trim()))
+ .color(t.caution),
+ );
+ let r = ui.checkbox(merge, crate::i18n::tr("Combine with the existing person"));
+ crate::widgets::register(ui.ctx(), "check:personMerge", r.rect);
+ }
+ }
Dialog::RenameKeyword { from, to } => {
- let n = app.session.catalog.photos().filter(|p| p.meta.keywords.iter().any(|k| lightcraft_catalog::keywords::is_under(k, from))).count();
+ let n = app.caches.dialog_count(&app.session.catalog, ("renameKeyword", from.as_str()), || {
+ app.session.catalog.photos().filter(|p| p.meta.keywords.iter().any(|k| lightcraft_catalog::keywords::is_under(k, from))).count()
+ });
if dialog_field(ui, "field:keywordName", to, "New name") {
confirm = true;
}
diff --cc crates/ui-egui/src/tests_keywording.rs
index e47ba879a,17ddc6508..c47f70ec4
--- a/crates/ui-egui/src/tests_keywording.rs
+++ b/crates/ui-egui/src/tests_keywording.rs
@@@ -228,567 -228,23 +228,588 @@@ fn containing_keywords_view_lists_paren
assert!(!has(&h, "keywordChip:beach"), "the chips give way");
}
+fn rect(h: &Headless, id: &str) -> egui::Rect {
+ h.app.widgets.iter().find(|(w, _)| w == id).map(|(_, r)| *r).unwrap_or_else(|| panic!("no widget {id}"))
+}
+
+fn count(h: &Headless, prefix: &str) -> usize {
+ h.app.widgets.iter().filter(|(w, _)| w.starts_with(prefix)).count()
+}
+
+/// Give both selected photos `keywords`, replacing what they had.
+fn give(h: &mut Headless, ids: &[u64], keywords: &[String]) {
+ ask(h, "engine.execute", json!({"command": "photo.setMeta", "params": {"ids": ids, "keywords": keywords}}));
+}
+
+/// Sixteen keywords inside "Subjects", each long enough to take a line of the panel.
+fn sixteen() -> Vec<String> {
+ (1..=16).map(|i| format!("Subjects|a keyword with quite a long name {i:02}")).collect()
+}
+
+// Given keywords inside the same keyword and the box set to group them,
+// when the panel is drawn,
+// then they share a line naming that keyword and their chips say only what is below it, side by
+// side where they fit; each chip still acts on its whole keyword.
+#[test]
+fn grouped_keywords_share_a_line_naming_their_parent() {
+ let (mut h, ids) = two_selected();
+ let keywords: Vec<String> = ["Places|Italy|Rome", "Places|Italy|Venice", "Transport|Ferry", "sea"].iter().map(|s| s.to_string()).collect();
+ give(&mut h, &ids, &keywords);
+ assert_eq!(
+ count(&h, "keywordGroup:"),
+ 0,
+ "whole names unless asked: {:?}",
+ h.app.widgets.iter().filter(|(w, _)| w.starts_with("keywordGroup")).collect::<Vec<_>>()
+ );
+ let whole = rect(&h, "keywordChip:Places|Italy|Rome").width();
+
+ h.app.ui.settings.keyword_chips = crate::state::KeywordChips::Grouped;
+ h.settle(SETTLE);
+ let heading = rect(&h, "keywordGroup:Places|Italy");
+ let (rome, venice) = (rect(&h, "keywordChip:Places|Italy|Rome"), rect(&h, "keywordChip:Places|Italy|Venice"));
+ assert!(rome.top() >= heading.bottom(), "under its heading: {rome:?} {heading:?}");
+ assert_eq!(rome.top(), venice.top(), "side by side");
+ assert!(rome.width() < whole, "the chip says only “Rome”: {} < {whole}", rome.width());
+ // a keyword that shares nothing has no heading and comes first
+ assert!(!has(&h, "keywordGroup:Transport") && !has(&h, "keywordGroup:"), "one keyword is no group");
+ assert!(rect(&h, "keywordChip:sea").top() < heading.top());
+ // the × still takes the whole keyword off both
+ ask(&mut h, "ui.clickWidget", json!({"id": "keywordChipRemove:Places|Italy|Rome"}));
+ assert!(ids.iter().all(|id| !keywords_of(&h, *id).iter().any(|k| k == "Places|Italy|Rome")));
+ assert!(ids.iter().all(|id| keywords_of(&h, *id).iter().any(|k| k == "Places|Italy|Venice")));
+}
+
+// Given sixteen keywords and the grouped box,
+// when the panel is drawn,
+// then eight lines show with "+N more" for the rest, which shows them all; "Show fewer" brings the
+// short list back. The Keyword List is nearer the top for it.
+#[test]
+fn a_long_grouped_list_is_shortened_until_asked_for() {
+ let (mut h, ids) = two_selected();
+ give(&mut h, &ids, &sixteen());
+ assert_eq!(count(&h, "keywordChip:"), 16, "whole names: every keyword, as before");
+ assert!(!has(&h, "keywordChipsMore"));
+ let list_before = rect(&h, "field:keywordFilter").top();
+
+ h.app.ui.settings.keyword_chips = crate::state::KeywordChips::Grouped;
+ h.settle(SETTLE);
+ assert_eq!(count(&h, "keywordChip:"), 7, "a heading and seven chips");
+ assert!(has(&h, "keywordChipsMore") && !has(&h, "keywordChipsFewer"));
+ assert!(rect(&h, "field:keywordFilter").top() < list_before - 80.0, "{} from {list_before}", rect(&h, "field:keywordFilter").top());
+
+ ask(&mut h, "ui.clickWidget", json!({"id": "keywordChipsMore"}));
+ assert_eq!(count(&h, "keywordChip:"), 16);
+ assert!(has(&h, "keywordChipsFewer") && !has(&h, "keywordChipsMore"));
+ ask(&mut h, "ui.clickWidget", json!({"id": "keywordChipsFewer"}));
+ assert_eq!(count(&h, "keywordChip:"), 7);
+}
+
+// Given the grouped box, chips stay inside the panel and never overlap, whatever their length.
+#[test]
+fn grouped_chips_stay_inside_the_panel() {
+ let (mut h, ids) = two_selected();
+ h.app.ui.settings.keyword_chips = crate::state::KeywordChips::Grouped;
+ let long = "Places|Portugal|Lisbon|Belém tower and the old town square on the river by the bridge";
+ let keywords: Vec<String> =
+ ["Events|Weddings", "Events|Birthdays", "sunset", "Places|Portugal|Porto", long].iter().map(|s| s.to_string()).collect();
+ give(&mut h, &ids, &keywords);
+ let panel = rect(&h, "panel:right_panel");
+ let chips: Vec<(String, egui::Rect)> = h.app.widgets.iter().filter(|(w, _)| w.starts_with("keywordChip:")).cloned().collect();
+ assert_eq!(chips.len(), 5, "{chips:?}");
+ for (i, (id, r)) in chips.iter().enumerate() {
+ assert!(r.left() >= panel.left() && r.right() <= panel.right(), "{id} inside the panel: {r:?} in {panel:?}");
+ for (other, o) in chips.iter().skip(i + 1) {
+ assert!(!r.intersects(o.shrink(0.5)), "{id} overlaps {other}");
+ }
+ }
+}
+
+// Given a selection without keywords, the box says so (as its other two views do).
+#[test]
+fn a_selection_without_keywords_says_so() {
+ let (mut h, ids) = two_selected();
+ give(&mut h, &ids, &[]);
+ assert!(has(&h, "keywordChipsEmpty"));
+ h.app.ui.settings.keyword_chips = crate::state::KeywordChips::Grouped;
+ h.settle(SETTLE);
+ assert!(has(&h, "keywordChipsEmpty"));
+}
+
+// Given the Keywords panel,
+// when the title of Keywording or of the Keyword List is clicked,
+// then that section folds shut and the other stays; a second click opens it, and what is folded is
+// kept with the interface's settings.
+#[test]
+fn the_sections_fold_by_their_titles() {
+ let (mut h, _) = two_selected();
+ assert!(has(&h, "field:keyword") && has(&h, "field:keywordFilter"));
+ let list_before = rect(&h, "field:keywordFilter").top();
+ ask(&mut h, "ui.clickWidget", json!({"id": "section:keywording"}));
+ assert!(!has(&h, "field:keyword") && !has(&h, "keywordChip:beach") && !has(&h, "kwSet:1"), "Keywording is shut");
+ assert!(has(&h, "field:keywordFilter"), "the Keyword List stays");
+ assert!(rect(&h, "field:keywordFilter").top() < list_before - 100.0);
+ let saved = serde_json::to_string(&h.app.ui).unwrap();
+ let back = serde_json::from_str::<crate::UiState>(&saved).unwrap().sanitized();
+ assert!(back.section_folded("keywording") && !back.section_folded("keywordList"));
+ assert!(!serde_json::from_str::<crate::UiState>("{}").unwrap().section_folded("keywording"), "settings from before: open");
+
+ ask(&mut h, "ui.clickWidget", json!({"id": "section:keywordList"}));
+ assert!(!has(&h, "field:keywordFilter") && !has(&h, "keywordCheck:beach"), "the Keyword List is shut");
+ ask(&mut h, "ui.clickWidget", json!({"id": "section:keywording"}));
+ ask(&mut h, "ui.clickWidget", json!({"id": "section:keywordList"}));
+ assert!(has(&h, "field:keyword") && has(&h, "field:keywordFilter") && has(&h, "keywordChip:beach"));
+}
+
+// Given the grouped box, the suggestions say only the keyword's own name (its whole path when two
+// of them have the same name) and still give the whole keyword.
+#[test]
+fn grouped_suggestions_name_the_keyword_alone() {
+ let (mut h, ids) = two_selected();
+ ask(&mut h, "engine.execute", json!({"command": "photo.setMeta", "params": {"ids": [ids[0]], "addKeywords": ["Places|Portugal|Lisbon"]}}));
+ let whole = rect(&h, "kwSuggest:Places|Portugal|Lisbon").width();
+ h.app.ui.settings.keyword_chips = crate::state::KeywordChips::Grouped;
+ h.settle(SETTLE);
+ assert!(rect(&h, "kwSuggest:Places|Portugal|Lisbon").width() < whole);
+ ask(&mut h, "ui.clickWidget", json!({"id": "kwSuggest:Places|Portugal|Lisbon"}));
+ assert!(ids.iter().all(|id| keywords_of(&h, *id).iter().any(|k| k == "Places|Portugal|Lisbon")));
+}
+
+/// Two photos selected (beach + Weddings, beach), and a third photo of the library, not selected,
+/// with Places|Portugal|Lisbon and Places|Portugal|Porto.
+fn with_places() -> (Headless, Vec<u64>) {
+ let (mut h, ids) = two_selected();
+ let third = h.app.session.visible_cloned().get(2).map(|p| p.0).expect("a third photo");
+ ask(
+ &mut h,
+ "engine.execute",
+ json!({"command": "photo.setMeta", "params": {"ids": [third], "keywords": ["Places|Portugal|Lisbon", "Places|Portugal|Porto"]}}),
+ );
+ (h, ids)
+}
+
+fn typed(h: &mut Headless, text: &str) {
+ ask(h, "ui.clickWidget", json!({"id": "field:keyword"}));
+ ask(h, "ui.text", json!({"text": text}));
+}
+
+fn all_have(h: &Headless, ids: &[u64], keyword: &str) -> bool {
+ ids.iter().all(|id| keywords_of(h, *id).iter().any(|k| k == keyword))
+}
+
+fn none_has(h: &Headless, ids: &[u64], keyword: &str) -> bool {
+ ids.iter().all(|id| !keywords_of(h, *id).iter().any(|k| k == keyword))
+}
+
+// Given a library with Places › Portugal › Lisbon,
+// when "lis" is typed in the Add keyword box,
+// then the keyword is offered right under the box, and the suggestions further down stay what
+// they were (they used to turn into the completions, a long way from the box).
+#[test]
+fn typing_offers_the_librarys_keywords_under_the_box() {
+ let (mut h, _) = with_places();
+ assert!(has(&h, "kwSuggest:Weddings"));
+ typed(&mut h, "lis");
+ let (field, offer) = (rect(&h, "field:keyword"), rect(&h, "kwComplete:Places|Portugal|Lisbon"));
+ assert!(offer.top() >= field.bottom() && offer.top() - field.bottom() < 12.0, "right under the box: {offer:?} {field:?}");
+ assert!(offer.left() >= field.left() - 1.0 && offer.right() <= field.right() + 1.0, "as wide as the box: {offer:?} {field:?}");
+ assert!(!has(&h, "kwComplete:Places|Portugal|Porto"), "only what matches");
+ assert!(has(&h, "kwSuggest:Weddings") && !has(&h, "kwSuggest:Places|Portugal|Lisbon"), "the suggestions stay");
+ // nothing typed, nothing offered
+ ask(&mut h, "ui.key", json!({"key": "Escape"}));
+ assert_eq!(count(&h, "kwComplete"), 0);
+}
+
+// Given the offers under the box,
+// when ↓ then Return are pressed,
+// then the highlighted keyword goes to every selected photo (not the letters typed), and the box
+// is empty and still has the cursor for the next keyword.
+#[test]
+fn down_and_return_give_the_offered_keyword() {
+ let (mut h, ids) = with_places();
+ typed(&mut h, "lis");
+ ask(&mut h, "ui.key", json!({"key": "ArrowDown"}));
+ assert!(has(&h, "kwCompleteAt:Places|Portugal|Lisbon"), "highlighted");
+ ask(&mut h, "ui.key", json!({"key": "Enter"}));
+ assert!(all_have(&h, &ids, "Places|Portugal|Lisbon"));
+ assert!(none_has(&h, &ids, "lis"), "the letters typed are not a keyword");
+ assert_eq!(count(&h, "kwComplete"), 0, "the box is empty again");
+ // still in the box: the next keyword is typed straight away
+ ask(&mut h, "ui.text", json!({"text": "harbour"}));
+ ask(&mut h, "ui.key", json!({"key": "Enter"}));
+ assert!(all_have(&h, &ids, "harbour"));
+}
+
+// Given the offers under the box, Return alone still gives what was typed, as it always did; ↑
+// from the first offer goes back to that.
+#[test]
+fn return_alone_gives_what_was_typed() {
+ let (mut h, ids) = with_places();
+ typed(&mut h, "lis");
+ ask(&mut h, "ui.key", json!({"key": "Enter"}));
+ assert!(all_have(&h, &ids, "lis") && none_has(&h, &ids, "Places|Portugal|Lisbon"));
+
+ typed(&mut h, "por");
+ ask(&mut h, "ui.key", json!({"key": "ArrowDown"}));
+ ask(&mut h, "ui.key", json!({"key": "ArrowUp"}));
+ assert_eq!(count(&h, "kwCompleteAt:"), 0, "none highlighted");
+ ask(&mut h, "ui.key", json!({"key": "Enter"}));
+ assert!(all_have(&h, &ids, "por") && none_has(&h, &ids, "Places|Portugal|Porto"));
+}
+
+// Given a name the library doesn't have,
+// when it is typed,
+// then the box says Return will create it (and inside which keyword, with a default parent); a
+// keyword the library has is not announced as new.
+#[test]
+fn a_new_name_is_announced_as_new() {
+ let (mut h, _) = with_places();
+ typed(&mut h, "Lisbn");
+ assert!(has(&h, "kwCompleteCreate"), "a misspelling is a new keyword: say so");
+ ask(&mut h, "ui.key", json!({"key": "Escape"}));
+ typed(&mut h, "weddings");
+ assert!(!has(&h, "kwCompleteCreate"), "the library has Weddings");
+ assert!(has(&h, "kwComplete:Weddings"), "one of the two lacks it");
+ ask(&mut h, "ui.key", json!({"key": "Escape"}));
+ typed(&mut h, "Places|Portugal");
+ assert!(!has(&h, "kwCompleteCreate"), "a keyword with keywords inside it is there too");
+}
+
+// Given the offers under the box, a click on one gives that keyword to the selected photos; a
+// click on the "create" line gives what was typed. Keywords typed before a comma go along.
+#[test]
+fn a_click_on_an_offer_gives_it() {
+ let (mut h, ids) = with_places();
+ typed(&mut h, "sea, lis");
+ assert!(has(&h, "kwComplete:Places|Portugal|Lisbon"), "the offers are for what follows the comma");
+ ask(&mut h, "ui.clickWidget", json!({"id": "kwComplete:Places|Portugal|Lisbon"}));
+ assert!(all_have(&h, &ids, "Places|Portugal|Lisbon") && all_have(&h, &ids, "sea") && none_has(&h, &ids, "lis"));
+
+ typed(&mut h, "harbour");
+ ask(&mut h, "ui.clickWidget", json!({"id": "kwCompleteCreate"}));
+ assert!(all_have(&h, &ids, "harbour"));
+}
+
+// Given more offers than there is room for, ↓ stops at the last and never runs off the list.
+#[test]
+fn the_highlight_stays_on_the_list() {
+ let (mut h, ids) = with_places();
+ typed(&mut h, "por");
+ for _ in 0..40 {
+ ask(&mut h, "ui.key", json!({"key": "ArrowDown"}));
+ }
+ let lit: Vec<String> = h.app.widgets.iter().filter_map(|(w, _)| w.strip_prefix("kwCompleteAt:").map(str::to_string)).collect();
+ assert_eq!(lit.len(), 1, "{lit:?}");
+ let offered = count(&h, "kwComplete:");
+ assert!(offered >= 2, "Portugal and Porto both match");
+ ask(&mut h, "ui.key", json!({"key": "Enter"}));
+ assert!(all_have(&h, &ids, &lit[0]), "the last offer, {}, was given", lit[0]);
+ assert!(none_has(&h, &ids, "por"));
+}
+
+fn toast(h: &Headless) -> String {
+ h.app.ui.toast.as_ref().map(|t| t.0.clone()).unwrap_or_default()
+}
+
+// Given several photos selected, the box says how many its keywords are of; with one photo there
+// is nothing to say.
+#[test]
+fn the_box_says_how_many_photos_it_is_for() {
+ let (mut h, ids) = two_selected();
+ assert!(has(&h, "keywordScope"), "two photos are selected");
+ assert!(rect(&h, "keywordScope").bottom() <= rect(&h, "keywordChip:beach").top(), "above the chips it is about");
+ ask(&mut h, "engine.execute", json!({"command": "library.select", "params": {"ids": [ids[0]]}}));
+ assert!(!has(&h, "keywordScope"), "one photo");
+}
+
+// The × is a target as tall as its chip and as wide as that, apart from the name next to it.
+#[test]
+fn the_cross_is_as_tall_as_its_chip() {
+ let (h, _) = two_selected();
+ let (name, cross) = (rect(&h, "keywordChip:beach"), rect(&h, "keywordChipRemove:beach"));
+ assert!(cross.height() >= 22.0 && cross.width() >= 22.0, "{cross:?}");
+ assert_eq!(cross.height(), name.height());
+ assert!(cross.left() >= name.right() - 0.5, "beside the name, not over it: {cross:?} {name:?}");
+}
+
+// Given a keyword on several selected photos,
+// when its × takes it off them,
+// then a message names the keyword and how many photos lost it and says how to get it back, and
+// Undo does. Taking a keyword off one photo says nothing: the chip going is enough.
+#[test]
+fn taking_a_keyword_off_several_photos_says_so_and_undo_puts_it_back() {
+ let (mut h, ids) = two_selected();
+ ask(&mut h, "ui.clickWidget", json!({"id": "keywordChipRemove:Weddings"}));
+ assert_eq!(toast(&h), "", "only one of the two had Weddings");
+ ask(&mut h, "ui.clickWidget", json!({"id": "keywordChipRemove:beach"}));
+ assert!(none_has(&h, &ids, "beach"));
+ let said = toast(&h);
+ assert!(said.contains("beach") && said.contains('2') && said.contains("Undo"), "{said}");
+ ask(&mut h, "engine.execute", json!({"command": "edit.undo", "params": {}}));
+ assert!(all_have(&h, &ids, "beach"), "one undo step puts it back on both");
+
+ // the menu's Remove from Selected Photos says the same
+ h.app.ui.toast = None;
+ ask(&mut h, "ui.clickWidget", json!({"id": "keywordChip:beach", "button": "right"}));
+ ask(&mut h, "ui.clickWidget", json!({"id": "keywordChipMenu:remove"}));
+ assert!(none_has(&h, &ids, "beach") && toast(&h).contains("beach"), "{}", toast(&h));
+}
+
+// Names of any length and script stay inside the panel in both layouts, and nothing breaks: a
+// name of 400 letters, one of emoji and right-to-left text, levels of one letter.
+#[test]
+fn any_name_fits_the_panel() {
+ let (mut h, ids) = two_selected();
+ let long = "x".repeat(400);
+ let keywords: Vec<String> =
+ vec![long.clone(), format!("a|{long}"), "🙂|العربية|שלום".into(), "🙂|العربية|مرحبا".into(), "a|b|c|d|e|f|g|h".into(), "İ|ı".into()];
+ give(&mut h, &ids, &keywords);
+ for layout in [crate::state::KeywordChips::Paths, crate::state::KeywordChips::Grouped] {
+ h.app.ui.settings.keyword_chips = layout;
+ h.settle(SETTLE);
+ let panel = rect(&h, "panel:right_panel");
+ let chips: Vec<(String, egui::Rect)> = h.app.widgets.iter().filter(|(w, _)| w.starts_with("keywordChip:")).cloned().collect();
+ assert_eq!(chips.len(), keywords.len(), "{layout:?}");
+ for (id, r) in &chips {
+ assert!(
+ r.left() >= panel.left() && r.right() <= panel.right(),
+ "{layout:?}: {} inside the panel: {r:?}",
+ id.chars().take(40).collect::<String>()
+ );
+ assert!(r.width() > 0.0 && r.height() < 30.0);
+ }
+ }
+ // and typing them offers them without trouble: the photos here all have them, so another
+ // photo's emoji keyword is what is offered
+ let next = others(&mut h);
+ ask(&mut h, "engine.execute", json!({"command": "photo.setMeta", "params": {"ids": [next[0]], "keywords": ["🙂|العربية|سلام"]}}));
+ typed(&mut h, &"x".repeat(300));
+ ask(&mut h, "ui.key", json!({"key": "Escape"}));
+ typed(&mut h, "🙂");
+ assert!(has(&h, "kwComplete:🙂|العربية|سلام"), "{:?}", h.app.widgets.iter().filter(|(w, _)| w.starts_with("kwComplete")).collect::<Vec<_>>());
+}
+
+fn lit(h: &Headless) -> Vec<String> {
+ h.app.widgets.iter().filter_map(|(w, _)| w.strip_prefix("kwCompleteAt:").map(str::to_string)).collect()
+}
+
+/// Ids of the library's photos after the two selected ones.
+fn others(h: &mut Headless) -> Vec<u64> {
+ h.app.session.visible_cloned().iter().skip(2).take(4).map(|p| p.0).collect()
+}
+
+// Given a long grouped list shown whole after "+N more",
+// when other photos with a long list are selected,
+// then theirs is short again: asking for more was for the photos it was asked of.
+#[test]
+fn asking_for_more_is_for_the_selection_it_was_asked_of() {
+ let (mut h, ids) = two_selected();
+ h.app.ui.settings.keyword_chips = crate::state::KeywordChips::Grouped;
+ give(&mut h, &ids, &sixteen());
+ let next = others(&mut h);
+ give(&mut h, &next, &sixteen());
+ ask(&mut h, "ui.clickWidget", json!({"id": "keywordChipsMore"}));
+ assert_eq!(count(&h, "keywordChip:"), 16);
+ // taking a keyword off keeps the list whole: it is still theirs
+ ask(&mut h, "engine.execute", json!({"command": "photo.setMeta", "params": {"ids": ids, "removeKeywords": [sixteen()[15]]}}));
+ assert_eq!(count(&h, "keywordChip:"), 15);
+ ask(&mut h, "engine.execute", json!({"command": "library.select", "params": {"ids": next}}));
+ assert_eq!(count(&h, "keywordChip:"), 7, "short again");
+ assert!(has(&h, "keywordChipsMore") && !has(&h, "keywordChipsFewer"));
+}
+
+// Given a keyword two photos spell differently (Lisbon, lisbon),
+// when it is typed,
+// then it is offered once, and a click gives it.
+#[test]
+fn a_keyword_spelled_two_ways_is_offered_once() {
+ let (mut h, ids) = two_selected();
+ let next = others(&mut h);
+ ask(&mut h, "engine.execute", json!({"command": "photo.setMeta", "params": {"ids": [next[0]], "keywords": ["Lisbon"]}}));
+ ask(&mut h, "engine.execute", json!({"command": "photo.setMeta", "params": {"ids": [next[1]], "keywords": ["lisbon"]}}));
+ typed(&mut h, "lis");
+ let offered: Vec<String> = h.app.widgets.iter().filter(|(w, _)| w.starts_with("kwComplete:")).map(|(w, _)| w.clone()).collect();
+ assert_eq!(offered.len(), 1, "{offered:?}");
+ ask(&mut h, "ui.clickWidget", json!({"id": offered[0]}));
+ assert!(ids.iter().all(|id| keywords_of(&h, *id).iter().any(|k| k.eq_ignore_ascii_case("lisbon"))));
+}
+
+// Given a highlighted offer,
+// when the library changes under it and the offers come in another order,
+// then the highlight is still on that keyword (it used to stay on the line, and Return gave
+// whatever keyword had moved there).
+#[test]
+fn the_highlight_stays_with_its_keyword() {
+ let (mut h, ids) = with_places();
+ typed(&mut h, "por");
+ ask(&mut h, "ui.key", json!({"key": "ArrowDown"}));
+ let before = lit(&h);
+ assert_eq!(before.len(), 1);
+ let next = others(&mut h);
+ ask(&mut h, "engine.execute", json!({"command": "photo.setMeta", "params": {"ids": next, "addKeywords": ["Portraits"]}}));
+ assert!(has(&h, "kwComplete:Portraits"), "the offers changed");
+ assert_eq!(lit(&h), before, "the highlight did not move to another keyword");
+ ask(&mut h, "ui.key", json!({"key": "Enter"}));
+ assert!(all_have(&h, &ids, &before[0]) && none_has(&h, &ids, "Portraits"));
+}
+
+// Given an offer taken with ↓ and Return, Esc afterwards does not bring back the keywords that
+// were just added: the box stays empty.
+#[test]
+fn escape_after_an_offer_keeps_the_box_empty() {
+ let (mut h, ids) = with_places();
+ typed(&mut h, "sea");
+ ask(&mut h, "ui.key", json!({"key": "Tab"}));
+ ask(&mut h, "ui.clickWidget", json!({"id": "field:keyword"}));
+ ask(&mut h, "ui.key", json!({"key": "End"}));
+ ask(&mut h, "ui.text", json!({"text": ", lis"}));
+ ask(&mut h, "ui.key", json!({"key": "ArrowDown"}));
+ ask(&mut h, "ui.key", json!({"key": "Enter"}));
+ assert!(all_have(&h, &ids, "sea") && all_have(&h, &ids, "Places|Portugal|Lisbon"));
+ ask(&mut h, "ui.key", json!({"key": "Escape"}));
+ ask(&mut h, "ui.clickWidget", json!({"id": "field:keyword"}));
+ ask(&mut h, "ui.key", json!({"key": "End"}));
+ ask(&mut h, "ui.text", json!({"text": "x"}));
+ ask(&mut h, "ui.key", json!({"key": "Enter"}));
+ assert!(all_have(&h, &ids, "x") && none_has(&h, &ids, "seax"), "{:?}", keywords_of(&h, ids[0]));
+}
+
+// ↓ / ↑ / Return with Shift or Alt held are the text box's own (select to the start of the text):
+// they leave the offers alone.
+#[test]
+fn modified_arrows_are_the_text_boxs() {
+ let (mut h, ids) = with_places();
+ typed(&mut h, "por");
+ ask(&mut h, "ui.key", json!({"key": "ArrowDown", "shift": true}));
+ assert!(lit(&h).is_empty(), "Shift+↓ highlights nothing: {:?}", lit(&h));
+ ask(&mut h, "ui.key", json!({"key": "ArrowDown"}));
+ ask(&mut h, "ui.key", json!({"key": "ArrowDown"}));
+ let before = lit(&h);
+ ask(&mut h, "ui.key", json!({"key": "ArrowUp", "shift": true}));
+ assert_eq!(lit(&h), before);
+ let _ = ids;
+}
+
+// Given the box scrolled out of the panel with the cursor still in it, its offers are not drawn
+// (they used to float over the top bar, where Return still took one).
+#[test]
+fn offers_go_when_the_box_scrolls_out_of_sight() {
+ let (mut h, ids) = with_places();
+ give(&mut h, &ids, &sixteen());
+ typed(&mut h, "lis");
+ assert!(has(&h, "kwComplete:Places|Portugal|Lisbon"));
+ let panel = rect(&h, "panel:right_panel");
+ ask(&mut h, "ui.move", json!({"x": panel.center().x, "y": panel.center().y}));
+ for _ in 0..8 {
+ ask(&mut h, "ui.scroll", json!({"dy": -400.0}));
+ }
+ assert!(rect(&h, "field:keyword").bottom() < panel.top(), "scrolled out: {:?}", rect(&h, "field:keyword"));
+ assert_eq!(count(&h, "kwComplete"), 0);
+}
+
+// Settings files with something else under the two new keys keep every other setting (and these
+// two at their defaults): a wrong value used to discard the whole file.
+#[test]
+fn wrong_values_for_the_new_settings_keep_the_rest() {
+ let ui: crate::UiState = serde_json::from_str(r#"{"foldedSections": "oops", "rightWidth": 300.0}"#).unwrap();
+ assert!(!ui.section_folded("keywording") && ui.right_width == 300.0);
+ let ui: crate::UiState =
+ serde_json::from_str(r#"{"foldedSections": [1, "keywordList", null], "settings": {"keywordChips": "bogus", "filmNames": false}}"#).unwrap();
+ assert!(ui.section_folded("keywordList") && !ui.section_folded("keywording"));
+ assert_eq!(ui.settings.keyword_chips, crate::state::KeywordChips::Paths);
+ assert!(!ui.settings.film_names, "the other settings are read");
+ let ui: crate::UiState = serde_json::from_str(r#"{"settings": {"keywordChips": "grouped"}}"#).unwrap();
+ assert_eq!(ui.settings.keyword_chips, crate::state::KeywordChips::Grouped);
+}
+
+// Given an offer taken with ↓ and Return,
+// when the panel is switched away at once and comes back much later,
+// then the box does not take the cursor unasked: keys typed then are not the box's.
+#[test]
+fn an_offer_taken_does_not_claim_the_cursor_later() {
+ let (mut h, ids) = with_places();
+ typed(&mut h, "lis");
+ ask(&mut h, "ui.key", json!({"key": "ArrowDown"}));
+ // (Return and the switch on consecutive frames, as a script does them)
+ let r = h.request("ui.key", json!({"key": "Enter"}), T);
+ assert_eq!(r["ok"], true, "{r}");
+ ask(&mut h, "ui.set", json!({"right": "info"}));
+ assert!(all_have(&h, &ids, "Places|Portugal|Lisbon"));
+ ask(&mut h, "ui.set", json!({"right": "keywords"}));
+ ask(&mut h, "ui.text", json!({"text": "zz"}));
+ ask(&mut h, "ui.key", json!({"key": "Enter"}));
+ assert!(none_has(&h, &ids, "zz"), "typed with the cursor nowhere: {:?}", keywords_of(&h, ids[0]));
+}
+
+// Given a highlighted offer and the box scrolled out of sight, Return gives nothing: what isn't
+// drawn can't be taken, not even on the frame the box leaves.
+#[test]
+fn an_offer_out_of_sight_is_not_taken() {
+ let (mut h, ids) = with_places();
+ give(&mut h, &ids, &sixteen());
+ typed(&mut h, "lis");
+ ask(&mut h, "ui.key", json!({"key": "ArrowDown"}));
+ let panel = rect(&h, "panel:right_panel");
+ ask(&mut h, "ui.move", json!({"x": panel.center().x, "y": panel.center().y}));
+ for _ in 0..8 {
+ // the wheel and Return together, frame after frame
+ let r = h.request("ui.scroll", json!({"dy": -400.0}), T);
+ assert_eq!(r["ok"], true, "{r}");
+ if rect(&h, "field:keyword").bottom() < panel.top() {
+ let r = h.request("ui.key", json!({"key": "Enter"}), T);
+ assert_eq!(r["ok"], true, "{r}");
+ }
+ }
+ h.settle(SETTLE);
+ ask(&mut h, "ui.key", json!({"key": "Enter"}));
+ assert!(none_has(&h, &ids, "Places|Portugal|Lisbon"), "{:?}", keywords_of(&h, ids[0]));
+}
+
+// Given a window too short for the offers under the box, they never cover the box being typed
+// in: they go where there is more room and show as many lines as fit there.
+#[test]
+fn offers_never_cover_the_box() {
+ for height in [1000.0, 420.0, 300.0, 230.0, 180.0] {
+ let app = LightcraftApp::new(lightcraft_engine::Session::with_demo(), Services { png: None, ..Default::default() });
+ let mut h = Headless::new(app, [1400.0, height], 1.0);
+ let ids: Vec<u64> = h.app.session.visible_cloned().iter().take(12).map(|p| p.0).collect();
+ ask(&mut h, "ui.set", json!({"view": "photoGrid", "right": "keywords"}));
+ // nine keywords to offer for "pa", on photos that are not selected
+ let many: Vec<String> = (1..=9).map(|i| format!("Parks|park {i}")).collect();
+ ask(&mut h, "engine.execute", json!({"command": "photo.setMeta", "params": {"ids": &ids[2..], "keywords": many}}));
+ ask(&mut h, "engine.execute", json!({"command": "library.select", "params": {"ids": &ids[..2]}}));
+ typed(&mut h, "pa");
+ let field = rect(&h, "field:keyword");
+ let offers: Vec<egui::Rect> = h.app.widgets.iter().filter(|(w, _)| w.starts_with("kwComplete")).map(|(_, r)| *r).collect();
+ assert!(!offers.is_empty(), "{height}: something is offered");
+ for r in &offers {
+ assert!(!r.intersects(field.shrink(0.5)), "{height}: an offer at {r:?} covers the box at {field:?}");
+ assert!(r.top() >= -0.5 && r.bottom() <= height + 0.5, "{height}: an offer at {r:?} is off the window");
+ }
+ // ↓ still reaches every offer drawn, and the highlighted one is among them
+ for _ in 0..12 {
+ ask(&mut h, "ui.key", json!({"key": "ArrowDown"}));
+ assert_eq!(lit(&h).len(), 1, "{height}");
+ }
+ }
+}
++
+ /// Rename Keyword's "used by n photos" and Create Smart Album's live count scan the library once
+ /// per change to it, not every frame the dialog is open.
+ #[test]
+ fn open_dialogs_count_once_per_library_change() {
+ let (mut h, ids) = two_selected();
+ h.app.ui.dialog = Some(crate::state::Dialog::RenameKeyword { from: "beach".into(), to: "beach".into() });
+ let before = h.app.caches.dialog_count_scans;
+ for _ in 0..10 {
+ h.step();
+ }
+ assert_eq!(h.app.caches.dialog_count_scans, before + 1, "unchanged frames reuse the count");
+ ask(&mut h, "engine.execute", json!({"command": "photo.setMeta", "params": {"ids": [ids[1]], "keywords": ["sea"]}}));
+ h.step();
+ assert_eq!(h.app.caches.dialog_count_scans, before + 2, "a library change counts again");
+ h.app.ui.dialog = Some(crate::state::Dialog::NewSmartAlbum { name: "Beach".into(), parent: None });
+ for _ in 0..10 {
+ h.step();
+ }
+ assert_eq!(h.app.caches.dialog_count_scans, before + 3, "another dialog counts its own photos, once");
+ }
diff --cc docs/gaps.md
index 68c2595e2,325c7939e..d99003ed7
--- a/docs/gaps.md
+++ b/docs/gaps.md
@@@ -1,6 -1,6 +1,6 @@@
# Gaps: where LightCraft falls short of Lightroom
- > **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-14 · **Change:** minor (catalog import result, offline Local promotion and reduced copies; gap 8: Nikon Z 6II / Z 8 / Z f in-file distortion; gaps 10, 22 and 23 listed once again: merges had left two copies of each, and `cargo xtask parity` now fails on a gap listed twice)
-> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-11 · **Change:** minor (CR3 entry names the EOS R7 C-RAW fix and the refused CRX variants; CI and Windows / Linux entries note the 0.6.0 riscv64 build; camera colour: tone curve from black-and-white camera JPEGs; Compare and Reference get sharp zoom windows; gap 4 shrinks; gap 14: the HDR switch is read from crs XMP; gaps 2 and 10: EOS R5 Mark II CR3 verified; gap 26: stack and album lookups indexed at 100k photos) · **Target:** Adobe Lightroom Classic 15.5 / Lightroom 9.6
++> **Last reviewed:** 2026-10-11 · **Last updated:** 2026-10-14 · **Change:** minor (catalog import result, offline Local promotion and reduced copies; gap 8: Nikon Z 6II / Z 8 / Z f in-file distortion; gaps 10, 22 and 23 listed once again: merges had left two copies of each, and `cargo xtask parity` now fails on a gap listed twice; gap 26: stack and album lookups indexed at 100k photos)
Every known shortfall, one entry each, ranked by user impact (how many Lightroom users hit it, and
how hard it blocks them), then by effort. **Agents pick work from the top** (the first entry nobody is
@@@ -35,14 -35,13 +35,14 @@@ Hours are Opus 5.5 agent wall-clock hou
| 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) |
| 19 | **Plug-in ecosystem**: no Lightroom SDK equivalent (export / publish plug-ins, metadata plug-ins) | ⬜ | pro workflows built on plug-ins (LR/Enfuse, Jeffrey's exporters, Negative Lab Pro) | 40–80 + owner decision | [target-app-parity](target-app-parity.md#by-dimension) |
| 20 | **Long-tail raw formats**: compressed SRW, ARQ pixel shift, IIQ, Hasselblad compression, X3F, CRW, MRW, ERF, KDC, DCR, MEF, GPR, old FinePix | raw-parity.md | small user share each | 45–85 | [raw-parity](raw-parity.md) |
-| 21 | **Localization**: 9 of 15 shipped languages partial (74–99% of catalog messages), lower-layer errors English; Hindi, Arabic, Indonesian, Korean, Vietnamese absent; no RTL or complex shaping | measured from catalogs | non-English users see mixed English | 55–90 (shipped to full); 145–255 (five new) | [localization-parity](localization-parity.md) |
-| 22 | **Pen pressure**, OS monitor profiles, follow-window colour | hardware-parity.md | brush users with tablets; multi-monitor setups | 11–22 | [hardware-parity](hardware-parity.md) |
-| 23 | **Accessibility** audit with screen readers; canvas tools keyboard-reachable | LR-BEHAV-ACCESS 🟡 | blind and low-vision users | 10–20 | [ui-parity](ui-parity.md) |
+| 21 | **Localization**: 9 of 15 shipped languages partial (de, es, fr, ja, uk now 97–99% of catalog messages, awaiting native review; pt-BR, ru, zh-hans, zh-hant 74–92%), lower-layer errors English; Hindi, Arabic, Indonesian, Korean, Vietnamese absent; no RTL or complex shaping | measured from catalogs | non-English users see mixed English | 40–70 (shipped to full); 145–255 (five new) | [localization-parity](localization-parity.md) |
+| 23 | **Accessibility**: AccessKit tree audited by a test (every control named, sliders with range); left: canvas handles, spot and mask placement by keyboard, a session with a real screen reader | LR-BEHAV-ACCESS 🟡 | blind and low-vision users | 4–8 | [ui-parity](ui-parity.md) |
+| 22 | **Pen pressure on macOS / Linux tablets** (brush size and flow follow pressure where winit reports a pen force), OS monitor profiles on Windows (Linux reads colord's, macOS the screen's), follow-window colour on Linux / Windows | hardware-parity.md | brush users with tablets; multi-monitor setups | 11–22 | [hardware-parity](hardware-parity.md) |
| 24 | **Brush live preview and masking feel** (#517, #518); Feather / Edge mask refinement (15.5) | issues | masking feels slower than Lightroom | 8–12 | [ui-parity](ui-parity.md) |
-| 25 | **File writes**: lossy DNG, Render to DNG; AVIF import (PSD export landed with Edit in PhotoCraft, #953) | file-format-parity.md | interchange edge cases | 21–37 | [file-format-parity](file-format-parity.md) |
+| 25 | **File writes**: AVIF import; Render to DNG as a catalog command (lossy DNG and the Render to DNG export format landed) (PSD export landed with Edit in PhotoCraft, #953) | file-format-parity.md | interchange edge cases | 19–34 | [file-format-parity](file-format-parity.md) |
- | 26 | **Performance at scale**: 85k-photo library opens in 1.7–4.7 s; 100k grid test pending; colour NR at half resolution | ROADMAP log, gpu-pipeline.md | large-catalog users | 15–30 | [target-app-parity](target-app-parity.md#by-dimension) |
+ | 26 | **Performance at scale**: 85k-photo library opens in 1.7–4.7 s; 100k grid test pending; colour NR at half resolution; at 100k photos stack and album lookups are indexed (an "In a Stack" or "Album" smart album counts in ~14 ms, was 0.6–2.7 s) | ROADMAP log, gpu-pipeline.md | large-catalog users | 15–30 | [target-app-parity](target-app-parity.md#by-dimension) |
-| 27 | **Windows / Linux runtime coverage**: Windows installer UI unverified on Windows (#79); GPU path proven on Apple only; the Linux riscv64 tarball (new in 0.6.0, #844) is cross-compiled and never run beyond a QEMU smoke test | ROADMAP, issues, `release.yml` | non-Mac users find bugs first | 15–30 | [hardware-parity](hardware-parity.md) |
+| 27 | **Windows / Linux runtime coverage**: Windows installer UI unverified on Windows (#79); GPU path proven on Apple and on one AMD GPU on Linux (Radeon 8060S, Vulkan); NVIDIA, Intel and DX12 unverified; the Linux riscv64 tarball (new in 0.6.0, #844) is cross-compiled and never run beyond a QEMU smoke test | ROADMAP, issues, `release.yml` | non-Mac users find bugs first | 13–27 | [hardware-parity](hardware-parity.md) |
+| 29 | **HDR merge leftovers** (LR-MERGE-HDR): AI Denoise doesn't run on merged (linear) DNGs; JPEG brackets are treated as linear (no camera response curve); every frame is held as 32-bit float, ~0.86 GB per 67 MP frame (half-float frames would halve it) | tested on Sony A7R VI brackets 2026-10-14 ([merge.md](merge.md)); Lightroom's Denoise supports HDR DNGs | HDR shooters who denoise their merges, merge JPEGs, or merge 7+ frames of high-resolution raws on 16 GB machines | 10–20 (+ denoise linear-RGB contract, gap 11) | [merge](merge.md) |
| 28 | **Small Classic shortcuts and keys**: rating `[` `]`, flag cycling, filter-bar keys, F1 help, panel keys (Tab, F5–F8) | [ui-parity](ui-parity.md#shortcuts) | Classic muscle memory | 4–8 | [ui-parity](ui-parity.md) |
Beta-blocking gaps (B) total **~230–430 h**; with the stability and platform work they need around them,
@@@ -75,29 -72,7 +75,30 @@@
| Date | Change | Summary |
|---|---|---|
-| 2026-10-11 | 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 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 21: de, es, fr, ja and uk catalogs filled (97–99%); 55–90 h → 40–70 h |
+| 2026-10-14 | minor | Gap 10: 17 uncompressed Olympus and Samsung models verified on one CC0 file each (254 models) |
+| 2026-10-14 | minor | Gap 29 added: the HDR merge, tested on real 67 MP brackets, keeps moving clipped highlights and merges in batches now; AI Denoise on merged DNGs, JPEG response curves and per-frame memory remain |
+| 2026-10-13 | patch | Gaps 10, 22 and 23 each had two rows (two branches edited them; the merges kept both): the older copies are removed, and `cargo xtask parity` (in `ci`) now fails when a gap number is listed twice |
+| 2026-10-13 | minor | Closed recently: Sony ILCA-99M2 profile |
+| 2026-10-14 | minor | Gap 10: 21 Sony and Leica models verified on one CC0 file each (258 models) |
+| 2026-10-12 | minor | Gap 20 shrinks: Mamiya MEF decodes (`vendor/mef.rs`) and is imported; gap 10 count 240 → 241 |
+| 2026-10-12 | minor | Gap 20 shrinks: Epson ERF decodes (`vendor/erf.rs`), 3 bodies verified; gap 10 count 237 → 240 |
+| 2026-10-13 | minor | Gap 28: F6 (filmstrip) and F7 (left panel) are bound, so the entry no longer lists them as missing; hours unchanged |
+| 2026-10-11 | minor | Gap 10 shrinks: Leica Q3 verified by a recorded check of 38 private DNGs (236 models verified; Leica 14); gap not closed |
+| 2026-10-12 | minor | Camera-look deep shadows follow the JPEG toe (#1307); camera calibration remains partial |
+| 2026-10-12 | minor | Gap 23 (accessibility): crop handles, spots, gradient handles and mask pins by keyboard; 4–8 h → 2–4 h; gap not closed |
+| 2026-10-12 | minor | Gap 23 (accessibility): the AccessKit tree audit and its fixes landed; what is left is canvas placement by keyboard and a real screen-reader session; 10–20 h → 4–8 h; gap not closed |
+| 2026-10-12 | minor | Gap 22: Linux previews use the display profile from colord |
+| 2026-10-12 | minor | Gap 27: the CPU ↔ GPU equivalence suite passes on an AMD Radeon 8060S (Vulkan, Linux), the first non-Apple GPU verified; 15–30 h → 13–27 h; gap not closed |
+| 2026-10-12 | minor | Gap 25: Render to DNG lands as an export format; lossy DNG and AVIF import remain |
+| 2026-10-12 | minor | Gap 10 shrinks: the Hasselblad Lunar (a Sony NEX-7 ARW under its own Make) decodes and is verified, 236 models (#1275) |
+| 2026-10-12 | minor | Gap 14: HLG AVIF export (`hdrTransfer`) and a tested SDR/HDR display decision |
+| 2026-10-12 | minor | Gap 25: lossy DNG export (DNG compression 34892) lands; AVIF import and Render to DNG as a catalog command remain |
+| 2026-10-12 | minor | Gap 22: pen pressure scales brush size and flow (Brush ▸ Pen Pressure) where winit reports a pen force |
+| 2026-10-12 | minor | Gaps 2 and 10 shrink: 22 more CR3 bodies verified on one CC0 file each (every CC0 CR3 on raw.pixls.us decodes), EOS R6 Mark III white balance read; Canon 34 verified, 259 models, ~59% on a verified body; CR3 gain +6.2 → +0.3 points |
+| 2026-10-12 | minor | Gap 10 shrinks: 117 Nikon and Fujifilm bodies verified on one CC0 file each (354 models, ~58% on a verified body); COOLPIX 5700 / 8400 / 8800 decode wrongly; #702 is fixed |
+| 2026-10-11 | minor | Nikon edge bars on bodies without CropArea fixed for 36 model / size / depth groups (#976, #914; [nikon-bodies.md](nikon-bodies.md)); gap 10 notes the survey and the pending bodies; gap not closed |
| 2026-10-11 | minor | Reviewed against main after 0.6.0: CR3 entry names the CRX variants `crx.rs` still refuses and the R7 / R6 Mark II C-RAW state (decoding, not verified, so the measured numbers don't move); CI and Windows / Linux entries note the riscv64 release build (#844); R7 fix added to Closed recently. Panel docking (UI.9, #869) closes no listed gap |
| 2026-10-11 | minor | Camera colour entry: raws with a black-and-white camera JPEG take its tone curve (#577); gap not closed |
| 2026-10-11 | minor | Gap 4: Compare and Reference views get zoom windows per pane (1:1 was a 2,560 px render magnified); overlays and soft proofing remain, 8–15 h → 4–8 h |