fix(archive): settle trash journals under their leases and say why restored photos stayed

Second fix round of owner review 2, phase 3 (engine, server, desktop).

- A photo never hashed whose original is missing can be deleted again: it goes
  into its trash record without a file and without a tombstone (nothing is left
  to name), stays listed until Empty erases it, and a restore keeps it with the
  reason "no file". FrameDeleteBlock.Unhashable now blocks only a present
  original that cannot be read; the API answers it as 409 photo_unreadable
  naming the photo, and every block has its own code and message.
- Deleting a whole sequence first settles an interrupted photo deletion,
  restore or ingest of it (ReadLocked under its lease), so no journal or half
  entry travels into the sequence's trash entry; it refuses while a restore
  into it waits for its busy entry.
- FrameTrash.Settle takes the photo entry's lease and leaves the journal for
  later while the entry is busy (an emptying), so it never races EraseAsync;
  meanwhile no other restore writes its journal over it and scans do not adopt
  its files.
- The hashes computed for frames that stay (to find a twin of a deleted photo)
  go into the sidecar and index, and only a frame whose first and last 64 KiB
  match a deleted photo's is read whole.
- A restore into a new sequence rewrites its record after each photo filed, so
  a crash or a database failure never leaves filed photos listed.
- An upload completion no longer has a window before the commit: the ingest
  checks the sidecar's tombstones under the sequence lease a deletion takes
  (IngestRequest.RefuseRemoved), unless the upload asked to bring it back.
- A restore reports each kept photo with its reason (no longer matches its
  record, could not be moved back, already in the sequence, had no file); the
  desktop line and the API message say so in en and it, and the tooltip holds
  the whole sentence. The desktop tells TrashMismatchException by its type.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 1858f1f450a35fb8383ede8d80ce5f8de9b7ceac)
This commit is contained in:
Alby96 committed 2026-10-27 13:53:41 +01:00
1 parent a133306fb0
commit 4518ffe655
29 files changed
+856 -162

No files matched your search

