Skip to content

LRC-LIB-UPDATEFOLDER: Update Folder Location for agents (folder.updateLocation, #1116) - #1121

Closed
mattsivak wants to merge 1 commit into
storytold:mainfrom
mattsivak:folder-update-location
Closed

mattsivak wants to merge 1 commit into
storytold:mainfrom
mattsivak:folder-update-location

Conversation

@mattsivak

Copy link
Copy Markdown
Contributor

Part of #1116 (first step). Also the engine half of #1112.

What

folder.updateLocation {path, to}: Lightroom Classic's Update Folder Location, for agents and MCP. A library folder or disk that is now somewhere else can be pointed at its new place as one undo step. That covers a folder moved or renamed outside LightCraft, a USB disk or NAS that came back at another drive letter or mount point, /Volumes/tokyo back as /Volumes/TOKYO, and a library made on another machine (D:\Photos\…).

  • Every photo in the folder, and in the folders inside it, is relinked to the same names under to.
  • Colour labels (folder records) go along: folder_records_follow, as Rename / Move Folder already does.
  • A chosen folder (source or filter) follows, and so do undo and redo.
  • No file is touched, and the old place doesn't need to exist.
  • Folders are compared by identity (folder_key), so either separator works and so does Windows case.
  • The command is refused, changing nothing, when:
    • one folder is inside the other;
    • a photo would land on one the library already has there;
    • it's the library's own folder;
    • to isn't a folder.

How

This is move_folder (Rename / Move Folder) without the disk rename. It's a Batch of the existing Op::Relinks plus the folder-record ops, so there's no new op and no catalog format change. It doesn't touch journal::VERSION, so it can't collide with #800 / #814 / #974.

The one engine change outside the command: FolderMove gains on_disk. The undo entry still carries the folder, so undo and redo make the chosen folder follow, but with on_disk: false they never rename anything on disk.

#1116 proposed a root table ((root, relative path)) first. While writing this, I found the existing relink + folder-record machinery already gives the user-visible result, without a format bump. The root table can still come later, if you want it for #880 (per-device paths) or to keep a whole-disk move small in the log. Each photo is one Relink in the step today, the same as Rename Folder.

Tests

In crates/engine/src/tests_folders.rs:

  • a disk that came back elsewhere: photos, labels of the folder and of a subfolder, and the chosen subfolder all follow; one undo step; undo and redo; no folder created or removed;
  • a case-only change (tokyo → TOKYO);
  • a library written on Windows (D:\Photos\…, both separators) pointed at a folder here;
  • every refusal leaves the catalog and the undo stack unchanged; the same place is a no-op.

Docs

  • docs/parity-checklist.md: a new row, LRC-LIB-UPDATEFOLDER (🟡: agents only for now); the two LRC-LIB-LIBFOLDERS limits it addresses now point at it; summary regenerated.
  • docs/whats-new.md: a new entry.

Next (separate PRs)

Checks

On macOS (Rust 1.99):

…eLocation, storytold#1116)

A library folder or disk that is now somewhere else (moved or renamed outside
LightCraft, a disk back at another drive letter or mount point, /Volumes/tokyo
back as /Volumes/TOKYO, a library from another machine's D:\) is pointed at its
new place in one undo step: its photos and those of the folders inside it are
relinked to the same names there, colour labels follow, and a chosen folder
follows on undo and redo. No file is touched; no catalog format change (a Batch
of Op::Relink plus folder-record ops, like Rename Folder). FolderMove gains
on_disk so the undo entry follows the folder without renaming anything.

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

Copy link
Copy Markdown
Contributor Author

Closing in favour of #1122, which does the same thing (same command id, same FolderMove { on_disk } undo flag) and more: it checks that the files are at the new place before relinking, handles Local records already there, and covers Recently Deleted and virtual copies. Thanks @nledford. The root table from #1116 can come later on top of it if the maintainers want it for #880.

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