fix(server): keep convert dry runs like Reorganize's, say what a new sequence lacks

The convert endpoint planned the whole selection inside the HTTP request, again for
every mode, quality keystroke and confirmation, with no limit: behind a proxy an
all-sequence conversion could never get past its dry run or its apply.

- ReorganizePlanCache becomes PlanCache, shared by Reorganize and Convert: one plan
  per key made apart from the request, two at once across both kinds, eight kept,
  15-minute timeout, 5-minute lifetime, 503 plan_dropped. Keys are typed records
  (ReorganizePlanKey, ConvertPlanKey) that also say which exceptions are refusals.
- A conversion plan is keyed by archive, a convert stamp of the index
  (SequenceRepository.GetConvertStampAsync: the Reorganize stamp plus, per planned
  sequence, the photos' count, sizes, formats, pixel sizes and missing, corrupt,
  preview-only and undecodable flags), the sequences and the target with the
  quality that counts. Not the mode: the request's mode and options are set on the
  kept plan, and the free space is measured again at every request through the
  engine. A plan made while the volume was away is not kept (503 archive_offline).
- New sequence holds the converted copies alone: the dry run says the skipped
  photos are not copied into it (Archive.Convert.NotCopied.*, Server.Convert.OnPcNew),
  the panel's totals, column and confirmation give the count, and so does the
  desktop's summary.
- Panel: the preview is asked in Replace's neutral words; a dry run cut off by a
  proxy is asked again while the totals show how long it takes, plan_dropped is
  retried once; an apply the server let go plans again, a changed one shows
  Admin.Convert.PlanChanged, and one with no answer is not resent (its job may be
  queued).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit f0b1e379ce7c08b6d3459ab25ca6214c8f366f6c)
This commit is contained in:
Alby96 committed 2026-10-27 22:15:51 +01:00
1 parent d0bbd77c92
commit 8174852a2c
22 files changed
+927 -342

No files matched your search

+9 -4
View File
@@ -131,9 +131,13 @@ public sealed record ReorganizePlanDto(IReadOnlyList<ReorganizeStepDto> Steps, i
/// <see cref="Target"/> (<c>jpeg</c>, <c>tiff16</c> or <c>linear-dng</c>, the archival choice) with <see cref="Quality"/> 1–100
/// for a JPEG (default 95, ignored otherwise). <see cref="Mode"/>, chosen at every run: <c>replace</c> (the converted files
/// become the frames, the originals go to the archive's trash) or <c>new-sequence</c> (copies in a new sequence, the source
/// untouched). <see cref="DryRun"/> answers the plan (<see cref="ConvertPlanDto"/>) and changes nothing; the change itself
/// sends that plan's <see cref="Fingerprint"/> back (409 <c>plan_changed</c> when the archive changed since) and runs as a
/// <c>convert</c> job (202).
/// untouched, the photos it leaves as they are not copied into it). <see cref="DryRun"/> answers the plan
/// (<see cref="ConvertPlanDto"/>) and changes nothing; the server keeps it a few minutes, a refusal too, so the same dry run
/// again (also after one cut off, in either mode, at any quality of a lossless target) is answered from it with the free
/// space measured again; 503 <c>plan_dropped</c> when the server stopped making it (it took too long, or too many were
/// asked at once). The change itself sends that plan's <see cref="Fingerprint"/> back (409 <c>plan_changed</c> when the
/// index changed since in what the plan reads: the sequences' rows, and the formats, sizes, hashes and flags of their
/// photos) and runs as a <c>convert</c> job (202), which plans again and leaves as it is a sequence that no longer fits.
/// </summary>
public sealed record ConvertRequest(IReadOnlyList<Guid>? SequenceIds, bool All, string? Target, int? Quality, string? Mode, bool DryRun,
string? Fingerprint = null);
@@ -143,7 +147,8 @@ public sealed record ConvertRequest(IReadOnlyList<Guid>? SequenceIds, bool All,
/// server cannot read them at full resolution: a CR3, a HEIC, a body its RAW decoder does not support), <c>undecodable</c>,
/// <c>missing</c>, <c>unhashed</c> (never verified), <c>eight_bit</c> (a RAW the host develops at 8 bits only, for a 16-bit
/// target), <c>color_profile</c> (a colour profile the target can neither keep nor convert to) or <c>too_large</c>, how
/// many, and the reason as one localised sentence.
/// many, and the reason as one localised sentence: with <c>new-sequence</c>, that the new sequence lacks them (it holds the
/// converted copies alone).
/// </summary>
public sealed record ConvertSkippedDto(string Reason, int Photos, string Message);