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)
This commit is contained in:
Alby96 committed 2026-10-27 16:28:40 +01:00
1 parent 44e5b9da9e
commit 13c2ac321c
10 files changed
+961 -135

No files matched your search

+4
View File
@@ -87,6 +87,8 @@
<data name="Archive.Error.NewerFormat" xml:space="preserve"><value>{0} was written by a newer Chronos (format {1}).</value><comment>long: error sentence</comment></data>
<data name="Archive.Error.Offline" xml:space="preserve"><value>The archive {0} is offline.</value><comment>long: error sentence</comment></data>
<data name="Archive.Error.ReadOnly" xml:space="preserve"><value>The archive {0} is read-only.</value><comment>long: error sentence</comment></data>
<data name="Archive.Error.ReorganizeBusy.one" xml:space="preserve"><value>{0:N0} sequence kept its file names: a photo was in use.</value><comment>long: error sentence of a Reorganize job</comment></data>
<data name="Archive.Error.ReorganizeBusy.other" xml:space="preserve"><value>{0:N0} sequences kept their file names: a photo was in use.</value><comment>long: error sentence of a Reorganize job</comment></data>
<data name="Archive.Error.ReorganizeKept.one" xml:space="preserve"><value>{0:N0} sequence was not reorganized as planned: it changed after the plan.</value><comment>long: error sentence of a Reorganize job</comment></data>
<data name="Archive.Error.ReorganizeKept.other" xml:space="preserve"><value>{0:N0} sequences were not reorganized as planned: they changed after the plan.</value><comment>long: error sentence of a Reorganize job</comment></data>
<data name="Archive.Error.SourceChanged" xml:space="preserve"><value>{0} changed after the plan was made.</value><comment>long: error sentence</comment></data>
@@ -155,7 +157,9 @@
<data name="Archive.Log.ProxiesDone" xml:space="preserve"><value>{0}: made {1}, reused {2}, unreadable {3}, waiting {4}</value><comment>long: job log line; {4} frames whose proxy this host waits for from a client or render node</comment></data>
<data name="Archive.Log.ProxiesSent" xml:space="preserve"><value>Proxies for the server: {0} sent, {1} not sent</value><comment>long: job log line; {0} proxies sent; {1} proxies this PC could not make or the server refused</comment></data>
<data name="Archive.Log.ReorganizeDropped" xml:space="preserve"><value>Left as it was, changed after the plan: {0}</value><comment>long: job log line; {0} sequence title or folder</comment></data>
<data name="Archive.Log.ReorganizeFilesBusy" xml:space="preserve"><value>File names kept, a photo was in use: {0}</value><comment>long: job log line; {0} sequence title or folder</comment></data>
<data name="Archive.Log.ReorganizeFilesKept" xml:space="preserve"><value>File names kept, photos changed after the plan: {0}</value><comment>long: job log line; {0} sequence title or folder</comment></data>
<data name="Archive.Log.ReorganizeTitleKept" xml:space="preserve"><value>Title and file names kept, changed after the plan: {0}</value><comment>long: job log line; {0} sequence title or folder</comment></data>
<data name="Archive.Log.Reorganized" xml:space="preserve"><value>Sequences changed: {0}, files renamed: {1}</value><comment>long: job log line of a Reorganize; {0} sequences, {1} photos</comment></data>
<data name="Archive.Log.ReorganizedEarlier" xml:space="preserve"><value>The reorganization was completed when the archive was opened</value><comment>long: job log line</comment></data>
<data name="Archive.Log.ReportOnly" xml:space="preserve"><value>Report only: nothing was changed.</value><comment>long: job log line</comment></data>
+4
View File
@@ -82,6 +82,8 @@
<data name="Archive.Error.NewerFormat" xml:space="preserve"><value>{0} è stato scritto da un Chronos più recente (formato {1}).</value></data>
<data name="Archive.Error.Offline" xml:space="preserve"><value>L'archivio {0} non è raggiungibile.</value></data>
<data name="Archive.Error.ReadOnly" xml:space="preserve"><value>L'archivio {0} è di sola lettura.</value></data>
<data name="Archive.Error.ReorganizeBusy.one" xml:space="preserve"><value>{0:N0} sequenza ha mantenuto i nomi dei file: una foto era in uso.</value></data>
<data name="Archive.Error.ReorganizeBusy.other" xml:space="preserve"><value>{0:N0} sequenze hanno mantenuto i nomi dei file: una foto era in uso.</value></data>
<data name="Archive.Error.ReorganizeKept.one" xml:space="preserve"><value>{0:N0} sequenza non è stata riorganizzata come previsto: è cambiata dopo il piano.</value></data>
<data name="Archive.Error.ReorganizeKept.other" xml:space="preserve"><value>{0:N0} sequenze non sono state riorganizzate come previsto: sono cambiate dopo il piano.</value></data>
<data name="Archive.Error.SourceChanged" xml:space="preserve"><value>{0} è cambiato dopo la creazione del piano.</value></data>
@@ -150,7 +152,9 @@
<data name="Archive.Log.ProxiesDone" xml:space="preserve"><value>{0}: create {1}, riusate {2}, illeggibili {3}, in attesa {4}</value></data>
<data name="Archive.Log.ProxiesSent" xml:space="preserve"><value>Proxy per il server: {0} inviati, {1} non inviati</value></data>
<data name="Archive.Log.ReorganizeDropped" xml:space="preserve"><value>Lasciata com'era, cambiata dopo il piano: {0}</value></data>
<data name="Archive.Log.ReorganizeFilesBusy" xml:space="preserve"><value>Nomi dei file mantenuti, una foto era in uso: {0}</value></data>
<data name="Archive.Log.ReorganizeFilesKept" xml:space="preserve"><value>Nomi dei file mantenuti, foto cambiate dopo il piano: {0}</value></data>
<data name="Archive.Log.ReorganizeTitleKept" xml:space="preserve"><value>Titolo e nomi dei file mantenuti, cambiata dopo il piano: {0}</value></data>
<data name="Archive.Log.Reorganized" xml:space="preserve"><value>Sequenze cambiate: {0}, file rinominati: {1}</value></data>
<data name="Archive.Log.ReorganizedEarlier" xml:space="preserve"><value>La riorganizzazione è stata completata all'apertura dell'archivio</value></data>
<data name="Archive.Log.ReportOnly" xml:space="preserve"><value>Solo resoconto: nulla è stato modificato.</value></data>