Skip to content

LRC-LIB-LIBFOLDERS: an "Unfinished moves" window says what the next open found of a move cut short (stacked on #3119) - #2915

Open
nledford wants to merge 15 commits into
storytold:mainfrom
nledford:move-resume-draft
Open

nledford wants to merge 15 commits into
storytold:mainfrom
nledford:move-resume-draft

Conversation

@nledford

@nledford nledford commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #3119 (a move cut short is followed at the next open), which is stacked on #2914 (a move writes a record in the library before the first file moves), which is stacked on #1925; chain to main: #1925 → #2914 → #3119 → this PR. Its own commit is 715041137f; the commits below it are #3119's, #2914's and #1925's.

Problem

#3119 makes the next open follow a move that a force-quit or a crash cut short, and records what it found (photos pointed at their files, files that can't be reached now, copies removed, a record that can't be read) in library.info → recoveredMoves, the log and the CLI's stderr. In the app the person sees nothing: photos they had moved simply point somewhere new, or a move they expected to be waiting for a disconnected disk is silently retried at every open.

Change

An "Unfinished moves" window (crates/ui-egui/src/panels/notices.rs) shows once when the library opens, with OK, what following the moves an earlier run cut short came to. The text says, as they apply: how many photos were being moved and that the library now points at where the files are (Edit → Undo moves them back), how many files can't be reached now (a disk not connected?) and that LightCraft looks again at the next open, how many copies were removed from the new place because the original was still where the library has it, and each problem: a record that can't be read, a file now at both places, a sidecar that couldn't follow its file, a library that couldn't follow or save, and a library open without its lock that was left alone. It has its own title and button, apart from "Settings file problem", and comes after the quit prompt and before the settings notices.

Agents: ui.inspect → moveNotice is the text of the window until OK is pressed (button:moveNoticeOk). docs/control-protocol.md says so.

A switch to another library clears it (switch_library), so the text of the library that was left is never shown over the next one.

Translations: the ten strings (the window's title and the seven messages it says, plus the removed-copies message and the unlocked-library sentence) are translated in all 17 catalogs, each with its own name for Find Missing Photos and its own terms for the library and for Undo. docs/whats-new.md and docs/parity-checklist.md are updated.

Not in this PR:

How it was checked

Tests (crates/ui-egui/src/tests_move_notice.rs, 5 tests, all added here). The ones that need the app failed on a throwaway copy of this head with the thing they are about taken out, and pass here:

  • A library whose open followed moves shows the notice once; ui.inspect → moveNotice holds the text; the window has its OK; pressing it closes the window and the notice is not handed out again. Failed with the library's result not taken.
  • The text says what was followed, what waits and what went wrong; removed copies, and a library left alone for want of its lock, are told. The last one failed with the removed-copies line taken out.
  • A switch to another library clears the notice of the one that was left. Failed with the clearing taken out (the old text was still there).
  • Nothing is said when nothing was left.

Translated text is not compared with the catalogs in a test, as the repo's own i18n report lists any gap.

An independent read-only review of this head looked for what the window hides or misstates for every state the engine can report, and for placeholders, term and wording problems in all 17 catalogs. Its findings (the notice outliving a library switch, one catalog's word for "library", a missing ui.inspect row, a stale comment) are fixed in this head; the fixed head was not read again.

Screenshots

All shots are release builds at a 1600×1000 point window (2× pixels), drawn with a windowed ui.screenshot on the procedural demo photos, in a scratch library and settings folder; every state was driven through the control channel. "Before" is the parent PR's head built the same way. Before: the head of #2914. "After" is this head.

To get a library that holds a move cut short, I made on disk what a force-quit leaves instead of killing the app mid-move: a scratch library with eight imported photos, then (app closed) two of the files moved to another folder by hand, one file removed (its new folder doesn't exist, as for a disk that isn't connected), one file copied to the new place with the same bytes, one copied there with different bytes, and a record of those five moves written into the library's moves/ folder in the engine's own format ({"version":1,"moves":[[from,to],…]}). The same library and files were then opened by each build.

What the next open says. Before, the open follows the moves (the same findings are in library.info → recoveredMoves: 2 relinked, 1 waiting, 1 copy removed, 1 problem) but the app shows nothing. After, the "Unfinished moves" window says it once, with OK.

Before After
before: nothing is said after: the Unfinished moves window

Not pictured: the other texts (a record that can't be read, a sidecar that couldn't follow, a library that couldn't follow or save, a library open without its lock), and the window in the other 16 languages.

Merging

Checklist

  • No new panic path in non-test code
  • New text on screen goes through tr() / tr_format! with keys in all crates/ui-egui/locales/*.json; no new shortcut
  • The feature's rows in docs/parity-checklist.md are updated (no docs/gaps.md entry covered this)
  • New code has a caller
  • No new assets
  • Ready to merge

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Photo moves to folders now run in the background, with progress and results reported in the app. You can undo completed moves.
    • Interrupted moves are checked when the library reopens, with a notice summarizing recovered files and any issues.
    • The app warns before quitting during an active move and blocks conflicting operations until it finishes.
  • Bug Fixes

    • Improved handling of sidecars and partially completed moves, helping keep library records in sync with files on disk.
    • Move and recovery messages are available in additional languages.

@coderabbitai

coderabbitai Bot commented Oct 25, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between 77c0a6a and 7150411.

Files selected for processing: 74
  • apps/lightcraft-cli/src/main.rs
  • apps/lightcraft/src/main.rs
  • crates/engine/src/activity.rs
  • crates/engine/src/cmd/browse.rs
  • crates/engine/src/cmd/convert.rs
  • crates/engine/src/cmd/library/specs.rs
  • crates/engine/src/errors.rs
  • crates/engine/src/lib.rs
  • crates/engine/src/library.rs
  • crates/engine/src/move_intent.rs
  • crates/engine/src/move_job.rs
  • crates/engine/src/rename.rs
  • crates/engine/src/rename/fs.rs
  • crates/engine/src/rename/moves.rs
  • crates/engine/src/rename/plan.rs
  • crates/engine/src/sidecar.rs
  • crates/engine/src/tests.rs
  • crates/engine/src/tests/move_job.rs
  • crates/ui-egui/locales/cs-formats.json
  • crates/ui-egui/locales/cs.json
  • crates/ui-egui/locales/de-formats.json
  • crates/ui-egui/locales/de.json
  • crates/ui-egui/locales/es-formats.json
  • crates/ui-egui/locales/es.json
  • crates/ui-egui/locales/fi-formats.json
  • crates/ui-egui/locales/fi.json
  • crates/ui-egui/locales/fr-formats.json
  • crates/ui-egui/locales/fr.json
  • crates/ui-egui/locales/id-formats.json
  • crates/ui-egui/locales/id.json
  • crates/ui-egui/locales/it-formats.json
  • crates/ui-egui/locales/it.json
  • crates/ui-egui/locales/ja-formats.json
  • crates/ui-egui/locales/ja.json
  • crates/ui-egui/locales/ka-formats.json
  • crates/ui-egui/locales/ka.json
  • crates/ui-egui/locales/pl-formats.json
  • crates/ui-egui/locales/pl.json
  • crates/ui-egui/locales/pt-br-formats.json
  • crates/ui-egui/locales/pt-br.json
  • crates/ui-egui/locales/ru-formats.json
  • crates/ui-egui/locales/ru.json
  • crates/ui-egui/locales/sv-formats.json
  • crates/ui-egui/locales/sv.json
  • crates/ui-egui/locales/uk-formats.json
  • crates/ui-egui/locales/uk.json
  • crates/ui-egui/locales/vi-formats.json
  • crates/ui-egui/locales/vi.json
  • crates/ui-egui/locales/zh-hans-formats.json
  • crates/ui-egui/locales/zh-hans.json
  • crates/ui-egui/locales/zh-hant-formats.json
  • crates/ui-egui/locales/zh-hant.json
  • crates/ui-egui/src/app.rs
  • crates/ui-egui/src/app/frame.rs
  • crates/ui-egui/src/control.rs
  • crates/ui-egui/src/dialogs.rs
  • crates/ui-egui/src/dialogs/confirm.rs
  • crates/ui-egui/src/dialogs/import/task.rs
  • crates/ui-egui/src/dialogs/settings/libraries.rs
  • crates/ui-egui/src/headless.rs
  • crates/ui-egui/src/lib.rs
  • crates/ui-egui/src/menus/run.rs
  • crates/ui-egui/src/move_task.rs
  • crates/ui-egui/src/panels/grid.rs
  • crates/ui-egui/src/panels/left.rs
  • crates/ui-egui/src/panels/left/folders.rs
  • crates/ui-egui/src/panels/notices.rs
  • crates/ui-egui/src/tests.rs
  • crates/ui-egui/src/tests/folder_drop.rs
  • crates/ui-egui/src/tests/move_notice.rs
  • docs/background-tasks.md
  • docs/control-protocol.md
  • docs/parity-checklist.md
  • docs/whats-new.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

Walkthrough

This change runs photo moves as background jobs, records move intent for recovery, and processes interrupted moves when a library opens. The engine blocks selected conflicting operations while a move runs. The UI reports move progress, completion, and recovery results.

Changes: Photo move flow

Layer / File(s) Summary
Move execution and conflict handling
crates/engine/src/move_job.rs, crates/engine/src/cmd/*, crates/engine/src/lib.rs, crates/engine/src/errors.rs, crates/engine/src/rename/*, crates/engine/src/sidecar.rs, crates/engine/src/activity.rs, crates/engine/src/tests/move_job.rs
Photo moves now use a planned job with worker execution and library finalization. The engine tracks active source paths, defers sidecar writes, and refuses operations that conflict with a running move.
Durable move recovery
crates/engine/src/move_intent.rs, crates/engine/src/library.rs, crates/engine/src/cmd/library/specs.rs, apps/lightcraft-cli/src/main.rs, crates/engine/src/tests/move_job.rs, docs/parity-checklist.md, docs/whats-new.md
The engine records file moves and processes unfinished records when a library opens. Recovery reports relinked, waiting, and problematic moves, with handling that depends on whether the library lock is held.
Background move UI flow
crates/ui-egui/src/move_task.rs, crates/ui-egui/src/app.rs, crates/ui-egui/src/app/frame.rs, crates/ui-egui/src/control.rs, crates/ui-egui/src/dialogs/*, crates/ui-egui/src/menus/run.rs, crates/ui-egui/src/panels/*, crates/ui-egui/src/headless.rs, apps/lightcraft/src/main.rs, crates/ui-egui/src/tests/folder_drop.rs, docs/background-tasks.md, docs/control-protocol.md, docs/parity-checklist.md, docs/whats-new.md
Folder moves now start and report through a background task. The UI exposes running and last-move state, handles move conflicts in imports, and prompts before quitting during a move.
Recovery notices and localized messages
crates/ui-egui/src/panels/notices.rs, crates/ui-egui/src/tests/move_notice.rs, crates/ui-egui/locales/*
The UI displays a dismissible notice for recovered moves. Locale files add move-progress, error, and recovery messages, and remove the prior generic moved-count translation.

Priority: Normal

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant UI as LightcraftApp
  participant Engine as move_job
  participant Worker as MoveWork
  participant Files as Filesystem
  UI->>Engine: Start move with folder and photo IDs
  Engine->>Worker: Return planned work and finalizer
  Worker->>Files: Record intent and move files
  Worker-->>UI: Return move outcome
  UI->>Engine: Finish move and update library
Loading

Suggested reviewers: emmertex, aiongg

Merge Risk: Minimal · up to 71504

This change moves photo moves into background jobs, records interrupted moves for recovery on the next library open, and shows an "Unfinished moves" notice. No merge-blocking issue was found in the supplied review or in the checks run. Normal checks apply before merging.

Security architecture risk: Moderate · up to 71504

Durable records and move guards contain normal interruptions, but recovery relies on filenames to establish ownership. After external file changes it can attribute an unrelated file to an unfinished move, and cleanup can interfere with another library transferring into the same folder. These are bounded but meaningful recovery and failure-containment risks.

Retained concerns

  • Medium · reliability · inferred: Recovery cannot distinguish an arrived photo from an unrelated replacement at the recorded destination. Records contain only source and destination paths. When the source is absent, its parent remains accessible, and the destination is a regular file, recovery relinks the catalog and follows sidecars without checking durable file identity. External deletion or replacement while a record remains pending can therefore cause mistaken file attribution, weakening ownership and subsequent rollback. Initial destination checks and the stronger comparisons used when both paths exist do not establish identity across an interrupted session.
  • Medium · reliability · inferred: Recovery extends a library-local lock into cleanup authority over a shared destination folder. With the lock held, cleanup removes every partial whose name starts with the destination-specific prefix, including other process IDs. If another library is actively copying the same destination filename, recovery of an older record can unlink that worker's live partial and make placement fail. Exclusive partial creation does not prevent this deletion. Original-file retention and batch rollback limit the consequence, but do not provide isolation between independent libraries.
Security review details

Security Blast Radius

  • observed — Move authority comes from catalog-selected file paths and a caller-specified existing destination, under the desktop process's filesystem permissions. The planner rejects Local photos and non-file sources, but does not confine destinations to the library directory. Effects therefore include accessible external folders and associated sidecars, not only library metadata.

Trust Boundaries and Controls

  • observed — Without the library lock, recovery leaves earlier runs' records untouched and reports their unprotected status. Recovery of a failed current worker is scoped to that worker's recorded path. These controls protect library-local ownership, but do not establish exclusive ownership of files in a destination shared by different libraries.

Resilience and Maintainability Implications

  • observed — The existing cross-volume transfer preserves the original until copying and byte comparison succeed. This limits the live-partial cleanup concern to failed transfer and possible batch rollback rather than demonstrating loss of the original photo. The new recovery cleanup is nevertheless able to interfere with that previously independent transfer.

Hardening Proposals

  • proposed — Give each move durable operation identity and evidence sufficient to recognize its completed file and owned partials. Ambiguous destination attribution should remain unresolved rather than automatically relinking, and cleanup should require operation ownership or destination-level coordination rather than a library lock and filename prefix alone.
Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 74.70% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documenta… Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the main change: an “Unfinished moves” window that reports recovery findings after an interrupted move. It is specific and related to the pull request objectives.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 74.70% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 83 functions across 36 files. (38 skipped: 38 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Warning

Some tools did not complete. Review the errors below.

Clippy (1.99.0)

Clippy execution timed out

Comment @coderabbitai help to get the list of available commands.

@nledford

Copy link
Copy Markdown
Contributor Author

Rebased onto #2914 after #2913 (egui 0.37): the "Unfinished moves" window is now one of the prompts that own input (prompt_layer and prompt_key in panels/notices.rs know it, between the quit prompts and the settings-notice queue, and its window(…) call takes the shared notice_input); nothing else beyond the rebase.

@nledford

Copy link
Copy Markdown
Contributor Author

Rebased onto #2914's new head (a87f13a5ed); this PR's own commit applied without a conflict (new head 8d46e9294c). Still a draft, waiting on #1925 and then #2914.

nledford and others added 15 commits October 28, 2026 08:17
Co-Authored-By: Claude <noreply@anthropic.com>
… and the library didn't follow

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… by the library

Co-Authored-By: Claude <noreply@anthropic.com>
…he library or point them at another file

Delete Permanently, Empty Recently Deleted, an import that replaces a trashed photo, Convert to DNG, Find Missing Photos, Locate and a Synchronize relink are refused while the photo they would remove or relink is being moved, with the number of photos in the message. The check is in Session::commit, so every change that removes or relinks a photo is covered; Convert to DNG also checks before it writes a DNG.

The refusals are a new error kind (MoveInProgress) and the app shows them as a toast wherever the command came from; the status line they used to reach isn't drawn. A import batch the move refused says why instead of counting as not readable.
… toast, from start itself and from the move question
…n a set, and the docs say Quit asks while photos move
…first file moves, and nothing is removed before the library has the move
…pen found of a move cut short

The window shows once, with OK, what following the moves an earlier run cut short came to: photos pointed at their files, files that can't be reached now, copies removed, a record that can't be read, a library left alone for want of its lock. `ui.inspect` -> `moveNotice` is its text. Translated in every catalog.

Co-Authored-By: Claude <noreply@anthropic.com>
@nledford nledford changed the title LRC-LIB-LIBFOLDERS: an "Unfinished moves" window says what the next open found of a move cut short (stacked on #2914) LRC-LIB-LIBFOLDERS: an "Unfinished moves" window says what the next open found of a move cut short (stacked on #3119) Oct 29, 2026
@nledford
nledford marked this pull request as ready for review October 29, 2026 04:33

This branch has not been deployed

No deployments
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.

1 participant