Add renaming slave folders to the master's spelling

The "N folders are named differently" warning now offers to rename the
slave folders to match the master, marked as the recommended first step
after a scan (also linked from the dashboard card).

- A preview lists each rename with the differing characters highlighted;
  renames are selectable, and conflicts (the slave already has a folder
  with the master's name, symlinks, the quarantine) are skipped with a
  reason.
- Only renames the server computes itself are applied; a request can
  only narrow them down, never name arbitrary paths. Only slave folders
  are renamed.
- Case-only renames go through a temporary name so they also work on
  case-insensitive filesystems; a rename interrupted by a crash is
  completed on startup (the folder is never removed).
- Renaming everything repeats until folders revealed inside renamed ones
  (an album under a renamed artist) are fixed too, then rescans.
- Each rename is an operation in History that can be undone (which also
  rescans). Dry run records renames as planned.

Also fixes the Review list not refreshing after a job that started and
finished between two status polls, and logs the new path of operations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
cdnutterandClaude Opus 5.5 committed 2026-09-28 20:20:52 -07:00
1 parent 176a527ec7
commit 42161e4287
14 files changed
+684 -21

No files matched your search

+8
View File
@@ -93,15 +93,22 @@ func (s *Store) PruneSessions(ctx context.Context) {
// ---- warnings ----
// Warning codes.
const WarnRenamedFolders = "renamed_folders"
// Warning is a scan or validation notice, structured so the UI can lay it
// out (a heading, an explanation and a table of affected folders) rather
// than print one long sentence.
type Warning struct {
// Code identifies warnings the UI offers a fix for.
Code string `json:"code,omitempty"`
Title string `json:"title"`
Detail string `json:"detail,omitempty"`
Items []WarningItem `json:"items,omitempty"`
// Total is the full number of items when Items was truncated.
Total int `json:"total,omitempty"`
// Fixable is how many items the offered fix can handle automatically.
Fixable int `json:"fixable,omitempty"`
}
// WarningItem pairs a slave path with the master path it corresponds to.
@@ -645,6 +652,7 @@ const (
ActPromote = "promote" // master replaced by slave's file, then linked
ActBuild = "build" // master file linked into the slave (fresh library)
ActRemove = "remove" // slave hardlink removed (master copy kept)
ActRename = "rename" // slave folder renamed to the master's spelling
)
// Operation statuses.