fix(convert): the job converts exactly the photos its preview listed, once

A conversion job could still do something its confirmed dry run did not show,
or refuse what it should have converted:

- An upload landing between the confirmation and the sequence's turn made the
  sequence Changed at every retry. Each ConvertSequence now names the photos
  the plan converts (Photos, their frame ids); the job takes those from its
  re-plan, checks their content against the confirmed digest and leaves photos
  that came in since as they are. A photo the plan did not list is never
  converted, whatever changed on disk or in the index since the dry run.
- A file another program held during the dry run was planned as Missing and
  then converted or not depending on the re-plan. It is now its own reason
  (inaccessible, "held open or cannot be opened"); a truncated file reads as
  undecodable. At job time a confirmed photo that cannot be opened leaves the
  sequence Blocked for the retry; a held photo the job does not convert does
  not hide a real change.
- The same sequences could be converted twice (two dialogs or tabs, a lost
  answer, no dry run at all). MassConverter.QueueAsync checks the queued,
  running and paused conversions and queues under one lock, in the caller's
  context (the desktop's enqueue shows a toast on the UI thread); a job's own
  re-plan treats sequences of conversions queued before it as busy.
- The per-photo space check reserved a full batch of photos even when fewer
  were left, so a job whose preview had the space could stop at every retry.
  It now reserves the photo and those after it that may convert at once.
- New sequence now says in the dry run, the panel's totals and confirmation,
  and a new desktop confirmation, how many photos each new sequence lacks;
  only sequences that are copied use those words.
- On the server, a confirmation takes only the plan kept for the index as it
  is now (503 plan_dropped otherwise, never a plan made inside the request),
  and busy sequences and free space are as they are at every request. The
  panel's Apply asks the dry run again first, with Close still available,
  and confirms only the same fingerprint.
- Maintenance keeps another host's conversion staging as long as its journal
  and purges both together; the unstaged-copy failure and blocked sequences
  are logged in catalog sentences.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit fefd9c34ebfeed1f9e84161610ef286026d38355)
This commit is contained in:
Alby96 committed 2026-11-02 10:33:34 +01:00
1 parent 5b5acaf307
commit c669d0504d
25 files changed
+1307 -226

No files matched your search

