Files
Chronos/tests/Chronos.Core.Tests/Conversion
Alby96 67a6d51cbe fix(archive): convert job applies exactly the confirmed plan, resumes safely and watches its space
The convert job planned every sequence again when it ran and checked only the frames
version, so a verify, a repaired upload or a tier change between the dry run and the job
let it replace photos the confirmed plan had listed as staying unchanged.

- Each sequence of a convert job now carries the digest of the photos it converts, each
  with its SHA-256 (ConvertSequencePlan.Digest, also in the plan's fingerprint). Under the
  sequence's lease, its sidecar settled, the job plans it again and goes on only while the
  digest matches; it then pins those photos (convert-<job>.pins), so photos that come in
  or are verified later stay as they are, a retry included. Stage B checks under the lease
  that every pinned photo still holds the content converted instead of holding the frames
  version, so a sequence still receiving uploads converts what was confirmed.
- A resumed job settles the journals a crash left in a sequence (a half-done replacement
  among them) before it plans, and reports a sequence its replacement completed as
  Converted, never Nothing or a partial swap.
- The passes a converted or new sequence needs are queued as soon as its outcome is
  journaled; the journal records the statuses they follow from and whether they were
  queued, so a pause, yield, stop or crash no longer loses them.
- Staged conversions of a blocked or failed sequence are kept for the retry, which
  re-verifies and takes them; maintenance keeps a convert job's staging while the job is
  queued, running or paused, and removes its journal and staging once the job is done or
  gone from the history.
- A dry run counts the sequences of a queued conversion as busy, so the same conversion
  cannot be confirmed twice.
- New sequence copies are owned by the source's owner, else by the requesting user's id
  (never the user name); a staged copy that vanished fails the sequence instead of leaving
  its photo out; the job log states how many photos stayed in the source alone.
- Free space is measured where the conversion writes: the server takes the tighter of the
  space path's volume and the archive's own (Unraid cache), the desktop asks Windows
  (GetDiskFreeSpaceEx), which also measures UNC archives; the job checks again before each
  sequence and each photo, scaling estimates by the files staged so far, and stops before
  the volume fills with what it staged kept.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 2d7d461c33b9f257bf57793cc7cf331d0425c14e)
2026-10-27 22:06:55 +01:00
..