Files
Chronos/src
Alby96 13c2ac321c fix(archive): Reorganize checks each step before it moves, holds a failed plan, recovers file renames safely
Owner review 2, phase 4a review findings on the renamer.

- File rename recovery is safe to run again from wherever it stopped: once every
  file is at its temporary name the journal says phase 2, as Run does, so a second
  recovery (after a failure, a crash or a sidecar that could not be written) never
  moves a file that reached its new name. A new name something else took meanwhile
  is never written over: that photo and its companions go back to their old names,
  or to the first free _2, _3, recorded in the journal before they move, and the
  frame names where its photo is. A journal is never deleted while a temporary file
  of it is still there.
- Every check that can refuse a step runs under the step's leases before anything of
  it moves: where its sequences are, strangers inside, its new folder taken since the
  plan (a restore, an upload), a sidecar of a newer format, a title edited since the
  plan (compare-and-set against the planned from-title, sidecar and index), and its
  file renames, compared by a digest of every move at the planned frames version (a
  verify that hashes photos does not bump the version). Once the folder moved, every
  index row follows it before any file is renamed, and a photo in use or files found
  changed keep their names: the step completes.
- The same checks run up front for a held plan, so its retry either fits or is given up.
- A failed move job holds its plan, as a pause does: an archive open no longer
  applies the rest unasked; only the job's retry does. File renames a step left
  half-way are still completed at an archive open.
- Each sequence changed is told as its step is journaled, so a pause or a failure
  never keeps it untold; the plan's journal keeps the tally of every run, so the job
  log counts the whole plan.
- A selected sequence deleted while the job waited is named in the log and the plan
  refused with the localized stale-plan error, not a raw ArgumentException.
- The dry run renames no file of a newer-format sidecar.

New log lines and error (en, it): title and file names kept, file names kept because
a photo was in use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 1d1c888120edd709dbb5341c1922bf85085c4857)
2026-10-27 16:28:40 +01:00
..