Skip to content

Lightroom preset import: "Ask what to do" is reported, and the numbering tokens Lightroom never writes are no longer read - #1849

Merged
emmertex merged 5 commits into
emmertex:stagingfrom
blwfish:fix/lr-preset-import-ask-and-numbering-tokens
Dec 2, 2026
Merged

emmertex merged 5 commits into
emmertex:stagingfrom
blwfish:fix/lr-preset-import-ask-and-numbering-tokens

Conversation

@blwfish

@blwfish blwfish commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

In short: two fixes to importing Lightroom Classic export presets (.lrtemplate), found by checking the importer against presets and filename templates that Lightroom Classic wrote itself. If file exists: Ask what to do was imported silently, and the importer read two numbering-token spellings that Lightroom never writes as the sequence number.

How these were found

On my own Lightroom Classic install (read-only: nothing was written into its folders by the tooling, and no Adobe file is in this PR) I read the presets it had saved, then built variants of one of them (one setting changed each), imported them through its Export dialog, had Lightroom re-save them, and ran this importer on the result. I also built a filename template in Lightroom's own template editor and read its token names. Only key names and values are used; the tests build their own bytes.

Change

  • Ask what to do: Lightroom writes the existing-files choice as collisionHandling with "ask", "rename", "overwrite" or "skip". "overwrite" and "skip" were already read, and "rename" is our Add number. "ask" has no counterpart here (Lightroom prompts), and it was dropped without a word; the import report now says so, and that the preset numbers a name that exists.
  • Numbering tokens: Lightroom writes naming_sequenceNumber_NDigit(s) for Sequence # (it uses the Start Number), naming_operationSequence_NDigit(s) for Image # and naming_sequenceTotal_NDigit(s) for Total #. It does not write naming_imageNumber… or naming_totalNumber… (it renders the latter as nothing). The importer mapped those two guessed spellings to {seq:N}, so a total number became the sequence number again. They are removed from the mapping, so they and the real Image # and Total # tokens land in the report as file name tokens without a counterpart (our rename tokens have no total).
  • Housekeeping: one unmapped list per preset (it was stored twice).
  • Pinned, no behaviour change: a preset with no size_doConstrain, or size_doConstrain = false (Lightroom then writes no other size key), imports at full size; jpeg_quality 1 imports as quality 100 and 0.01 as 1; the native-file run parameters (id, ids, path, preset, background, pluginDestination) are not reported as preset settings.
  • Manual: output/export-presets (the sentence listing what the import report says). What's new and changelog entries.

How it was checked

an_ask_existing_files_setting_is_reported_and_rename_is_not, the real Image # and Total # spellings are reported as unknown tokens while naming_sequenceNumber_3Digits still maps to {seq:3}, and a test that the report row equals the stored list; the first two fail with the old code put back. The size, quality and run-parameter pins were each checked against a temporary mutation. Before and after on the M1: cargo xtask ci --quick (fmt, brand, quarantine, docs, notes, i18n, windows, clippy, stamp, parity, layers, assets, wasm, deny pass; lcc-engine tests pass except device_sync::tests::a_shared_collection_brings_photos_files_and_edits_both_ways, environmental on that machine, and run_presets::tests::a_run_makes_previous_export_and_runs_the_plugin_hooks_and_destination, a "plug-in busy" flake that also fails on plain staging after a fresh build). After merging the latest staging: fmt, brand, notes and docs checks, clippy -D warnings on lcc-engine, and the preset importer tests (26, 156 and 68) pass; the full gate was not re-run.

🤖 Generated with Claude Code

blwfish and others added 5 commits December 2, 2026 12:11
…s reported

Problem: a Lightroom Classic export preset with `collisionHandling = "ask"`
imported without a word, although "Ask what to do" has no counterpart here
(an export never stops to ask); the preset then numbers a name that exists.

Change: the import report names it and says what the preset does instead;
"rename" (our Add number) stays silent, overwrite and skip are unchanged.

Tests: lightroom_existing_files_setting_ask_is_reported_and_the_others_are_not
(all four values under Lightroom's unprefixed key, plus the import result and
the stored preset); fails without the change (0 report rows instead of 1).

Manual: output/export-presets.mdx

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…d as the sequence number

Problem: the importer read `naming_imageNumber*` and `naming_totalNumber*`
as `{seq:N}`. Lightroom writes neither (Image # is `naming_operationSequence_*`,
Total # is `naming_sequenceTotal_*`, and it renders `naming_totalNumber_*` as
nothing), so a total came out as the sequence number again.

Change: the two guessed spellings are removed from the mapping and fall into
the existing "unknown file name token" report; `naming_sequenceNumber_*` still
maps to `{seq:N}`, and the real Image # and Total # tokens are still reported
as unknown. The code comment that cited `naming_imageNumber_5Digits` is fixed.

No existing test pinned the guessed spellings (none changed).

Tests: lightroom_numbering_tokens_map_only_the_sequence_number; fails without
the change (the guessed spellings came out as `{seq:4}|{seq:2}|{seq:1}`).

Manual: none, no user-visible change beyond the import report (covered by the
Ask-what-to-do sentence's report line)

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
…quality and run-parameter behaviour pinned

Housekeeping from a code review.

- `Found.unmapped` and `preset.unmapped` held the same list through a clone;
  only `preset.unmapped` is kept (no behaviour change: the report row and the
  stored preset still carry it).
- In a native `.lcexport` file the parameters that name one export run (`id`,
  `ids`, `path`, `preset`, `background`, `pluginDestination`) are dropped
  without a report line. Decision: they are not preset settings (our exporter
  never writes them into a preset), so listing them would be noise next to the
  settings that were really not carried over; a comment says so and a test pins
  it, with an unknown key still reported and `dir` kept.
- Pinned, no change in behaviour: a Lightroom preset with no
  `size_doConstrain` imports at full size and, like one with the key false,
  ignores the other size keys without reporting them; `jpeg_quality` 1 imports
  as 100 and 0.01 as 1.

Tests: a_presets_unmapped_list_is_the_same_in_the_report_and_the_stored_preset,
export_run_parameters_in_an_own_preset_file_are_dropped_without_a_report_line,
a_lightroom_preset_without_constrain_imports_at_full_size,
a_lightroom_jpeg_quality_is_a_fraction_of_one. They pin current behaviour, so
they pass before and after; each was checked against a temporary mutation of
the code (quality `<=` to `<`, full size only when `format` is set removed,
`background` no longer dropped) and failed under it.

Manual: none, no user-visible change

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@emmertex
emmertex merged commit 4682211 into emmertex:staging Dec 2, 2026
3 checks passed
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