Skip to content

LRC-DEV-PROCESS: process versions, so a look change can ship without changing existing edits (#146) - #533

Merged
echelon merged 1 commit into
storytold:mainfrom
AlexChambers:process-version
Oct 10, 2026
Merged

echelon merged 1 commit into
storytold:mainfrom
AlexChambers:process-version

Conversation

@AlexChambers

Copy link
Copy Markdown
Contributor

Why

Issue #146 proposes retuning the default raw tone curve, and notes that this "changes the look of every existing raw edit, so it needs a maintainer decision (e.g. versioned process defaults so existing edits keep their look)". #196 (stronger Highlights / Shadows / Whites / Blacks) has the same problem. LightCraft had no way to tell which rendering a photo was edited under.

#514 (retuning the default raw curve against Lightroom) is the first change that would need it.

This PR adds that mechanism, modelled on Lightroom's process version. It does not change any rendering: there is one process, V1, which is today's pipeline. A tone retune can then land as V2 without touching existing edits.

What it does

  • DevelopSettings::process: ProcessVersion (a u32 newtype) records the rendering process. Process is an enum of the processes this build implements (only V1), so matches on it are exhaustive and adding V2 makes the compiler point at every stage that depends on it.
  • One seam in the pipeline: lightcraft_pipeline::finish::base_tone picks the base tone map by process (Process::V1 => the existing camera / raw / display tone maps, unchanged). CPU and GPU both get it through FinishParams::new.
  • New command develop.updateProcess, "Update to Current Process", in the Photo menu after Reset Edits. It moves the target photos that are on an older process to the latest as one undo step (history entry on each photo), keeps slider values, and never moves a photo to an older process. The menu item is enabled only while a selected photo is on an older process, so today it is always disabled (with the reason "already on the current process (version 1)"). A call that names its photos (ids / id) acts on them whatever is selected: each must exist and one must be on an older process, otherwise it returns an error.
  • Explicit targets: Session::execute checks a command's enablement before the handler sees ids, so a selection-based predicate would block {"ids": [older_photo]} whenever the selection is current or empty. CommandSpec gets an opt-in explicit_targets flag: when a call names photos, the selection predicate is skipped and the command validates those photos itself. Only develop.updateProcess opts in; the other ids? commands behave as before (most use has_selection, so they share the empty-selection limitation and could opt in later).
  • develop.get / MCP get_develop always report process.

Semantics

Process
New photo (import, merge, Lightroom catalog import, demo) latest
Settings saved without the field (all existing catalogs, snapshots, versions, history, lc:settings sidecars, browser libraries) V1
Reset (develop.reset) latest (also from an import look recorded on an older process)
Reset of a section / slider unchanged
Virtual copy, duplicate inherited
Copy / paste / sync / Auto Sync / presets unchanged: process is in no settings group, so the target keeps its own. A partial that names process (develop.merge) sets it
crs: edits (XMP, Lightroom catalogs, imported presets) unchanged; crs:ProcessVersion numbers Adobe's renderer and stays ignored. New photos are therefore on the latest process, existing photos keep theirs
Unknown number (from a newer LightCraft) kept on save, rendered with the newest known process, not offered for update; Reset moves it to this build's latest
Damaged value (anything but a whole number 0 to 2^32-1; 2.0 counts as 2) V1, like a missing field; the rest of the settings load (catalog snapshot and log, lc:settings sidecars), so a bad value never costs the edits. It is not kept: the photo is saved as V1

Lightroom's Sync offers the process version as its own checkbox. LightCraft's copy groups are coarser, and leaving the process out keeps one simple rule: only Reset and Update to Current Process change a photo's process (plus develop.merge when asked explicitly, and restoring a version / history step).

The process is not an edit: Photo::camera_defaults / import_defaults carry the photo's own process, and DevelopSettings::is_unedited ignores it, so "Edited" badges and filters, the embedded-preview shortcut for unedited raws and Local cleanup don't flip when V2 arrives. The "before" view and Auto analysis use the photo's process too.

Compatibility

  • Reading is lenient. ProcessVersion has a hand-written Deserialize: a damaged value reads as V1 instead of failing the whole settings. This matters because some readers drop settings that fail to parse (an lc:settings sidecar that doesn't parse is ignored, losing its edits).
  • Missing field = V1, always. That is the field-level #[serde(default = "ProcessVersion::legacy")]; the struct Default gives new settings LATEST. These coincide today and diverge the moment V2 becomes the latest, which is when old catalogs must stay V1. settings_saved_before_process_versions_load_as_v1 uses a full settings blob as main wrote it and asserts the literal V1.
  • V1 is not written (skip_serializing_if), so files written for V1 photos are byte for byte what main writes, and DevelopSettings::hash64 (the persistent render-cache key) is unchanged: no thumbnail or preview is invalidated by this upgrade.
  • Auto Sync strips process from the delta, like version, spots and red_eye.

Docs

  • New docs/process-versions.md: the rule ("a change that alters how existing settings render ships as a new process; V1 is frozen", with bug fixes allowed in place), how to add a process, and the table above.
  • docs/parity.md: new row LRC-DEV-PROCESS (Classic's Settings > Update to Current Process; no row existed), notes on LR-BEHAV-RENDER-FIDELITY and top gap 4, summary refreshed. Short notes in xmp-interop.md, lightroom-catalog-import.md, mcp.md and ROADMAP's look-parity risk.

Testing

  • crates/develop/src/tests_process.rs: legacy blob and {} load as V1; new / raw settings are latest; V1 is omitted when saving, other numbers round-trip; unknown numbers (7, u32::MAX, 0, 2.0) load and map to a known process; damaged values (negative, fractional, too large, text, null, list, object) read as V1 while the rest of the settings load, also nested; process is not an edit, survives section resets, and is not carried by copy groups, paste or presets (also at 50 %).
  • crates/pipeline/src/tests.rs stored_process_numbers_render_with_a_known_process: legacy settings render identically to V1, an unknown newer number identically to the latest, for rendered, raw and camera-tone sources, plain and edited, 8-bit and 16-bit.
  • crates/catalog/src/model.rs: a photo on another process with its import defaults (and with an import look) is not edited; an edit still is.
  • crates/catalog/src/tests_journal.rs: a damaged process in a catalog snapshot, and in a CRC-valid log record, loads as V1 with the photo's edits.
  • crates/engine/src/tests_process.rs: new photos and Reset get the latest (including from a newer process and from an older import look), section / slider resets don't change it; Update to Current Process is disabled with a reason when nothing is outdated, is one undo step, undo / redo work, keeps slider values, skips newer processes, works on the active photo alone; virtual copies inherit; copy / paste / sync / presets / Auto Sync keep each photo's process; an unknown number survives closing and reopening a library, renders, and develop.get reports it; lc:settings sidecars round-trip the process and leave V1 out, and a sidecar with a damaged process still restores its edits; crs: edits with crs:ProcessVersion don't set one; named photos are updated with a different, current photo selected and with nothing selected (ids and id), while all-current, unknown, malformed and empty ids are errors and the menu item stays selection-based.
  • Byte-identical output, checked with a throwaway harness (not committed) before and after the change: 180 renders of 5 procedural scenes x 3 source kinds (rendered, raw, raw with camera tone) x 4 settings (default, raw defaults, heavy edit with curve / grading / mask, B&W), CPU 8-bit, CPU 16-bit and GPU 8-bit (Apple M3 Max), all identical; saved JSON and hash64 of the same settings identical.
  • Drove the headless app: the Photo menu shows Update to Current Process greyed out; after develop.merge {"process": 0} (a stand-in for an older process) it is enabled, and running it updates the photo and greys it out again.
  • cargo xtask ci (rustc 1.99, Apple M3 Max): fmt, clippy, heif pass; test fails only on two GPU denoise-runner tests, lightcraft-gpu nn::tests::the_gpu_gives_what_the_reference_gives and nn::tests::a_runner_serves_many_tiles_from_many_threads (Metal output off by ~0.8 of the output's size). They fail the same way on the untouched base commit 8f924a9 on this machine and this PR doesn't touch crates/gpu. With --no-fail-fast every other test binary passes, and parity, layers, assets and wasm pass when run on their own. In one of those runs the engine unit tests hung once, in two tests_face_recognize tests (see below); rerun, all 476 engine tests passed.

Not in this PR

🤖 Generated with Claude Code

…changing existing edits (storytold#146)

Each photo's develop settings record the rendering process they are
interpreted by (`DevelopSettings::process`). There is one process, V1, the
pipeline as it is; nothing renders differently (180 CPU 8/16-bit and GPU
renders of procedural scenes, and the saved settings JSON and hash64, are
byte-identical to main).

Settings saved without the field load as V1 (a field-level serde default),
new settings get the latest (`Default`), and V1 is left out when saving, so
files and preview-cache keys stay as they were. A damaged value (anything
but a whole number up to 2^32 - 1) reads as V1 too, so it never costs the
rest of the settings (an unparsable `lc:settings` sidecar is ignored). Reset moves a photo to the
latest process, section and slider resets don't; virtual copies inherit
it; copy / paste / sync / Auto Sync / presets don't carry it; a number from
a newer LightCraft is kept and renders with the newest known process. The
process is not an edit (Edited badges, import-look checks). The base tone
map is chosen per process in one place (`finish::base_tone`, shared by CPU
and GPU). Photo > Update to Current Process (`develop.updateProcess`) moves
selected photos on an older process to the latest as one undo step. Its
menu enablement follows the selection; a call that names photos (`ids` /
`id`) is validated on those instead, through a new opt-in
`CommandSpec::explicit_targets` (execute checks enablement before the
handler sees `ids`). `develop.get` reports the process. The rule and how to add V2:
docs/process-versions.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@echelon

echelon commented Oct 10, 2026

Copy link
Copy Markdown
Member

Thank you @AlexChambers! This landed in #657 with the other community PRs of this round.

Please join our Discord if you haven't already: https://discord.gg/artcraft

brahimforbladi-blip pushed a commit to brahimforbladi-blip/lightcraft that referenced this pull request Oct 10, 2026
- storytold#540's crs::Target replaces the raw flag: storytold#597/storytold#604's folder sync and sidecar_op and storytold#533's
  process tests pass the photo's target instead of a bool.
- storytold#568's DRO test fits through storytold#528's fit_look (proxies now return the clipped mask).
- storytold#541 (French) and storytold#564 (Ukrainian) gain the 15 keyword format strings storytold#578-storytold#592 added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
brahimforbladi-blip pushed a commit to brahimforbladi-blip/lightcraft that referenced this pull request Oct 10, 2026
…orytold#533 does)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
brahimforbladi-blip pushed a commit to brahimforbladi-blip/lightcraft that referenced this pull request Oct 10, 2026
…e_tone; V1 at peak 1 unchanged)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
emmertex added a commit to Kaan88/lightcraft that referenced this pull request Oct 26, 2026
LR-META-XMP: read referenced JPEG Extended XMP (upstream PR 2581, own take)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants