Skip to content

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

Merge PR #1135

Brandon Thomas9ca3cd0926b7
diff --cc AGENTS.md
index 297682755,3d615d00c..c9f54b71d
--- a/AGENTS.md
+++ b/AGENTS.md
@@@ -129,10 -132,11 +132,11 @@@ of it. Full standard: `../craftrules/st
## Map of the code
`geom`, `color`, `raster`, `tiff` (L0) → `raw`, `codecs`, `meta`, `develop` (L1) → `pipeline` → `catalog` → `engine`
→ `ui-egui`, `mcp` (L5) → apps `lightcraft` (desktop), `lightcraft-cli` (render/commands/MCP). `scenes` generates demo
- photos. `xtask` = tooling (`ci`, `layers`, `assets`, `parity`, `wasm`, `corpus`, `stats`). `flake.nix` +
+ photos. `xtask` = tooling (`ci`, `layers`, `assets`, `parity`, `wasm`, `corpus`, `stats`); `testkit` = test helpers
+ (dev-dependency only). `flake.nix` +
`nix/package.nix` = the Nix package (`nix build` builds both binaries with the craft-fonts input, installs the
-desktop file/icons/AppStream metadata and runs `cargo test --workspace`; `nix develop` = dev shell). Community-maintained and not
-in CI: it may lag behind the workspace; see README → Quick start.
+desktop file/icons/AppStream metadata and runs `cargo test --workspace`; `nix develop` = dev shell). Community-maintained; CI only
+evaluates it (`.github/workflows/nix.yml`), so the build may lag behind the workspace; see README → Quick start.
## Contributor credits (About window)
diff --cc CLAUDE.md
index 5b4702cdb,5596bb95f..00a2314aa
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@@ -137,7 -139,8 +140,8 @@@ of it. Full standard: `../craftrules/st
## Map of the code
`geom`, `color`, `raster`, `tiff` (L0) → `raw`, `codecs`, `meta`, `develop` (L1) → `pipeline` → `catalog` → `engine`
→ `ui-egui`, `mcp` (L5) → apps `lightcraft` (desktop), `lightcraft-cli` (render/commands/MCP). `scenes` generates demo
- photos. `xtask` = tooling (`ci`, `layers`, `assets`, `parity`, `wasm`, `corpus`, `stats`). `flake.nix` +
+ photos. `xtask` = tooling (`ci`, `layers`, `assets`, `parity`, `wasm`, `corpus`, `stats`); `testkit` = test helpers
+ (dev-dependency only). `flake.nix` +
`nix/package.nix` = the Nix package (`nix build` builds both binaries with the craft-fonts input, installs the
-desktop file/icons/AppStream metadata and runs `cargo test --workspace`; `nix develop` = dev shell). Community-maintained and not
-in CI: it may lag behind the workspace; see README → Quick start.
+desktop file/icons/AppStream metadata and runs `cargo test --workspace`; `nix develop` = dev shell). Community-maintained; CI only
+evaluates it (`.github/workflows/nix.yml`), so the build may lag behind the workspace; see README → Quick start.
diff --cc Cargo.lock
index db6efd50e,43d5f119c..fbfb7fc0f
--- a/Cargo.lock
+++ b/Cargo.lock
@@@ -3239,7 -3241,7 +3241,8 @@@ dependencies =
"lightcraft-raw",
"lightcraft-scenes",
"lightcraft-segment",
+ "lightcraft-slideshow",
+ "lightcraft-testkit",
"lightcraft-tiff",
"log",
"miniz_oxide 0.8.9",
@@@ -3253,8 -3255,9 +3256,9 @@@
[[package]]
name = "lightcraft-faces"
-version = "0.6.0"
+version = "0.8.0"
dependencies = [
+ "lightcraft-testkit",
"matrixmultiply",
"ndarray",
"proptest",
@@@ -3461,22 -3467,17 +3468,26 @@@ dependencies =
"thiserror 2.0.21",
]
+[[package]]
+name = "lightcraft-slideshow"
+version = "0.8.0"
+dependencies = [
+ "lightcraft-raster",
+ "serde",
+ "serde_json",
+]
+
[[package]]
name = "lightcraft-sysmem"
-version = "0.6.0"
+version = "0.8.0"
+ [[package]]
+ name = "lightcraft-testkit"
-version = "0.6.0"
++version = "0.8.0"
+
[[package]]
name = "lightcraft-tiff"
-version = "0.6.0"
+version = "0.8.0"
dependencies = [
"proptest",
"serde",
@@@ -3503,7 -3504,7 +3514,8 @@@ dependencies =
"lightcraft-pipeline",
"lightcraft-preview",
"lightcraft-raster",
+ "lightcraft-slideshow",
+ "lightcraft-testkit",
"log",
"serde",
"serde_json",
diff --cc Cargo.toml
index de985d654,feaee1d54..11bc55c6e
--- a/Cargo.toml
+++ b/Cargo.toml
@@@ -39,7 -39,7 +39,8 @@@ lightcraft-fetch = { path = "crates/fet
lightcraft-heif = { path = "crates/heif" }
lightcraft-segment = { path = "crates/segment" }
lightcraft-geocode = { path = "crates/geocode" }
+lightcraft-slideshow = { path = "crates/slideshow" }
+ lightcraft-testkit = { path = "crates/testkit" }
# foundation
thiserror = "2"
diff --cc README.md
index 1d4a96197,6f9ff1cba..500a28256
--- a/README.md
+++ b/README.md
@@@ -370,31 -370,13 +370,38 @@@ per CPU, otherwise exhaust RAM before a
`CARGO_PROFILE_DEV_DEBUG`, `CARGO_BUILD_JOBS` and `RUST_TEST_THREADS` settings
override these defaults. Ordinary development commands keep their own settings.
+**Release builds on memory-constrained machines:** [#1196](https://github.com/storytold/lightcraft/issues/1196)
+reports Arch/AUR release-link OOM kills on a 16 GB machine when the desktop and CLI build concurrently
+with full debug information, thin LTO and one codegen unit. The CI defaults above do not apply to
+ordinary `cargo build --release`. Start with one job; two may be suitable if enough memory is available:
+
+```sh
+CARGO_BUILD_JOBS=1 cargo build --release -p lightcraft -p lightcraft-cli
+# Alternatively: CARGO_BUILD_JOBS=2 cargo build --release -p lightcraft -p lightcraft-cli
+```
+
+If a packaging environment enables full debug information or memory-heavy LTO settings, use
+command-local overrides for a lower-memory source build:
+
+```sh
+CARGO_BUILD_JOBS=1 CARGO_PROFILE_RELEASE_DEBUG=0 CARGO_PROFILE_RELEASE_LTO=false CARGO_PROFILE_RELEASE_CODEGEN_UNITS=16 cargo build --release -p lightcraft -p lightcraft-cli
+```
+
+These POSIX-shell assignments affect only this command, not global Cargo configuration or the
+repository's release profiles. Disabling LTO may change performance and binary size; disabling debug
+information reduces debugging detail. This is build guidance, not a guarantee that any machine has
+enough memory. Downstream packagers should serialize large binary builds and avoid full debug
+information combined with LTO and one codegen unit on low-memory builders. A PKGBUILD that exports
+its own profile settings can override inherited variables; adjust the packaging recipe locally or
+contact its maintainer rather than assuming an environment prefix on `makepkg` will take precedence.
+
+ Tests that need a GPU, the corpus, the craft-fonts faces or a model pass without checking anything when
+ those are missing (libtest has no "skipped" status), so `cargo xtask ci` lists them: tests record a skip
+ with `lightcraft_testkit::skip!`, and the run ends with what the machine offered (OS, CPUs, RAM, GPU
+ adapters per backend, corpus, fonts) and every skip by reason. It writes `target/ci/report.json` and
+ `target/ci/summary.md`, a block to paste into a PR (`--summary-md` prints it); `--hardware` also runs the
+ GPU tests on every backend that has a hardware adapter. Nothing is uploaded.
+
**Chinese and Japanese text** need the shared font repo, an optional build input (official releases always include it):
```sh
diff --cc crates/raw/Cargo.toml
index 5b1706bde,84f9fa91a..48a7d0c76
--- a/crates/raw/Cargo.toml
+++ b/crates/raw/Cargo.toml
@@@ -29,6 -28,9 +29,8 @@@ default = ["jxl"
jxl = ["dep:jxl-oxide"]
[dev-dependencies]
+ # tests record why they skip (`cargo xtask ci` lists the skips)
+ lightcraft-testkit = { workspace = true }
-jpeg-encoder = { workspace = true }
proptest = { workspace = true }
zune-jpegxl = { workspace = true }
# Pinned CC0 corpus identities; not a product dependency.
diff --cc crates/ui-egui/src/theme.rs
index b85c373d5,30a9823d1..57ee987d1
--- a/crates/ui-egui/src/theme.rs
+++ b/crates/ui-egui/src/theme.rs
@@@ -453,28 -410,14 +453,28 @@@ mod tests
use super::*;
use crate::i18n::{Locale, set_language};
- /// #736: a Thai folder name drew boxes because only CJK craft-fonts faces were fallbacks. With a
- /// craft-fonts build that carries a Thai face, an English UI offers it in every family.
+ /// Every theme scrolls 100 points a wheel notch, and a zoom notch stays egui's stock ~1.22x
+ /// (`exp(40 / 200)`) instead of growing with the longer scroll.
#[test]
- fn thai_face_is_a_fallback_in_every_ui_family_when_craft_fonts_carry_one() {
- let Some(thai) = lightcraft_engine::CRAFT_FONTS.iter().find(|f| f.covers("Thai")) else {
- lightcraft_testkit::skip!(Fonts, "no Thai face in craft-fonts");
+ fn a_wheel_notch_scrolls_further_but_zooms_as_before_in_every_theme() {
+ for kind in [ThemeKind::Charcoal, ThemeKind::Midnight, ThemeKind::Silver, ThemeKind::Paper] {
+ let ctx = egui::Context::default();
+ apply_kind(&ctx, kind);
+ let (line, zoom) = ctx.options(|o| (o.input_options.line_scroll_speed, o.input_options.scroll_zoom_speed));
+ assert_eq!(line, WHEEL_LINE_POINTS, "{kind:?}");
+ assert!(((zoom * line).exp() - (40.0_f32 / 200.0).exp()).abs() < 1e-4, "{kind:?}: a notch zooms {}", (zoom * line).exp());
+ }
+ }
+
+ /// #736: the release input must carry Thai, not silently skip the check with an older pin.
+ /// Exercise the Thai characters of the reported folder name through every egui family.
+ #[test]
+ fn thai_folder_name_has_glyphs_in_every_ui_family() {
+ if lightcraft_engine::CRAFT_FONTS.is_empty() {
- eprintln!("built without CRAFT_FONTS_DIR: no craft-fonts to check");
++ lightcraft_testkit::skip!(Fonts, "built without CRAFT_FONTS_DIR: no craft-fonts to check");
return;
- };
+ }
+ let thai = lightcraft_engine::CRAFT_FONTS.iter().find(|f| f.covers("Thai")).expect("font input includes Thai");
set_language(Locale::En);
let definitions = font_definitions(lightcraft_engine::CRAFT_FONTS);
let name = craft_font_name(thai);
diff --cc xtask/src/main.rs
index dd49f1705,0bc3631ba..12ea881e8
--- a/xtask/src/main.rs
+++ b/xtask/src/main.rs
@@@ -33,16 -34,14 +34,20 @@@ commands
web [--serve [port]] [--dev]
build the browser app (apps/lightcraft-web) into <target>/web-site/;
--serve serves it on http://127.0.0.1:<port> (default 8080)
- ci fmt --check, clippy -D warnings, heif, test, parity refs, layers, assets, wasm (stops at first failure)
+ ci [--hardware] [--summary-md]
+ fmt --check, clippy -D warnings, heif, test, GPU probe, parity refs, layers, assets, wasm
+ (stops at first failure); writes target/ci/report.json (machine, GPU adapters, data,
+ steps, skipped tests) and target/ci/summary.md; --hardware also runs the GPU tests on
+ every backend with a hardware adapter; --summary-md prints the Markdown summary
- corpus [--download]
- show where test corpora live; --download fetches PngSuite and CC0 raw samples (raw.pixls.us) into corpus/ and checks their sha256
+ corpus [--download [nikon]]
+ show where test corpora live; --download fetches PngSuite and CC0 raw samples (raw.pixls.us) into corpus/ and checks their sha256;
+ --download nikon fetches the Nikon survey's 138 CC0 samples (docs/nikon-bodies/samples.json, ~2.7 GB)
stats [--exact] count tests and lines per crate (--exact: ask the test harness via `-- --list`)
+ raw-frame [--json] FILE…
+ measure where each raw's embedded camera JPEG sits in its sensor data, which edge bands hold no
+ picture and what the decoder's crop keeps beyond the camera frame (any make with a full-size
+ embedded JPEG); print image-area entries for Nikon bodies that record no crop (MEASURED_BODIES in
+ crates/raw/src/vendor/nef.rs; survey in docs/nikon-bodies.md)
";
fn main() -> ExitCode {
@@@ -57,10 -56,9 +62,10 @@@
Some("parity") => parity::run(&root(), rest.contains(&"--write")),
Some("wasm") => cmd_wasm(),
Some("web") => web::run(&rest),
- Some("ci") => cmd_ci(),
+ Some("ci") => cmd_ci(&rest),
- Some("corpus") => cmd_corpus(rest.contains(&"--download")),
+ Some("corpus") => cmd_corpus(rest.contains(&"--download"), rest.contains(&"nikon")),
Some("stats") => stats::run(&root(), rest.contains(&"--exact")),
+ Some("raw-frame") => cmd_raw_frame(&rest),
Some("-h" | "--help" | "help") | None => {
print!("{USAGE}");
Ok(())