Commit Graph
5202 Commits
Author SHA1 Message Date
Dylan M. Taylor 9cd6817c3b codecs, meta: read PSD header and image resources with craft-psd (#4167) 2026-11-14 00:09:58 +00:00
Dylan M. Taylor 264330d7e9 meta: migrate DateTime, gpx, and xmp_merge to craft-metadata 2026-11-14 00:03:58 +00:00
FredApps 0b64e349c0 CI: use the shared git-sources check and WiX install (#4156)
nix.yml ran its own copy of the git-sources job; it now calls
craft-common-actions git-sources.yml. release.yml's copy is removed:
the shared release.yml runs the same check before any build.
packaging-lint.yml's install-folder job installs WiX through the shared
install-wix action instead of its own dotnet tool install.
2026-11-13 14:04:46 +01:00
skylar taylor-barrick fd0b914e6c Guard opened-library catalog and settings writes (#3825)
Partial mitigation for #3240, preserving the original contribution and follow-up commits. Clone/remount trade-offs, directory-relative I/O, Windows folder identity and other path-based writers remain tracked under #3240.
2026-11-12 21:42:53 -06:00
skylar taylor-barrick d23de47288 test(engine): isolate the initial availability notifications 2026-11-12 20:28:09 -06:00
skylar taylor-barrick d7372407bb fix(catalog): make held caller logs writable for rollback 2026-11-12 20:28:09 -06:00
skylar 5bc8dbe30c test(engine): wait for availability wake notifications 2026-11-12 20:06:31 -06:00
skylar 18e8980d2a test(catalog): gate Unix-only folder test imports 2026-11-12 20:06:31 -06:00
skylar 5c5981898c fix(catalog): bind log recovery to observed files 2026-11-12 18:50:54 -06:00
skylar e689453e57 fix(catalog): refuse gaps in synchronous fallback logs 2026-11-12 18:01:17 -06:00
skylar fbdf4f5760 chore(ui): simplify render request boolean for clippy 2026-11-12 17:28:08 -06:00
skylar 19985a3f19 fix(catalog): reopen fallback appends in the accepted folder 2026-11-12 17:28:07 -06:00
skylar 690f6cfb58 fix(catalog): verify staging identity after streamed writes 2026-11-12 16:53:15 -06:00
skylar 5fa4d0eba6 Merge current main into library folder safety work 2026-11-12 15:52:20 -06:00
Dylan M. Taylor a75497d634 security: importers and preset application index instead of rescanning
* security: importers and preset application index instead of rescanning

* address review: keep first match when indexing names, skip used mask ids, move presets instead of cloning

* address review: a dry-run import keeps its rows, not the parsed presets

* merge main into fix/sec-importers-indexed

* address review: key duplicate presets by the settings value, so 0.0 and -0.0 are one preset

* preset import index: key numbers as f64 so 0 and 0.0 cannot collide
2026-11-12 06:29:07 -05:00
Dylan M. Taylor 9563f22969 security(pipeline): one dab budget per brush mask; linear-time defringe min/max
* security(pipeline): one dab budget per brush mask; linear-time defringe min/max

* address review: drop min_filter transpose buffers once consumed

* address review: an over-budget brush mask fails the render instead of dropping later strokes

* merge main into fix/sec-pipeline-render-work; the web worker rejects an over-budget brush mask

* address review: validate brush budgets on the mask's own frame; an exactly filled budget is not over it
2026-11-12 06:28:59 -05:00
Dylan M. Taylor 0d88706ec5 security(meta): bound namespace declarations in scope while parsing XMP
* security(meta): bound namespace declarations in scope while parsing XMP

* address review: a readable sidecar that fails the merge read-back is kept and the save fails

* address review: a sidecar over the XMP complexity limit is kept and the save fails

* merge main into fix/sec-xmp-namespace-bound

* address review: text with no rdf:RDF element is backed up and replaced, not kept as readable

* xmp merge: open a self-closing rdf:RDF element instead of replacing the sidecar
2026-11-12 06:28:53 -05:00
Dylan M. Taylor 49c9d4e0ca security: bound token expansion, sanitize the name fallback, regular-file sidecar reads, recased sidecar guard
* engine: cap token expansion, clean the catalog-name fallback, bound sidecar and raw reads, protect recased sidecars, cap graphic pixels
2026-11-12 06:28:46 -05:00
Dylan M. Taylor e4dd081dd4 Use craft-gainmap from craft-libs for gain map metadata and arithmetic
Use craft-gainmap from craft-libs for gain map metadata and arithmetic

* Use craft-heif from craft-libs; remove crates/heif

lightcraft-heif moved to craft-libs unchanged as craft-heif
(storytold/craft-libs#784), so PhotoCraft can share it. The layer table,
the heif CI step and the change triggers drop the local crate; a workspace
file change (which a craft-heif rev bump is) still runs the heif step.

* Pin craft-heif to the merge of storytold/craft-libs#794

* docs: the HEIF rows point at craft-heif, not the removed crates/heif

* Use craft-gainmap from craft-libs for gain map metadata and arithmetic

crates/codecs/src/gainmap.rs keeps the JPEG layout (encode_jpeg, read_jpeg,
is_gain_map_jpeg) and re-exports GainMapMeta, GainImage, GainMapOptions,
ISO_URN, compute and apply from craft-gainmap, which is this file's metadata
and arithmetic moved to craft-libs (storytold/craft-libs#904). The tests of
the moved code went with it.

* craft-heif's Options has a chroma field at this rev: keep the libheif upsampling LightCraft had

* raw: count the chunks a TIFF declares from its offsets table

craft-tiff builds at most one chunk descriptor per byte of file
(craft-libs#827), so a grid of tiles sharing one payload lists fewer
chunks than the image declares. Compare the offsets table, which is the
source of truth, so such a file reaches the byte-accounting check and is
refused for the data it actually holds.
2026-11-12 00:43:54 -05:00
Dylan M. Taylor 5a96dfc295 Fix Flatpak updates and bump to 0.21.1 (#4151)
* fix(flatpak): allow release checks and self-update helpers

* test: keep Flatpak permission parsing within strict Clippy rules

* chore: bump version to 0.20.1 for the Flatpak update fix

* test: map Flatpak manifests embedded by permission regression

* docs: explain the repaired Flatpak update path
2026-11-11 21:30:32 -05:00
Dylan M. Taylor c5d60d2fa7 Use craft-tiff from craft-libs for TIFF/IFD (#4088)
* Use craft-tiff from craft-libs; remove crates/tiff

lightcraft-tiff moved to craft-libs unchanged as craft-tiff
(storytold/craft-libs#783), the first step of sharing RAW support with
PhotoCraft (storytold/craft-libs#587). The layer table drops tiff and its
intra-layer ordering before raster.

* Pin craft-tiff to the merge of storytold/craft-libs#795
2026-11-11 19:51:47 -05:00
FredApps 5b61ce1e1a CI: nightly release dry run (#4154)
release.yml also runs nightly on main with craft-common-actions' dry-run: every release build
except macOS, with nothing signed, pushed or drafted. Breakage that only the release build hits
(riscv64, Flatpak, FreeBSD, packaging) then shows up the next morning instead of on release
day, as it did on 11 Nov 2026.
2026-11-11 23:04:22 +01:00
Dylan M. Taylor 8ef35987d4 security: mask.exportEffects refuses originals and sidecars, writes atomically (#4125)
* mask.exportEffects refuses originals and sidecars and writes atomically

* check_write_target refuses unresolvable .. components in a missing destination folder

* test: accept either refusal for a missing/.. destination (Windows resolves .. lexically)
2026-11-11 15:14:21 -05:00
FredAppsandFredApps 06b4db3202 Release: LightCraft v0.21.0 on main (#4153)
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
2026-11-11 20:52:15 +01:00
Dylan M. Taylor d6ae2e9e7e security(engine): read user-named files through the opened regular file under a byte cap (#3703)
* security(engine): read user-named files through the opened regular file under a byte cap

* address review: compare the probe error with the std::fs::read error

* address review: open files for reading without waiting for a FIFO writer
2026-11-11 14:34:39 -05:00
Dylan M. Taylor c1a4fddca4 security: O(width) box-blur priming, case-insensitive download names, stats walk skips directory links (#3729)
* security: box blur window sum in O(width), case-insensitive download name uniqueness, stats walk does not follow directory links

* address review: skip the last-pixel term when the radius does not reach it
2026-11-11 14:34:25 -05:00
Dylan M. Taylor a4a797e2f2 security(raw): shared header-scan budget for tagged previews, tile-sized lossy JPEG budget, bound deflate tile padding (#3695)
* security(raw): share one header-scan budget across tagged previews, tile-sized lossy JPEG budget, bound deflate tile padding

* address review: charge a candidate preview range to the shared budget only after it validates

* address review: charge the candidate header walks to a shared work budget

* address review: bound lossy tile JPEGs by the tile's MCU-padded size; accept the writer's padded Deflate tiles
2026-11-11 14:34:11 -05:00
Dylan M. Taylor 5ff567a4a2 Merge pull request #4131 from storytold/chore/craft-update-6e03f65
Updates: take craft-update from craft-libs main at 6e03f65bf
2026-11-11 12:44:43 -05:00
Dylan M. Taylor 7111a3cbe8 Updates: take craft-update from craft-libs main at 6e03f65bf 2026-11-11 12:44:34 -05:00
Dylan M. Taylor de75f6937e ci: run Harden-Runner on every job (#4129)
Adds step-security/harden-runner (audit, pinned to v2.22.4 like
craft-common-actions) as the first step of each job that did not have it,
so every workflow in the org's public repos reports its egress to
StepSecurity. Audit, not block: block-mode allow lists come from each
job's observed traffic.
2026-11-11 12:12:17 -05:00
Dylan M. Taylor f786b87533 security(meta): linear entity decoding, indexed keyword de-duplication, bounded XMP path building (#3672)
* security(meta): linear entity decoding, indexed keyword de-duplication, bounded XMP path building

* address review: decode zero-padded numeric references in the three entity decoders
2026-11-11 04:26:21 -05:00
Dylan M. Taylor a42ee7042f security(heif): count alpha-grid tiles and bound hvcC parameter sets before heic-rs (#3645)
* heif: count alpha-grid tiles and bound parameter sets before heic-rs

Three ways a HEIF file could make heic-rs 0.1.4 do far more work than the
picture warrants:

- the predecode visit budget skipped the tiles of an alpha plane stored as
  a grid, so its references were rebuilt and decoded unchecked;
- hvcC parameter sets were collected with a scan of every set kept so far
  per incoming set, and PPS ids past 63 were accepted, so thousands of
  distinct ids made collection quadratic;
- tile tables walk the tile boundaries for every coding tree block, and a
  PPS could ask for up to 1024 x 1024 tiles.

The probe now counts an alpha grid's tiles in the shared budget, and every
hvcC is checked before heic-rs parses it: at most 96 parameter sets (one
per id H.265 allows), PPS ids up to 63, and at most 20 x 22 tiles (the
largest any H.265 level allows).

* address review: check thumbnail grid tiles' parameter sets in candidate selection, check each distinct tile once

* address review: skip thumbnail candidates whose grid cannot be read
2026-11-11 03:16:31 -05:00
cezar 1a301fc2d8 LR-EDIT-LENSBLUR: camera-like Lens Blur with AI subject focus and per-mask bokeh
Part of the Lens Blur row (`LR-EDIT-LENSBLUR`, ⬜ → 🟡: no depth map yet). Related: #377 (SAM 3 subject selection, used here for the Lens Blur focus).

## Problem

Lens Blur settings existed but nothing rendered them: there was no way to add a shallow depth of field, keep the subject sharp while the rest falls out of focus, or blur only part of a photo through a mask.

## Change

**Edit → Lens Blur** (`section.lensBlur`, ⌘6)
- **Apply**, **Amount**, **Boost** (brighter bokeh highlights) and **Transition** (how gradually the blur grows away from what is in focus, so the subject doesn't look cut out).
- **In Focus**: *Subject* (a mask) or a fixed shape: **Auto / Round / Horizontal / Vertical**, buttons drawn in code that work on the light themes.
  - **Move & Resize** (tool `lensBlurShape`) drags the ellipse on the photo and stretches it by its handles. Each drag is one undo step; a shape button puts the ellipse back in the middle.
- **Find Subject** (`lensBlur.findSubject`) runs only when clicked, never automatically on Apply.
  - It starts from the focus point the camera recorded, when the file has one (Sony ILCE-1 and ILCE-7SM3, the models `lightcraft_meta` reads today). Otherwise it starts from the subject estimate.
  - SAM 3 keeps the prominent people and animals: those at the focus point and those of a similar size. When the focus point falls on neither, it falls back to an object click at that point.
  - The result is a normal Object mask ("Lens Blur Subject") that can be refined in Masking.
  - It runs on the background segment worker, and on remote SAM 3 too (`Operation::Subject`). While the mask is pending, the UI shows a spinner and the render keeps the subject estimate in focus, so the photo is never blurred whole.
  - Without the model, it returns the model-missing error, changes nothing, and the UI offers the SAM 3 download.
- **Brush Refinement**: Focus and Blur brushes painted on the photo (`lensBlur.brushStroke`, `lensBlur.brushReset`), with Size, Feather, Flow, Amount and Auto Mask.
- While Apply is off, In Focus, the shapes, Move & Resize and Find Subject are disabled.

**Masking: a Lens Blur block in every mask** (`section:maskLensBlur`, under Refine Edges)
- **Blur: Selection / Outside**. Outside blurs what the mask leaves out, without inverting the mask's other adjustments.
- **Amount**, **Boost** and **Transition**, per mask. The header's eye switches the block off and keeps its values; the header folds the block.
- Stored as `lens_blur`, `lens_blur_outside`, `lens_blur_boost`, `lens_blur_transition` and `lens_blur_off` on `LocalAdjustments`, set through `mask.adjust`.

**Rendering** (`crates/pipeline/src/lens_blur.rs`)
- Runs in the scene-linear stage after denoise; its settings are part of `pre_nr_key`.
- Disc (bokeh) kernel at four levels on coarse grids, with a normalized convolution weighted by the circle of confusion, so sharp areas don't bleed halos into the blur. Transition uses a chamfer distance to the in-focus area.
- The radius is relative to the long edge, so the blur doesn't depend on resolution. The work stays bounded on large exports: the disc kernel has a fixed size, and each level's coarse grid stays within a cell budget.
- Zoomed windows, both 8-bit and deep (16-bit/float), read around them and are cut back to the request. The grids follow the whole output's origin, and the automatic subject estimate is made once from the whole photo. A window therefore matches the whole render.
- GPU path: read back, apply on the CPU, upload (`crates/gpu/src/render.rs`).
- Hostile values (NaN or infinite sizes, out-of-range areas and focus points, oversized stroke lists) are sanitized or rejected, never a panic.

All new strings are in the 17 locales.

**Not in this PR:**
- Real depth. The falloff is the image distance from the focus, not scene depth; a depth model (e.g. Depth Anything V2 Small on candle) would be a separate PR.
- Rotating the ellipse.
- Aperture shapes.
- Focus points for more camera makes and models.
- Find Subject doesn't resume by itself after the SAM 3 download (the Masking tools do). Like the existing Object / Describe jobs, it shows no row in the activity stack.

## How it was checked

- [x] Full `cargo xtask ci` on Windows 11 x86_64 after the latest merge of `main` (465c8722):
  - fmt, clippy, heif, parity, layers, assets and wasm pass;
  - every Lens Blur test passes;
  - the only failures are five tests outside this change that fail on Windows on `main` too: `export::tests::sixteen_bit_zip_tiff_is_never_larger_than_uncompressed`, the two GPU out-of-memory tests in `gpu::ctx`, `dialog_role::settings_is_a_dialog_too` (needs craft-fonts) and `folder_drop::dont_ask_again_moves_the_next_drop_at_once`.
- [x] Tests that fail without the change:
  - **pipeline**:
    - the `lens_blur` tests: shapes and moved or hostile areas, blur growth away from the focus, the fallback while an AI mask is pending, brushes, masks blurring their selection or outside with Transition, hostile input;
    - `large_image_blur_work_is_bounded`: on a 60 MP export with the strongest global and per-mask settings, the disc kernel stays a fixed size and every level's coarse grid stays within its cell budget, including an offset render window;
    - window/full-render parity at U8 and U16, including the automatic subject.
  - **engine**: brushes with undo; Find Subject without the model changes nothing; deleting the focus mask clears the focus; a partial effect preset sets `lens_blur`; with the `sam` feature, Find Subject fills the waiting mask.
  - **segment**: `prominent_subjects`, and remote `Subject` validation.
  - **catalog**: `op_variants_are_versioned` with the new format version.
  - **ui-egui**: the brushes painting on the photo, the shape buttons, the controls disabled while Apply is off, Move & Resize with undo and redo, the mask block (side, sliders, eye, folding).
- [x] User-visible change: ran the app and looked at the result (dark and light themes).

## Screenshots

**Before / after**

<img width="1402" height="952" alt="before" src="https://github.com/user-attachments/assets/8baceb99-7708-4c25-990c-8da29b6bc1b4" />
<img width="1320" height="937" alt="after" src="https://github.com/user-attachments/assets/a1476510-558a-4460-8766-b25bda0dfd3d" />

**Edit → Lens Blur** and **the mask's Lens Blur block**

<img width="457" height="626" alt="main painel" src="https://github.com/user-attachments/assets/47a19637-29a8-4446-a003-2eef416975b7" />
<img width="463" height="333" alt="mask painel" src="https://github.com/user-attachments/assets/345ffc14-66d2-4adc-af3c-b756727201de" />

## Merging

- **Overlap:** #1713 (Clearfall; a draft since 2026-10-14 that conflicts with main) implements the same row on the CPU. It has aperture shapes and XMP roundtrip, which this PR lacks. This PR adds the per-mask block, SAM 3 Find Subject from the camera's focus point, the GPU path and window parity. Only one should land; happy to port what #1713 has that this lacks.
- **Existing edits and libraries:** unchanged. Lens Blur is off by default and every new field is omitted from the JSON at its default, so existing settings keep their JSON and hashes.
- **Shared numbers taken:** catalog format `VERSION` 12 (`crates/catalog/src/journal.rs`). main already uses 10 (`Mask.on_photo`) and 11 (`EmbeddedLens.source`), so Lens Blur takes one past them. If another pull request lands with 12 first, I'll take the next one when I merge main. No render-cache, look or process version change.
- **Where it came from:** own implementation; nothing derived from GPL code or Adobe data. The camera focus point comes from the existing `lightcraft_meta` reader; subject selection uses SAM 3 through the existing segment crate.
- **New dependencies, `unsafe`, build scripts, network access, spawned processes, deleted files, CI or `xtask` gate changes:** none. The remote SAM 3 protocol gains one request (`Operation::Subject`). An older worker rejects it with an error, as `docs/ai-masks.md` notes.

## Checklist

- [x] No new panic path in non-test code
- [x] New text on screen goes through `tr()` with keys in all `locales/*.json`; ⌘6 opens the new section (KEY-SECTIONS)
- [x] `docs/parity-checklist.md` rows updated (LR-EDIT-LENSBLUR 🟡, LR-MASK-SLIDERS, KEY-SECTIONS); `docs/gaps.md` has no Lens Blur entry
- [x] New code has a caller
- [x] No new assets (the shape icons are drawn in code)
- [x] Ready to merge

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **New Features**
  * Added Lens Blur with adjustable strength, highlight boost, and transition controls, plus Round, Wide, and Tall focus shapes.
  * Keep a subject or selected mask in focus, find people or animals automatically, and refine focus or blur with brushes. Move and resize the focus area directly on the photo.
  * Apply Lens Blur to individual masks, including selections or areas outside them.
* **Bug Fixes**
  * Improved Lens Blur rendering for cropped views and preserved focus-mask assignments correctly when masks are edited.
* **Documentation**
  * Updated feature and control guides, with Lens Blur interface translations added across multiple languages.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-11 08:02:05 +01:00
Jeremy Hooke bb414d220a LR-EDIT-LIGHT-SHADOWS: fix Highlights/Shadows block artefacts in fine detail; 4× faster GPU median
Fixes #3460
Related: #2936 (slow GPU kernel compiles on Windows/DX12). This PR builds the GPU kernels without wgpu's workgroup-memory zeroing, which took a DX12 release start from ~87 s to 1.4 s on a GTX 1070 with the new median kernels; it may shorten the compiles there too, but does not close it.

## Problem

Raising Shadows on a photo with dark lettering on a bright panel makes bright blocks grow beside the
letters. On a Canon CR3 of a bus (6960×4640) with a black fleet number on a yellow panel, Shadows +75
puts bright yellow rectangles in the gaps where the digits pinch together and inside the 4's counter.
At Shadows +5 there is none of this; at +75 it shows at any zoom. Narrow gaps between dark objects
generally can do it: the pinned corpus has the same thing in the gap between two posts under a machine
(Hasselblad, `coverage-6568.fff`).

## Cause

From process V2 the Highlights/Shadows base (`local::tone_base`) is the edge-aware filter of a
separable median of log luminance, at a radius of 0.15 % of the long edge (10 px here), so that thin
detail (twigs, lines, #632) takes its surroundings' shift. Text strokes and gaps are about that wide,
so each row and column window is close to half letter and half panel, and the median picks one tone
or the other in rectangles: it fills the gaps between the digits and the 4's counter with the letters'
tone. The guided filter keeps those blocks, so panel pixels whose base reads as deep shadow get
Shadows' full lift (`2^(1.7·s·w^1.5)`, up to ~1.3 EV at +75).

## Examples

Top: before, bottom: after.

The fleet number on the bus photo, Whites +54, Blacks +31, Shadows +75, at 300 %:

<img width="1020" height="976" alt="example_photo_pair" src="https://github.com/user-attachments/assets/cc5b164f-612d-4d7d-bda3-db6afd8b177f" />


The gap between two posts in the corpus' Hasselblad `coverage-6568.fff` (CC0, raw.pixls.us),
Shadows +100, at 300 %:

<!-- image: example_corpus_pair.png -->
<img width="900" height="1216" alt="example_corpus_pair" src="https://github.com/user-attachments/assets/feb4b240-194e-40b1-b5b9-c4419f840df6" />

Synthetic lettering at the scale of a bus number in a 7000 px photo, Shadows +75, at 200 %:

<!-- image: example_pair.png -->
<img width="880" height="820" alt="example_pair" src="https://github.com/user-attachments/assets/bd02e600-dda0-4648-85e9-f89ce046eb08" />

## Change

`local::detail_free` (CPU) and its GPU twin: each value of log luminance is clamped between its
separable median at r (as before) and the median of a 3× wider neighbourhood (the median at r of a
box-downscaled copy, enlarged bilinearly, like `guided_fast`'s coefficients). The base is the guided
filter of that plane.

- A twig or speck in an even surround has both medians on the surround's side and takes the nearer,
  as under the median alone (#632 unchanged).
- The gap between two strokes sits in a wider neighbourhood that is mostly panel: the medians
  disagree and the gap keeps its own tone. The strokes themselves count as fine dark detail on the
  panel (both medians agree) and keep their contrast, as twigs do.
- Steps between regions stay exact (the fine median keeps them).
- GPU: the coarse median reuses the box/bilinear resize, plus one `clamp_between_k` map kernel.
  CPU and GPU match (max 1 level).
- GPU median kernels rewritten (`median_h` / `median_v`): each workgroup loads its taps into
  workgroup memory and selects by rank, 4 neighbouring outputs per thread. The old partial selection
  sort over a private 49-tap array sat in scratch memory. Same selection, so bit for bit the CPU's
  (`median_matches_cpu_bit_for_bit`, every r 1–24); renders are byte-identical to the old kernels.
  On 6960×4640 at r = 10 (M2 Max) the median takes 191 → 47 ms.
- GPU kernels are built without wgpu's zeroing of workgroup memory (as `nn.rs` and `faces.rs` already
  are): on DX12 it made FXC take ~87 s over the new median kernels at every start of a release build
  (GTX 1070, 1.4 s without it). Every element of `med_tile` the kernels read is loaded before the barrier;
  renders are byte-identical.
- Cost on the 6960×4640 bus CR3 with Whites +54, Blacks +31, Shadows +75 (M2 Max): GPU planes
  231 ms on `main` → 113 ms here (257 ms with this PR's first kernels); CPU base ~388 → ~453 ms.
  The CPU path enlarges the coarse median while it clamps, into the fine median in place
  (`detail_free_matches_its_reference`, bit for bit).
- New process V8 (`Process::LATEST`). Existing edits keep their process and render as before, so `RENDER_CACHE_VERSION` is unchanged (it is 76 on `main`).
- Docs: `process-versions.md` (V8 row, a paragraph on the lettering fix, revision history), `parity-checklist.md`
  (LR-EDIT-LIGHT-HIGHLIGHTS / -SHADOWS notes).

An earlier revision of this PR clamped each value to the quartiles of its window instead. It fixed
the lettering but stopped treating isolated lines between r/2 and r wide as detail (twigs of 3–6 px
against a dark wall were lifted less than the wall, as under V1), which the corpus run below caught.
A fixed window can't tell an isolated line from a gap between strokes; a wider neighbourhood can.

## Process version

The new base applies from a new process, **V8** (V7 plus `local::detail_free`; `local::base_keeps_gaps` is true from V8, CPU and GPU). v0.19.0 shipped V3 to V6, and crystal grain (#3630) took V7 on `main`, so V1 to V7 render exactly as before: `tests_legacy` still locks V1 and V2, and `only_process_v8_on_takes_the_detail_free_base` checks that every earlier process keeps the plain median. New photos get V8; photos already edited keep the blocks until Update to Current Process.

The faster median kernels and the workgroup-memory change don't change pixels, so they apply to every process. They stay in this PR: the zeroing only costs time on the new median kernels (on `main` the kernels compile in 0.8 s on the GTX 1070), so on its own it would speed up nothing.

## How it was checked

- [x] New test `gaps_between_letters_keep_their_own_tone_in_the_base`: a row of synthetic "8"s
  sized like the bus number. With the median, 360 panel pixels sit more than 1 EV above their base
  (worst 2.25 EV); now none do (worst 0.8 EV). It fails with the median alone.
- [x] New test `isolated_lines_up_to_the_detail_radius_stay_out_of_the_base`: light lines 1–9 px wide
  on a dark ground (r = 10) stay out of the base, as under the median. It fails with the quartile
  clamp (a 6 px line 0.31 of the way into the base).
- [x] New test `detail_free_keeps_steps_and_regions`: steps and flat fields pass through unchanged;
  tiny, empty and NaN planes don't panic.
- [x] The #632 tests (twig/stalk contrast, local contrast, no halo at a strong edge, V1 unchanged)
  and the median reference tests pass unchanged.
- [x] `lightcraft-gpu` integration tests on a real adapter, including
  `highlights_shadows_base_matches_on_every_process` (max difference 1 level).
- [x] Corpus A/B: all 451 pinned raws (`cargo xtask corpus --download`) rendered at full size before
  and after, with Shadows +100 and with Highlights −100 (902 pairs, GPU). No failures. RMSE median
  0.18 % (Shadows) / 0.10 % (Highlights), max 0.86 %; pixels changed by more than 3 % at most 0.07 %
  of a photo; worst 8×8-block change median 10 / 7 levels, 99th percentile 44 / 41, max 61. I looked
  at the 22 largest local changes (old over new, at the worst block): no new artefacts. Most are a
  slightly different tone in small gaps among foliage or branches; one is the Hasselblad gap above.
- [x] User-visible change: rendered the bus photo at full size and at 2400 px with Whites +54,
  Blacks +31 and Shadows +5 / +75, and looked at the number, the plate, foliage against the sky and a
  brick lattice fence.
- [x] New tests `median_matches_cpu_bit_for_bit` (GPU, M2 Max) and `detail_free_matches_its_reference` (CPU).
- [x] After merging `main` and moving the base to V7 (Linux, Ryzen 5 7545U, RADV): `cargo test --release` of `lightcraft-develop`, `-pipeline` (including `tests_legacy`), `-catalog`, `-engine`, and `-gpu` on the real adapter (skipping `running_out_of_device_memory_falls_back_without_stopping_the_gpu`, which fills RAM on an APU; see above); `cargo fmt`, `cargo clippy --workspace --all-targets -D warnings`, `cargo xtask layers`, `roots`, `assets`, `parity` and `wasm`. Not run: the full `cargo xtask ci`, and the macOS-only `tests_light::v1_and_v2_render_as_before_v3` (V1 and V2 don't change, so it shouldn't need re-capturing).
- [x] After merging `main` again (with crystal grain as V7) and moving the base to V8 (Linux, Ryzen 5 7545U, RADV): `cargo test --release` of `lightcraft-develop`, `-pipeline` (including `tests_legacy` and the grain tests), `-catalog`, `-engine`, and `-gpu` on the real adapter (skipping `running_out_of_device_memory_falls_back_without_stopping_the_gpu`); `cargo fmt`, `cargo clippy --workspace --all-targets -D warnings`, `cargo xtask layers`, `roots`, `assets` and `parity`. Not run: `wasm` and the full `cargo xtask ci`.
- [x] `cargo xtask ci --quick` (with `CRAFT_FONTS_DIR`): all steps pass. After the median change: all steps pass again (without `CRAFT_FONTS_DIR`), and the CR3 renders
  byte-identical to the first kernels on GPU and CPU.


<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **Bug Fixes**
  * Highlights and Shadows adjustments better preserve clean gaps in fine details such as lettering while maintaining the existing treatment of broader image features.
  * Tone adjustments are less likely to include isolated, narrow lines in the base used for processing.
  * The updated detail handling helps retain fine structure while reducing unwanted influence from closely packed details.
* **Documentation**
  * Updated process notes to explain how fine-detail handling affects Highlights and Shadows adjustments.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-11-11 07:31:45 +01:00
Dylan M. Taylor c2e9c456c9 security(segment): Object selections take at most 64 clicks at the engine API and the model (#3717)
* security(segment): Object selections take at most 64 clicks at the engine API and the model

* address review: refuse over-cap Object clicks before queueing in background mode
2026-11-10 18:07:21 -05:00
Dylan M. Taylor 0121e0ccb0 security: check caller-supplied image dimensions before sizing from them (codecs, merge, inpaint, slideshow) (#3712)
* security: check caller-supplied image dimensions before sizing from them (codecs, merge, inpaint, slideshow)

* address review: reject gain maps past the JPEG dimension limit
2026-11-10 18:07:02 -05:00
Dylan M. Taylor cb86952cbf security(raw): CR3 timed maker notes are parsed once per distinct range under a shared budget; Sony quad tiles' frames may not exceed the tile (#3700)
* security(raw): CR3 timed maker notes are parsed once per distinct range under a shared budget; Sony quad tiles' frames may not exceed the tile

* address review: skip an oversized timed maker note instead of ending the search
2026-11-10 18:06:42 -05:00
Dylan M. Taylor 76b30801bd security(xtask): web --serve serves only plain files inside the site; linear asset globs; exclusive lock owner file (#3682)
* security(xtask): web --serve serves only plain files inside the site; linear asset globs; exclusive lock owner file

* address review: say so when the ci lock owner file cannot be written
2026-11-10 18:06:23 -05:00
Dylan M. Taylor 7e409a3706 security(engine): one unpack budget across a preset zip's packs; linear comment skipping; small zip errors (#3675)
* security(engine): one unpack budget across a preset zip's packs; linear comment skipping; small zip errors

* address review: charge a failed pack's unpacked bytes to the shared zip budget

* address review: charge a corrupt deflate entry's partial output to the shared budget

* address review: an entry past its stated size spends only what it unpacked
2026-11-10 18:06:04 -05:00
FredApps b188295ee4 Merge pull request #4048 from storytold/sonar/release-job-permissions
CI: release workflow grants write permissions to the release job only
2026-11-10 20:59:36 +01:00
FredApps 202021ddf5 Merge branch 'main' into sonar/release-job-permissions 2026-11-10 19:33:54 +01:00
FredApps e60a725133 Merge pull request #3632 from Yeetjof/feat/survey-layout
LR-VIEW-SURVEY: the survey fits its tiles to the photos' shapes, and tiles glide to their new places
2026-11-10 18:00:44 +01:00
Fridtjof MichelsandClaude Opus 5.5 e2d45b8818 LR-VIEW-SURVEY: merge main (#3842: photo_tile also returns the painted rect; the survey ignores it)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 16:03:14 +01:00
FredApps 993af1c343 ci(release): grant write permissions to the release job only 2026-11-10 11:11:01 +01:00
FredApps e9c29e2c5c Merge pull request #2599 from francoisgn/feat/issue-2592-lightroom-backup-zip
LRC-LIB-CATALOG-IMPORT: import Lightroom catalog backup zips directly (#2592)
2026-11-09 23:25:54 +01:00
FredApps 4ecbd194fd LRC-LIB-CATALOG-IMPORT: reconcile backup import with main
Preserve collection ownership, check extraction space, and resolve the upstream merge.
2026-11-09 22:14:17 +01:00
FredApps f6b57b0b59 Merge pull request #3630 from jeremyh/crystal-grain
LR-EDIT-EFFECTS-GRAIN: film grain from crystal layers (process V4), resolution independent, no GPU cost
2026-11-09 11:39:02 +01:00
Dylan M. Taylor d73c849ed1 Merge pull request #3996 from dotCooCoo/chore/craft-update-1b34eba41
Updates: take craft-update from craft-libs main at 1b34eba41
2026-11-08 23:45:33 -05:00
dotCooCoo c31f91c8fe Updates: take craft-update from craft-libs main at 1b34eba41 2026-11-08 19:47:39 -08:00
Dylan M. Taylor 2f4d095903 Merge pull request #3995 from dotCooCoo/fix/updater-starts-at-exit
Updates: the updater reports installing, ready, installed and failed, and installs at exit
2026-11-08 22:09:45 -05:00