@@ -1,3 +1,4 @@
using System.Runtime.Versioning;
using System.Security.Cryptography;
using System.Text.Json;
using Chronos.Core.Archiving;
@@ -109,6 +110,54 @@ public sealed class ConvertTests(TestContext context)
private static bool StagedAnything(ArchiveFixture fx) =>
Directory.Exists(Staging(fx)) && Directory.EnumerateDirectories(Staging(fx), "convert-*").Any();
/// <summary>
/// Makes <paramref name="path"/> unreadable until disposed, as another program holding it does: without read permission
/// where that stops the test process (UnauthorizedAccessException), otherwise (Windows, root) held open without sharing
/// (IOException).
/// </summary>
private static IDisposable Unreadable(string path)
{
if (!OperatingSystem.IsWindows())
{
var mode = File.GetUnixFileMode(path);
File.SetUnixFileMode(path, UnixFileMode.None);
try
{
File.OpenRead(path).Dispose();
File.SetUnixFileMode(path, mode);
}
catch (UnauthorizedAccessException)
{
return new UnixPermissions(path, mode);
}
}
return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.None);
}
/// <summary>Gives a file its permissions back.</summary>
[UnsupportedOSPlatform("windows")]
private sealed class UnixPermissions(string path, UnixFileMode mode) : IDisposable
{
public void Dispose() => File.SetUnixFileMode(path, mode);
}
/// <summary>A queued conversion job of <paramref name="plan"/>, as the engine would hold it, created at <paramref name="created"/>.</summary>
private static async Task<Job> QueuedAsync(ArchiveFixture fx, ConvertPlan plan, DateTimeOffset created)
{
var request = ArchiveJobs.Convert(fx.Archive, plan);
var job = new Job
{
Id = Guid.CreateVersion7(),
Kind = request.Kind,
TargetIds = request.Targets,
ParametersJson = request.ParametersJson,
State = JobState.Queued,
Created = created,
};
await fx.Db.Jobs.EnqueueAsync(job, fx.Ct);
return job;
}
[Test]
public async Task TheDryRunCountsWhatConvertsAndChangesNothing()
{
@@ -444,19 +493,60 @@ public sealed class ConvertTests(TestContext context)
public async Task ASequenceThatChangedAfterThePlanIsLeftAsItWas()
{
await using var fx = await FixtureAsync();
var id = await UploadedAsync(fx, 2);
var id = await UploadedAsync(fx, 3);
var engine = await fx.StartEngineAsync();
var plan = await PlanAsync(fx, ConvertTarget.LinearDng, ConvertMode.Replace, id);
// Another photo arrives before the job runs.
var (path, size, sha) = fx.Stage(Start.AddSeconds(60), 999);
await fx.Service.Ingest.CommitAsync(new IngestRequest(fx.Archive.Id, id, null, null, path, "IMG_0099.JPG", size, sha, null, null), fx.Ct);
// A photo of the plan is deleted before the job runs.
var sequence = (await fx.Db.Sequences.GetAsync(id))!;
var delete = await fx.Service.FrameTrash.PlanDeleteAsync(id, [(await FramesAsync(fx, id))[1].Id], sequence.FramesVersion, fx.Ct);
await fx.Service.FrameTrash.DeleteAsync(delete, "alberto", null, fx.Ct);
var before = await Photos.DumpIndexAsync(fx.Db, fx.Archive.Id);
var job = await RunAsync(fx, engine, plan, JobState.Failed);
Assert.Equal(Loc.Plural("Archive.Error.ConvertKept", 1), job.Error);
Assert.Contains(Loc.L("Archive.Log.ConvertChanged", (await fx.Db.Sequences.GetAsync(id))!.DisplayTitle), job.LogTail);
var changed = Loc.L("Archive.Log.ConvertChanged", sequence.DisplayTitle);
Assert.Contains(changed, job.LogTail);
Assert.Equal(before, await Photos.DumpIndexAsync(fx.Db, fx.Archive.Id));
Assert.Empty(await fx.Service.ListTrashAsync(fx.Archive.Id, fx.Ct));
Assert.DoesNotContain(TrashKind.Replaced, (await fx.Service.ListTrashAsync(fx.Archive.Id, fx.Ct)).Select(e => e.Kind));
// The refusal holds on a retry too, and says so: the user plans again.
await engine.ResumeAsync(job.Id, fx.Ct);
Assert.Contains(changed, (await fx.WaitForAsync(job.Id, JobState.Failed)).LogTail);
Assert.Equal(before, await Photos.DumpIndexAsync(fx.Db, fx.Archive.Id));
}
[Test]
public async Task PhotosThatComeInWhileTheJobWaitsItsTurnStayAsTheyAreAndThoseConfirmedConvert()
{
foreach (var mode in new[] { ConvertMode.Replace, ConvertMode.NewSequence })
{
await using var fx = await FixtureAsync();
var id = await UploadedAsync(fx, 2);
var engine = await fx.StartEngineAsync();
var plan = await PlanAsync(fx, ConvertTarget.Tiff16, mode, id);
var title = (await fx.Db.Sequences.GetAsync(id))!.DisplayTitle;
// An upload lands after the confirmation, before the job comes to the sequence (it waited behind a render, or
// behind other sequences).
var (path, size, sha) = fx.Stage(Start.AddSeconds(60), 999);
await fx.Service.Ingest.CommitAsync(new IngestRequest(fx.Archive.Id, id, null, null, path, "IMG_0099.JPG", size, sha, null, null), fx.Ct);
var job = await RunAsync(fx, engine, plan);
var frames = await FramesAsync(fx, id);
Assert.Equal((sha, ImageFileFormat.Jpeg), frames.Where(f => f.Sha256 == sha).Select(f => (f.Sha256, f.Format)).Single(), mode.ToString());
if (mode == ConvertMode.Replace)
{
Assert.Contains(Loc.L("Archive.Log.Converted", title, 2), job.LogTail);
Assert.Equal(2, frames.Count(f => f.Format == ImageFileFormat.Tiff));
Assert.Equal(2, (await fx.Service.ListTrashAsync(fx.Archive.Id, fx.Ct)).Single().Frames);
}
else
{
Assert.Contains(Loc.L("Archive.Log.ConvertedNew", title, 2), job.LogTail);
Assert.Contains(Loc.L("Archive.Log.ConvertLeftOut", title, 1), job.LogTail);
var made = Assert.NotNull(await fx.Db.Sequences.FindBySessionKeyAsync(fx.Archive.Id, MassConverter.SessionKey(job.Id, id)));
Assert.True((await FramesAsync(fx, made)) is { Count: 2 } copies && copies.All(f => f.Format == ImageFileFormat.Tiff));
Assert.True(frames.All(f => f.Format == ImageFileFormat.Jpeg));
}
}
}
[Test]
@@ -803,19 +893,16 @@ public sealed class ConvertTests(TestContext context)
Assert.Equal((2, ConvertSkip.Unhashed), (plan.Frames, plan.Sequences.Single().Skipped.Single().Reason));
// A verify then hashes it before the job runs, as ArchiveVerifier does: no new frames version.
ManifestStore.WriteSequence(path, verified);
var before = await Photos.DumpIndexAsync(fx.Db, fx.Archive.Id);
var job = await RunAsync(fx, engine, plan, JobState.Failed);
Assert.Equal(Loc.Plural("Archive.Error.ConvertKept", 1), job.Error);
Assert.Contains(Loc.L("Archive.Log.ConvertChanged", sequence.DisplayTitle), job.LogTail);
Assert.Equal(before, await Photos.DumpIndexAsync(fx.Db, fx.Archive.Id));
Assert.SequenceEqual(verified.Frames.Select(f => (f.Id, f.Sha256, f.File)), ManifestStore.ReadSequence(path).Frames.Select(f => (f.Id, f.Sha256, f.File)));
Assert.Empty(await fx.Service.ListTrashAsync(fx.Archive.Id, fx.Ct));
// The job converts the two photos the plan listed, and leaves the third as it is, as the dry run said.
var job = await RunAsync(fx, engine, plan);
Assert.Contains(Loc.L("Archive.Log.Converted", sequence.DisplayTitle, 2), job.LogTail);
var frames = await FramesAsync(fx, id);
Assert.SequenceEqual(verified.Frames.Select(f => f.Id), frames.Select(f => f.Id));
Assert.Equal((verified.Frames[1].Sha256, ImageFileFormat.Jpeg), (frames[1].Sha256, frames[1].Format));
Assert.True(frames[0].Format == ImageFileFormat.Dng && frames[2].Format == ImageFileFormat.Dng);
Assert.Equal(2, (await fx.Service.ListTrashAsync(fx.Archive.Id, fx.Ct)).Single().Frames);
Assert.False(StagedAnything(fx));
// A retry does not convert it either: the user plans again.
await engine.ResumeAsync(job.Id, fx.Ct);
await fx.WaitForAsync(job.Id, JobState.Failed);
Assert.Empty(await fx.Service.ListTrashAsync(fx.Archive.Id, fx.Ct));
}
[Test]
@@ -988,6 +1075,8 @@ public sealed class ConvertTests(TestContext context)
var failed = (await RunHereAsync(fx, plan, jobId, callbacks)).Sequences.Single();
Assert.Equal(ConvertOutcome.Failed, failed.Outcome);
// Why, in the catalog's words: the job log has no English exception text.
Assert.Equal(Loc.L("Archive.Convert.NotPlaced", Loc.L("Archive.Convert.Unstaged", first.File)), failed.Error);
Assert.Null(await fx.Db.Sequences.FindBySessionKeyAsync(fx.Archive.Id, MassConverter.SessionKey(jobId, id)));
// The retry converts that photo again and makes the whole copy.
var made = (await RunHereAsync(fx, plan, jobId)).Sequences.Single();
@@ -1055,6 +1144,7 @@ public sealed class ConvertTests(TestContext context)
var paused = Guid.CreateVersion7();
var finished = Guid.CreateVersion7();
var forgotten = Guid.CreateVersion7();
var stray = Guid.CreateVersion7();
foreach (var (id, state) in new[] { (paused, JobState.Paused), (finished, JobState.Done) })
await fx.Db.Jobs.EnqueueAsync(new Job { Id = id, Kind = JobKind.Convert, State = state, Created = DateTimeOffset.UtcNow }, fx.Ct);
string Staged(Guid job)
@@ -1073,22 +1163,196 @@ public sealed class ConvertTests(TestContext context)
var (pausedFile, pausedJournal) = (Staged(paused), Journal(paused));
var (finishedFile, finishedJournal) = (Staged(finished), Journal(finished));
var (forgottenFile, forgottenJournal) = (Staged(forgotten), Journal(forgotten));
var strayFile = Staged(stray);
var dry = await fx.Service.Maintenance.RunAsync(fx.Archive, dryRun: true, 0, _ => ValueTask.CompletedTask, fx.Ct);
Assert.SequenceEqual(new[] { finishedFile, finishedJournal, forgottenFile }.Select(fx.Paths.ToRelative).Order(), dry.TemporaryFiles.Order());
Assert.SequenceEqual(new[] { finishedFile, finishedJournal, strayFile }.Select(fx.Paths.ToRelative).Order(), dry.TemporaryFiles.Order());
await fx.Service.Maintenance.RunAsync(fx.Archive, dryRun: false, 0, _ => ValueTask.CompletedTask, fx.Ct);
// A paused job's staged conversions stay however old; a finished job's go with its journal; a job this index does not
// know (another host's, or forgotten by the history) loses staged files idle for a day, and keeps its journal a while.
// A paused job's staged conversions stay however old; a finished job's go with its journal. A job this index does not
// know (another host's on a shared archive, or forgotten by the history) may still resume where it is known: its
// staged conversions stay as long as its journal; without a journal no resume can use them, and they go once idle.
Assert.FileExists(pausedFile);
Assert.FileExists(pausedJournal);
Assert.False(Directory.Exists(Path.Combine(Staging(fx), MassConverter.StagingFolder(finished))));
Assert.FileMissing(finishedJournal);
Assert.False(Directory.Exists(Path.Combine(Staging(fx), MassConverter.StagingFolder(forgotten))));
Assert.FileMissing(forgottenFile);
Assert.FileExists(forgottenFile);
Assert.FileExists(forgottenJournal);
File.SetLastWriteTimeUtc(forgottenJournal, DateTime.UtcNow.AddDays(-CleanupSteps.DefaultHistoryDays - 1));
Assert.False(Directory.Exists(Path.Combine(Staging(fx), MassConverter.StagingFolder(stray))));
// Its journal untouched for as long as the history keeps jobs, but a staged file written since: both stay.
var longAgo = DateTime.UtcNow.AddDays(-CleanupSteps.DefaultHistoryDays - 1);
File.SetLastWriteTimeUtc(forgottenJournal, longAgo);
await fx.Service.Maintenance.RunAsync(fx.Archive, dryRun: false, 0, _ => ValueTask.CompletedTask, fx.Ct);
Assert.FileExists(forgottenJournal);
Assert.FileExists(forgottenFile);
// Neither written for that long: they go together.
File.SetLastWriteTimeUtc(forgottenFile, longAgo);
await fx.Service.Maintenance.RunAsync(fx.Archive, dryRun: false, 0, _ => ValueTask.CompletedTask, fx.Ct);
Assert.FileMissing(forgottenJournal);
Assert.False(Directory.Exists(Path.Combine(Staging(fx), MassConverter.StagingFolder(forgotten))));
Assert.FileExists(pausedJournal);
}
[Test]
public async Task APhotoAnotherProgramHoldsIsSaidSoAndNeverConvertedWithoutAPlanThatListsIt()
{
await using var fx = await FixtureAsync();
var id = await UploadedAsync(fx, 3);
var title = (await fx.Db.Sequences.GetAsync(id))!.DisplayTitle;
var originals = await FramesAsync(fx, id);
var held = fx.Paths.FromRelative(originals[1].RelativePath);
// A sync client holds it while the dry run is made: not missing, and not planned, with why.
ConvertPlan plan;
using (Unreadable(held)) plan = await PlanAsync(fx, ConvertTarget.Tiff16, ConvertMode.Replace, id);
var step = plan.Sequences.Single();
Assert.Equal((2, ConvertSkip.Inaccessible, 1), (step.Frames.Count, step.Skipped.Single().Reason, step.Skipped.Single().Frames));
Assert.DoesNotContain(originals[1].Id, step.Frames.Select(f => f.FrameId));
// Free again when the job runs: it converts the two photos the plan listed, not that one.
var done = (await RunHereAsync(fx, plan, Guid.CreateVersion7())).Sequences.Single();
Assert.Equal((ConvertOutcome.Converted, 2), (done.Outcome, done.Frames));
var frames = await FramesAsync(fx, id);
Assert.Equal((originals[1].Sha256, ImageFileFormat.Jpeg), (frames[1].Sha256, frames[1].Format));
Assert.True(frames[0].Format == ImageFileFormat.Tiff && frames[2].Format == ImageFileFormat.Tiff);
// Held again while the job that converts it comes to it: left as it is, saying why, and the retry converts it once free.
var rest = await PlanAsync(fx, ConvertTarget.Tiff16, ConvertMode.Replace, id);
Assert.Equal(1, rest.Frames);
var jobId = Guid.CreateVersion7();
var lines = new List<string>();
ConvertSequenceResult left;
using (Unreadable(held))
left = (await RunHereAsync(fx, rest, jobId, Callbacks() with { Log = lines.Add })).Sequences.Single();
Assert.Equal((ConvertOutcome.Blocked, Loc.L("Archive.Convert.PhotoHeld")), (left.Outcome, left.Error));
Assert.SequenceEqual([Loc.L("Archive.Log.ConvertFailed", title, Loc.L("Archive.Convert.PhotoHeld"))], lines);
Assert.Equal(ImageFileFormat.Jpeg, (await FramesAsync(fx, id))[1].Format);
Assert.Equal(ConvertOutcome.Converted, (await RunHereAsync(fx, rest, jobId)).Sequences.Single().Outcome);
Assert.True((await FramesAsync(fx, id)).All(f => f.Format == ImageFileFormat.Tiff));
}
/// <summary>
/// Only a photo the job converts makes a sequence wait for its retry while another program holds it: one the plan left
/// out being held does not hide that a photo confirmed is gone, which no retry can mend.
/// </summary>
[Test]
public async Task APhotoHeldThatTheJobDoesNotConvertDoesNotHideAChange()
{
await using var fx = await FixtureAsync();
var id = await UploadedAsync(fx, 3);
var originals = await FramesAsync(fx, id);
var held = fx.Paths.FromRelative(originals[0].RelativePath);
ConvertPlan plan;
using (Unreadable(held)) plan = await PlanAsync(fx, ConvertTarget.Tiff16, ConvertMode.Replace, id);
Assert.Equal(2, plan.Frames);
// A photo of the plan is deleted before the job comes to the sequence, and the one left out is held again then.
var sequence = (await fx.Db.Sequences.GetAsync(id))!;
var delete = await fx.Service.FrameTrash.PlanDeleteAsync(id, [originals[1].Id], sequence.FramesVersion, fx.Ct);
await fx.Service.FrameTrash.DeleteAsync(delete, "alberto", null, fx.Ct);
ConvertSequenceResult left;
using (Unreadable(held)) left = (await RunHereAsync(fx, plan, Guid.CreateVersion7())).Sequences.Single();
Assert.Equal((ConvertOutcome.Changed, (string?)null), (left.Outcome, left.Error));
Assert.True((await FramesAsync(fx, id)).All(f => f.Format == ImageFileFormat.Jpeg));
}
/// <summary>
/// Before each photo of stage A, the space is checked for it and the photos after it that may convert at once with it:
/// fewer near the end, so a job whose dry run had the space never stops short for photos that are not there.
/// </summary>
[Test]
public async Task TheLastPhotosToStartNeedOnlyTheirOwnSpace()
{
ConvertFramePlan[] todo = [.. new long[] { 10, 20, 30, 40 }.Select((bytes, i) => new ConvertFramePlan(Guid.NewGuid(), i, $"originals/{i}.JPG", ImageFileFormat.Jpeg, 1, bytes))];
Assert.SequenceEqual([60L, 90, 70, 40], Enumerable.Range(0, todo.Length).Select(i => MassConverter.Ahead(todo, i, 3)));
Assert.SequenceEqual([10L, 20, 30, 40], Enumerable.Range(0, todo.Length).Select(i => MassConverter.Ahead(todo, i, 1)));
long free = 1L << 50;
await using var fx = await FixtureAsync(o => o with { FreeSpace = _ => free, Parallelism = () => 4 });
var id = await UploadedAsync(fx, 1);
// Exactly what the dry run asks for: four photos may convert at once, but there is one.
free = ConvertPlanner.Required(ConvertPlanner.EstimateBytes(new ConvertOptions(ConvertTarget.Tiff16), 48, 32));
var plan = await PlanAsync(fx, ConvertTarget.Tiff16, ConvertMode.Replace, id);
Assert.True(plan.Space.Enough);
Assert.Equal(free, plan.Space.Required);
var done = (await RunHereAsync(fx, plan, Guid.CreateVersion7())).Sequences.Single();
Assert.Equal((ConvertOutcome.Converted, 1), (done.Outcome, done.Frames));
}
[Test]
public async Task ASecondConversionOfTheSameSequencesIsRefusedWithOrWithoutADryRun()
{
await using var fx = await FixtureAsync();
var id = await UploadedAsync(fx, 2);
var plan = await PlanAsync(fx, ConvertTarget.Tiff16, ConvertMode.NewSequence, id);
async Task Enqueue(ArchiveJobRequest request)
{
// Long enough for the other confirmation to check meanwhile, were it not held back.
await Task.Delay(50, fx.Ct);
await fx.Db.Jobs.EnqueueAsync(new Job
{
Id = Guid.CreateVersion7(),
Kind = request.Kind,
TargetIds = request.Targets,
ParametersJson = request.ParametersJson,
State = JobState.Queued,
Created = DateTimeOffset.UtcNow,
}, fx.Ct);
}
async Task<bool> ConfirmAsync()
{
try
{
await fx.Service.Converter.QueueAsync(fx.Archive, plan, Enqueue, fx.Ct);
return true;
}
catch (ConversionQueuedException ex)
{
Assert.SequenceEqual([id], ex.SequenceIds);
Assert.Equal(Loc.L("Archive.Convert.AlreadyQueued"), ex.Message);
return false;
}
}
// The Library's dialog and the Archive manager's confirm the same plan at once: one job.
var confirmed = await Task.WhenAll(ConfirmAsync(), ConfirmAsync());
Assert.SequenceEqual([false, true], confirmed.Order());
// And again later from that plan, made before the job was queued and never planned again.
Assert.False(await ConfirmAsync());
Assert.Count(1, (await fx.Db.Jobs.ListAsync(JobState.Queued, JobKind.Convert)).Items);
}
[Test]
public async Task AConversionQueuedFirstHoldsItsSequencesFromADuplicateQueuedAfterIt()
{
await using var fx = await FixtureAsync();
var id = await UploadedAsync(fx, 2);
var plan = await PlanAsync(fx, ConvertTarget.Tiff16, ConvertMode.NewSequence, id);
// Queued twice anyway (an earlier build, two processes on one index): the copies are made once.
var first = await QueuedAsync(fx, plan, DateTimeOffset.UtcNow.AddMinutes(-2));
var second = await QueuedAsync(fx, plan, DateTimeOffset.UtcNow.AddMinutes(-1));
var held = (await fx.Service.Converter.RunAsync(fx.Archive, Parameters(fx, plan), second.Id, new ConvertRequester(null, null), Callbacks(), fx.Ct))
.Sequences.Single();
Assert.Equal(ConvertOutcome.Blocked, held.Outcome);
Assert.Null(await fx.Db.Sequences.FindBySessionKeyAsync(fx.Archive.Id, MassConverter.SessionKey(second.Id, id)));
// The one queued first is not held back by the one after it.
var made = (await fx.Service.Converter.RunAsync(fx.Archive, Parameters(fx, plan), first.Id, new ConvertRequester(null, null), Callbacks(), fx.Ct))
.Sequences.Single();
Assert.Equal((ConvertOutcome.Created, 2), (made.Outcome, made.Frames));
}
[Test]
public void AJobsParametersNameThePhotosItConverts()
{
Guid[] ids = [Guid.CreateVersion7(), Guid.CreateVersion7(), Guid.NewGuid()];
var step = new ConvertSequence(Guid.NewGuid(), 3, "digest", ConvertSequence.EncodePhotos(ids));
Assert.SequenceEqual(ids, step.PhotoIds()!);
var json = JsonSerializer.Serialize(step, ArchiveJobJson.Default.ConvertSequence);
Assert.SequenceEqual(ids, JsonSerializer.Deserialize(json, ArchiveJobJson.Default.ConvertSequence)!.PhotoIds()!);
// A job an earlier build queued names none.
Assert.Null(new ConvertSequence(Guid.NewGuid(), 3, "digest").PhotoIds());
Assert.Empty(new ConvertSequence(Guid.NewGuid(), 3, "digest", ConvertSequence.EncodePhotos([])).PhotoIds()!);
}
}