-2
View File
@@ -759,8 +759,6 @@
<data name="Admin.Trash.EntryCount.one" xml:space="preserve"><value>{0} entry</value></data>
<data name="Admin.Trash.EntryCount.other" xml:space="preserve"><value>{0} entries</value></data>
<data name="Admin.Trash.IsEmpty" xml:space="preserve"><value>The trash is empty</value></data>
<data name="Admin.Trash.Kept.one" xml:space="preserve"><value>{0} file stays in the trash: it no longer matches its record.</value><comment>long</comment></data>
<data name="Admin.Trash.Kept.other" xml:space="preserve"><value>{0} files stay in the trash: they no longer match their record.</value><comment>long</comment></data>
<data name="Admin.Trash.Kind" xml:space="preserve"><value>Kind</value></data>
<data name="Admin.Trash.Kind.Photos" xml:space="preserve"><value>Photos</value></data>
<data name="Admin.Trash.Kind.Replaced" xml:space="preserve"><value>Replaced</value></data>
+12 -2
View File
@@ -266,8 +266,18 @@
<data name="Archive.Trash.Erase" xml:space="preserve"><value>Erase for good</value></data>
<data name="Archive.Trash.Failed" xml:space="preserve"><value>The sequence could not come back from the trash</value><comment>long</comment></data>
<data name="Archive.Trash.Heading" xml:space="preserve"><value>Trash · {0}</value><comment>long</comment></data>
<data name="Archive.Trash.KeptFiles.one" xml:space="preserve"><value>{0:N0} file stayed in the trash: it no longer matches its record.</value><comment>long</comment></data>
<data name="Archive.Trash.KeptFiles.other" xml:space="preserve"><value>{0:N0} files stayed in the trash: they no longer match their record.</value><comment>long</comment></data>
<data name="Archive.Trash.Kept.InSequence.one" xml:space="preserve"><value>{0:N0} photo stayed in the trash: the sequence holds it already.</value><comment>long</comment></data>
<data name="Archive.Trash.Kept.InSequence.other" xml:space="preserve"><value>{0:N0} photos stayed in the trash: the sequence holds them already.</value><comment>long</comment></data>
<data name="Archive.Trash.Kept.Mismatch.one" xml:space="preserve"><value>{0:N0} photo stayed in the trash: it no longer matches its record.</value><comment>long</comment></data>
<data name="Archive.Trash.Kept.Mismatch.other" xml:space="preserve"><value>{0:N0} photos stayed in the trash: they no longer match their record.</value><comment>long</comment></data>
<data name="Archive.Trash.Kept.NoFile.one" xml:space="preserve"><value>{0:N0} photo stayed in the trash: its file was already missing when it was deleted.</value><comment>long</comment></data>
<data name="Archive.Trash.Kept.NoFile.other" xml:space="preserve"><value>{0:N0} photos stayed in the trash: their files were already missing when they were deleted.</value><comment>long</comment></data>
<data name="Archive.Trash.Kept.NotMoved.one" xml:space="preserve"><value>{0:N0} photo stayed in the trash: it could not be moved back.</value><comment>long</comment></data>
<data name="Archive.Trash.Kept.NotMoved.other" xml:space="preserve"><value>{0:N0} photos stayed in the trash: they could not be moved back.</value><comment>long</comment></data>
<data name="Archive.Trash.KeptMore.one" xml:space="preserve"><value>+ {0:N0} more</value><comment>long</comment></data>
<data name="Archive.Trash.KeptMore.other" xml:space="preserve"><value>+ {0:N0} more</value><comment>long</comment></data>
<data name="Archive.Trash.KeptPhotos.one" xml:space="preserve"><value>{0:N0} photo stayed in the trash.</value><comment>long</comment></data>
<data name="Archive.Trash.KeptPhotos.other" xml:space="preserve"><value>{0:N0} photos stayed in the trash.</value><comment>long</comment></data>
<data name="Archive.Trash.Kind.Photos" xml:space="preserve"><value>Photos</value></data>
<data name="Archive.Trash.Kind.Replaced" xml:space="preserve"><value>Replaced originals</value></data>
<data name="Archive.Trash.Kind.Sequence" xml:space="preserve"><value>Sequence</value></data>
+1
View File
@@ -74,6 +74,7 @@
<data name="Server.Error.NotChronos" xml:space="preserve"><value>That address is not a Chronos Server.</value><comment>long</comment></data>
<data name="Server.Error.PasswordChangeRequired" xml:space="preserve"><value>Change your password first.</value><comment>long</comment></data>
<data name="Server.Error.PhotoRemoved" xml:space="preserve"><value>The photo was deleted from the sequence while it was being uploaded, so it was not added.</value><comment>long</comment></data>
<data name="Server.Error.PhotoUnreadable" xml:space="preserve"><value>{0} cannot be read, and without its hash other copies would not learn it was deleted; close the program using it or check its permissions, then try again.</value><comment>long</comment></data>
<data name="Server.Error.ProxyUntrusted" xml:space="preserve"><value>This page did not come through a trusted proxy over HTTPS. Open it through your proxy, or add the proxy's address to CHRONOS_TRUSTED_PROXIES.</value><comment>long</comment></data>
<data name="Server.Error.ProxiesDisabled" xml:space="preserve"><value>This archive makes no proxies.</value><comment>long</comment></data>
<data name="Server.Error.ProxyMismatch" xml:space="preserve"><value>The proxy was made from another photo.</value><comment>long</comment></data>
-2
View File
@@ -757,8 +757,6 @@
<data name="Admin.Trash.EntryCount.one" xml:space="preserve"><value>{0} voce</value></data>
<data name="Admin.Trash.EntryCount.other" xml:space="preserve"><value>{0} voci</value></data>
<data name="Admin.Trash.IsEmpty" xml:space="preserve"><value>Il cestino è vuoto</value></data>
<data name="Admin.Trash.Kept.one" xml:space="preserve"><value>{0} file resta nel cestino: non corrisponde più al suo record.</value><comment>long</comment></data>
<data name="Admin.Trash.Kept.other" xml:space="preserve"><value>{0} file restano nel cestino: non corrispondono più al loro record.</value><comment>long</comment></data>
<data name="Admin.Trash.Kind" xml:space="preserve"><value>Tipo</value></data>
<data name="Admin.Trash.Kind.Photos" xml:space="preserve"><value>Foto</value></data>
<data name="Admin.Trash.Kind.Replaced" xml:space="preserve"><value>Sostituite</value></data>
+12 -2
View File
@@ -259,8 +259,18 @@
<data name="Archive.Trash.Erase" xml:space="preserve"><value>Cancella per sempre</value></data>
<data name="Archive.Trash.Failed" xml:space="preserve"><value>Impossibile ripristinare la sequenza dal cestino</value></data>
<data name="Archive.Trash.Heading" xml:space="preserve"><value>Cestino · {0}</value></data>
<data name="Archive.Trash.KeptFiles.one" xml:space="preserve"><value>{0:N0} file è rimasto nel cestino: non corrisponde più al suo registro.</value></data>
<data name="Archive.Trash.KeptFiles.other" xml:space="preserve"><value>{0:N0} file sono rimasti nel cestino: non corrispondono più al loro registro.</value></data>
<data name="Archive.Trash.Kept.InSequence.one" xml:space="preserve"><value>{0:N0} foto è rimasta nel cestino: la sequenza la contiene già.</value></data>
<data name="Archive.Trash.Kept.InSequence.other" xml:space="preserve"><value>{0:N0} foto sono rimaste nel cestino: la sequenza le contiene già.</value></data>
<data name="Archive.Trash.Kept.Mismatch.one" xml:space="preserve"><value>{0:N0} foto è rimasta nel cestino: non corrisponde più al suo registro.</value></data>
<data name="Archive.Trash.Kept.Mismatch.other" xml:space="preserve"><value>{0:N0} foto sono rimaste nel cestino: non corrispondono più al loro registro.</value></data>
<data name="Archive.Trash.Kept.NoFile.one" xml:space="preserve"><value>{0:N0} foto è rimasta nel cestino: quando è stata eliminata il suo file mancava già.</value></data>
<data name="Archive.Trash.Kept.NoFile.other" xml:space="preserve"><value>{0:N0} foto sono rimaste nel cestino: quando sono state eliminate i loro file mancavano già.</value></data>
<data name="Archive.Trash.Kept.NotMoved.one" xml:space="preserve"><value>{0:N0} foto è rimasta nel cestino: non è stato possibile riportarla nella sequenza.</value></data>
<data name="Archive.Trash.Kept.NotMoved.other" xml:space="preserve"><value>{0:N0} foto sono rimaste nel cestino: non è stato possibile riportarle nella sequenza.</value></data>
<data name="Archive.Trash.KeptMore.one" xml:space="preserve"><value>+ un'altra</value></data>
<data name="Archive.Trash.KeptMore.other" xml:space="preserve"><value>+ altre {0:N0}</value></data>
<data name="Archive.Trash.KeptPhotos.one" xml:space="preserve"><value>{0:N0} foto è rimasta nel cestino.</value></data>
<data name="Archive.Trash.KeptPhotos.other" xml:space="preserve"><value>{0:N0} foto sono rimaste nel cestino.</value></data>
<data name="Archive.Trash.Kind.Photos" xml:space="preserve"><value>Foto</value></data>
<data name="Archive.Trash.Kind.Replaced" xml:space="preserve"><value>Originali sostituiti</value></data>
<data name="Archive.Trash.Kind.Sequence" xml:space="preserve"><value>Sequenza</value></data>
+1
View File
@@ -72,6 +72,7 @@
<data name="Server.Error.NotChronos" xml:space="preserve"><value>Questo indirizzo non è un Chronos Server.</value></data>
<data name="Server.Error.PasswordChangeRequired" xml:space="preserve"><value>Cambia prima la password.</value></data>
<data name="Server.Error.PhotoRemoved" xml:space="preserve"><value>La foto è stata eliminata dalla sequenza mentre veniva caricata, quindi non è stata aggiunta.</value><comment>long</comment></data>
<data name="Server.Error.PhotoUnreadable" xml:space="preserve"><value>Impossibile leggere {0}: senza il suo hash le altre copie non saprebbero che è stato eliminato. Chiudi il programma che lo usa o controlla i permessi, poi riprova.</value></data>
<data name="Server.Error.ProxyUntrusted" xml:space="preserve"><value>Questa pagina non è arrivata da un proxy attendibile in HTTPS. Aprila tramite il proxy o aggiungi l'indirizzo del proxy a CHRONOS_TRUSTED_PROXIES.</value></data>
<data name="Server.Error.ProxiesDisabled" xml:space="preserve"><value>Questo archivio non crea proxy.</value></data>
<data name="Server.Error.ProxyMismatch" xml:space="preserve"><value>Il proxy è stato creato da un'altra foto.</value></data>