Use the same exact-score known-crop preference as best_lens in the built-in fixed-lens fallback. Preserve higher-score priority and cover both profile orders through the public lookup API.
Validated with 33 lensdb and 5 engine lens-profile tests, plus full cargo xtask ci (8/8, Rust 1.95.0, Apple M5 Max Metal and WASM). The new tie regression fails against the previously published selector. No workflows or lockfile changes.
Co-authored-by: Codex <noreply@openai.com>
Nothing is fetched without the user's click. The first desktop start without a
database (and without LIGHTCRAFT_LENSFUN_DIR) asks once, "Download lens profiles?",
with the size added up from the pinned files, and Download / Not Now. Download
starts the existing pinned download (activity row, cancel); Not Now (or Esc)
fetches nothing and the app doesn't ask again. Settings > General > Lens profiles
has a Download Lens Database button and a switch that turns the offer back on.
The answer is kept in ui.json (lensDatabase: ask / accepted / declined; an
unreadable value asks again), and lensfun_download::fetch_on_start is the one
place that decides. The CLI and headless MCP never ask and never fetch.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A discarded stale lookup asks for a frame so the current one runs in an idle
window; Enable Lens Corrections' look-up list dedups with a set; the lens
profile doc says the CLI and headless MCP never start the first-run download
(lens.downloadDatabase still fetches on request) and that
LIGHTCRAFT_LENSFUN_DIR only stops the first-run download.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Render caches: a database lens profile is pinned to the photo. A decode never
overrides the catalog's database profile (media::source::pinned_lens), and
the profile is part of the render, thumbnail and variant cache keys
(media::quick::lens_key; only database profiles with the correction on, so
existing thumbnails keep their keys). When a download replaces the
database's files (lens_profiles::replaced), the refresh also re-reads raws
whose profile came from the database and raws that named no lens; an
ordinary start does not. library.refreshLensProfiles takes {all: true}.
Installation: files are staged beside the database folder, SOURCE.txt is
written there last, and the staged folder replaces the old one as a whole;
a failed swap puts the previous database back (and recover() does at the
next start). The app's own folder is read only with its marker, and
installed() checks every pinned file at its pinned size.
Shared hosts: with_default_lens_database() only selects the existing folder;
the permission to fetch is with_lens_auto_download() (desktop only), and the
first-start decision is one function, lensfun_download::fetch_on_start.
CLI render / merge and the headless MCP server select the folder;
lens.downloadDatabase selects the folder it downloads into.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Main split the app's main.rs, the engine and ui-egui tests and the
frame loop into modules; the lens-database hunks now live in
apps/lightcraft/src/session.rs, crates/ui-egui/src/app/frame.rs and
crates/engine/src/tests/lens_refresh.rs. No behaviour change.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- lensfun's data/db (CC BY-SA 3.0) is fetched by the desktop app on first
run into <config dir>/lensfun, pinned to commit 43f9e001 by name, size and
SHA-256, staged until every file is verified, with an activity row (never
bundled). LIGHTCRAFT_LENSFUN_URL lists other mirrors; LIGHTCRAFT_LENSFUN_DIR
still wins. lens.downloadDatabase / lens.databaseStatus for agents.
- The database is read per folder and again after a download; when it
changes, library raws without a profile whose lens it knows are probed in
the background and get it (untouched photos switch the correction on as
import would); ticking Enable Lens Corrections looks those photos up again
(library.refreshLensProfiles).
- EmbeddedLens records its source (file / lens database); the Optics panel
says "Profile: <lens> (lens database)", "Profile: from the file" or
"No lens profile found for <lens>." (13 locales).
- Tests: pinned download and refusal of a wrong file, the lookup and its
edited / untouched rules, and presets / Copy-Paste / Sync carrying only the
switch and amounts, each photo keeping its own lens's profile.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 773740fbb22eb66e7f62bada9cb32b594b6ff4d7)
Keep missing and invalid camera/calibration crops optional. Only absent calibration overrides inherit the parent scale; decline corrections with unknown calibration scale and preserve EXIF fallback for unknown camera crops.
Add synthetic parser, conversion and engine regressions and document the contract. The crop-only patch is unchanged from a4064b33. Full cargo xtask ci passes all eight gates on current upstream main plus the separate #2544 prerequisite.
Nikon DSLRs write no Exif LensModel, only the lens specification (maker note
0x0084, read into Metadata::lens_spec), so the lensfun-format lens database never
corrected their raws. A raw without a lens model is now looked up by a name built
from its specification ("24-70mm f/2.8", lightcraft_lensdb::spec_name), and a
profile is used only when one of its names is exactly that
(Profile::names_exactly): the specification fits every maker's lens with that
range, so a partial match or a maker-named entry is never taken. lensfun's own
database has no such names; a user aliases the one lens they own.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Raws without an embedded lens correction look their EXIF lens up in the
user-supplied database; the profile goes through the existing Enable Profile
Corrections path (amount sliders, CPU/GPU geometry stage, DNG export).
Synthetic-grid test renders a distorted chart through the pipeline.
Sources: own design (see lightcraft-lensdb for the model sources).
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>