fix(server): a verify that hashes photos plans Reorganize again; keep refusals, bound planning

The kept-plan stamp left out whether a planned sequence's photos are hashed.
A verify writes frames.sha256 (and only status and verified_at on the row)
without another frames version, so after verifying never-hashed photos the
same dry run kept answering "verify the sequence first" for up to five
minutes, and its confirmation queued a job certain to fail.

- SequenceRepository.GetStampAsync adds, for every planned sequence, how many
  of its photos have their hash in the index (one grouped query over the
  archive with all, the selected ids in batches of 500 otherwise).
- ReorganizePlanCache keeps a refusal (nested_target, not_found) as it keeps
  a plan: for the same stamp and templates it is the same, and a long plan
  that ends refused after a cut-off is no longer planned again on every retry.
  Failures are still not kept.
- Planning is bounded: at most two plans are made at once, the others wait for
  their turn; a plan still being made 15 minutes after it was asked, let go at
  capacity, or when the server stops is cancelled, and whoever waits for it
  gets 503 plan_dropped. A read that hangs keeps its turn until it returns but
  no longer keeps its waiters.
- The Capacity summary now says what eviction does (the kept plan asked for
  first, else the plan being made asked for first); the stamp, protocol and
  endpoint docs say that a verify hashing photos is a change the plan reads.
- Tests: a scan's photos, verified, are planned again and renamed by the job;
  the stamp follows hashes of planned photos only; refusals kept, failures
  not; turns, eviction and deadline of plans being made, a hung read included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 56582df45453fc555e525f19de7de1803204d12c)
This commit is contained in:
Alby96 committed 2026-10-27 19:16:42 +01:00
1 parent c3756d03c9
commit 1fb040afe6
8 files changed
+320 -58

No files matched your search

+1
View File
@@ -77,6 +77,7 @@
<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.PlanChanged" xml:space="preserve"><value>The archive changed after the dry run; review the plan again.</value><comment>long</comment></data>
<data name="Server.Error.PlanDropped" xml:space="preserve"><value>The server stopped making this plan: it took too long, or too many were asked at once; try again shortly.</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>
+1
View File
@@ -75,6 +75,7 @@
<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.PlanChanged" xml:space="preserve"><value>L'archivio è cambiato dopo la simulazione; rivedi di nuovo il piano.</value></data>
<data name="Server.Error.PlanDropped" xml:space="preserve"><value>Il server ha smesso di preparare questo piano: richiedeva troppo tempo, o ne sono stati chiesti troppi insieme; riprova tra poco.</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>