fix: stalled jobs, editor cancellation stops and GoPro DNG decoding

Owner review 1, phase 1 (docs/requests/2026-10-15-owner-review-1.md).

Thumbnail and proxy jobs over several sequences counted sequences while
they checkpointed inside one: the rate decayed until the time left
overflowed TimeSpan, the job failed while publishing progress and again
while saving it, and stayed Running. The throughput is now seeded by the
first window with progress, the time left is bounded (JobEta), saving
progress never throws, image passes count frames, and job speeds use the
right unit (bytes for verify and import).

The debugger stops in WicDecoderProvider.cs when presets changed were
cancelled preview decodes leaving synchronous thread-pool delegates; the
editor's sources, LatestRunner and the render node's proxy task now keep
them in their own tasks, and a cancellation is never an unreadable frame.

GoPro DNGs converted by Adobe software were classified GPR and read only
through their 8-bit preview, and Windows' preview-only DNG decoder was
reported as a native decode. A DNG is GPR only when its raw image is
VC-5, WIC decodes RAW only through the Raw Image Extension and never DNG,
analyses and previews take an adequate embedded preview by choice while
renders develop natively, and frames already indexed as GPR are
reclassified by the next light analysis.

Also records the owner's request (docs/requests), the BRIEF amendments
(§8.1, §8.2, new §24), DECISIONS, CHANGELOG, STATUS and ARCHITECTURE.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Alby96andClaude Opus 5.5 committed 2026-10-16 10:20:26 +02:00
1 parent 19265b36c2
commit 34d03051f5
77 files changed
+785 -94

No files matched your search

@@ -289,6 +289,44 @@ public sealed class ProjectStoreTests(TestContext context)
}
/// <summary>A temporary archive with one adopted folder of synthetic JPEGs, indexed.</summary>
/// <summary>
/// A decode superseded by a newer edit (R4, owner review 1): the caller sees a cancellation, never an unreadable frame,
/// and the provider's cancellation stays inside the source's own task.
/// </summary>
[Test]
public async Task ACancelledDecodeIsACancellationNotAnUnreadableFrame()
{
var (db, sequenceId, _) = await ArchiveAsync(4);
await using (db)
{
var entered = new TaskCompletionSource();
var blocking = new ImageDecoder([new BlockingProvider(entered)]);
var options = new ArchiveServiceOptions { Owner = "test", LeaseWait = TimeSpan.FromSeconds(20) };
await using var source = new LocalSequenceSource(db, sequenceId, blocking, null, options);
await source.LoadAsync(context.Cancellation);
using var cts = new CancellationTokenSource();
var decode = source.DecodeAsync(1, 64, DecodePurpose.Proxy, cts.Token).AsTask();
await entered.Task.WaitAsync(TimeSpan.FromSeconds(10));
await cts.CancelAsync();
await Assert.ThrowsAsync<OperationCanceledException>(() => decode);
}
}
/// <summary>Decodes nothing until its token is cancelled, then throws the cancellation, as WIC does between bands.</summary>
private sealed class BlockingProvider(TaskCompletionSource entered) : IImageDecoderProvider
{
public string Name => "blocking";
public DecodeTier? TierFor(ImageFileFormat format) => DecodeTier.Native;
public DecodedImage? Decode(DecodeRequest request, CancellationToken cancellationToken = default)
{
entered.TrySetResult();
cancellationToken.WaitHandle.WaitOne(TimeSpan.FromSeconds(10));
cancellationToken.ThrowIfCancellationRequested();
return null;
}
}
private async Task<(TitanoDatabase Db, Guid SequenceId, string Root)> ArchiveAsync(int frames)
{
var directory = context.CreateTempDirectory("editor");
@@ -48,6 +48,25 @@ public sealed class SchedulingTests
Assert.True(first.IsCompletedSuccessfully, "a superseded run ends quietly");
}
/// <summary>Synchronous work that throws when superseded (the export estimates) ends quietly as well (R4, owner review 1).</summary>
[Test]
public async Task ASupersededSynchronousRunEndsQuietly()
{
using var runner = new LatestRunner(TimeSpan.Zero);
var started = new ManualResetEventSlim();
var first = runner.Schedule(token =>
{
started.Set();
token.WaitHandle.WaitOne(TimeSpan.FromSeconds(10));
token.ThrowIfCancellationRequested();
return Task.CompletedTask;
});
Assert.True(started.Wait(TimeSpan.FromSeconds(10)));
var second = runner.Schedule(_ => Task.CompletedTask);
await Task.WhenAll(first, second);
Assert.True(first.IsCompletedSuccessfully, "a superseded run ends quietly");
}
[Test]
public async Task ImmediateRequestsSkipTheDelay()
{
@@ -1,4 +1,5 @@
using System.Globalization;
using Titano.App.Infrastructure;
using Titano.App.Jobs;
using Titano.Core.Localization;
using Titano.Core.Model;
@@ -154,7 +155,11 @@ public sealed class JobListModelTests
};
Assert.Equal("Render · Harbour sunset · 2,232 / 3,600 · 11.3 fps · 2 min left", JobText.Bar(running));
Assert.Equal("2 min", JobText.Left(running, 0));
Assert.Equal("118/s", JobText.Speed(JobKind.Import, 118));
// Imports and verifies count bytes; scans count folders; frame jobs read in fps (owner review 1).
Assert.Equal("118 B/s", JobText.Speed(JobKind.Import, 118));
Assert.Equal(JobText.Speed(JobKind.Verify, 57_000_000), Loc.L("Jobs.Speed.Bytes", Formatting.Bytes(57_000_000)));
Assert.Equal("4/s", JobText.Speed(JobKind.Scan, 4));
Assert.Equal("1.7 fps", JobText.Speed(JobKind.Proxies, 1.7));
Assert.Equal(string.Empty, JobText.Speed(JobKind.Render, null));
Assert.Equal("this PC", JobText.Where("STUDIO#2", "studio"));
Assert.Equal("render-box", JobText.Where("render-box", "studio"));
@@ -306,6 +306,57 @@ public sealed class ManagedDecoderProviderTests(TestContext context)
Assert.Throws<FileNotFoundException>(() => DecoderFactory.CreateServer().Decode(new DecodeRequest(Path.Combine(_dir, "vanished.jpg"))));
}
/// <summary>
/// The owner's archive (R4, owner review 1): GoPro DNGs converted by Lightroom or DNG Converter carry a full-size JPEG
/// preview in IFD0 and a lossless or lossy raw image in a SubIFD. They are DNGs, developed natively; only a VC-5 raw
/// image (or the .gpr extension) makes a GPR.
/// </summary>
[Test]
public void AGoProDngIsGprOnlyWhenItsRawImageIsVc5()
{
using var scene = SyntheticRaw.Smooth(W, H);
var converted = Write("GOPR0100.dng", SyntheticDng.Write(scene, new DngSpec { Make = "GoPro", RawInSubIfd = true, PreviewJpeg = JpegFile(W, H, 1) }));
Assert.Equal(ImageFileFormat.Dng, Signature(converted));
using (var decoded = DecoderFactory.CreateServer().Decode(new DecodeRequest(converted)))
Assert.Equal((DecodeTier.Native, "managed-dng"), (decoded!.Tier, decoded.Decoder));
var vc5 = new IfdSpec().Long(TiffTags.NewSubfileType, 0).Long(TiffTags.ImageWidth, 64).Long(TiffTags.ImageLength, 48)
.Short(TiffTags.BitsPerSample, 16).Short(TiffTags.Compression, 9).Short(TiffTags.PhotometricInterpretation, 32803);
var gpr = Write("GOPR0101.dng", TiffFile.Build(Fixtures.Ifd0("GoPro", "HERO8 Black", 1).Bytes(TiffTags.DngVersion, 1, 4, 0, 0).Child(TiffTags.SubIfds, vc5)));
Assert.Equal(ImageFileFormat.Gpr, Signature(gpr));
var renamed = Write("GOPR0102.GPR", File.ReadAllBytes(converted));
Assert.Equal(ImageFileFormat.Gpr, Signature(renamed));
}
private static ImageFileFormat Signature(string path)
{
using var stream = File.OpenRead(path);
return ImageSignature.Detect(stream, path);
}
[Test]
public void APreferredPreviewIsTakenByChoiceOnlyWhenItIsLargeEnough()
{
using var scene = SyntheticRaw.Smooth(W, H);
var dng = Write("preview.dng", SyntheticDng.Write(scene, new DngSpec { RawInSubIfd = true, PreviewJpeg = JpegFile(W, H, 1) }));
var server = DecoderFactory.CreateServer();
// Analysis size within the preview: the preview, marked as taken by choice (the frame still decodes natively).
using (var quick = server.Decode(new DecodeRequest(dng, MaxLongEdge: 48, Purpose: DecodePurpose.Analysis, PreferPreview: true)))
{
Assert.Equal((DecodeTier.EmbeddedPreview, "managed-preview", true), (quick!.Tier, quick.Decoder, quick.ByChoice));
Assert.Equal(48, quick.Pixels.Width);
}
// Larger than the preview, or no size limit: developed.
using (var native = server.Decode(new DecodeRequest(dng, MaxLongEdge: 4 * W, Purpose: DecodePurpose.Analysis, PreferPreview: true)))
Assert.Equal((DecodeTier.Native, "managed-dng", false), (native!.Tier, native.Decoder, native.ByChoice));
using (var whole = server.Decode(new DecodeRequest(dng, PreferPreview: true)))
Assert.Equal((DecodeTier.Native, false), (whole!.Tier, whole.ByChoice));
// Renders never prefer the preview.
using (var render = server.Decode(new DecodeRequest(dng, MaxLongEdge: 48)))
Assert.Equal((DecodeTier.Native, "managed-dng", false), (render!.Tier, render.Decoder, render.ByChoice));
}
/// <summary>A GoPro GPR as far as Titano reads it: a DNG made by "GoPro" whose only decodable image is a YCbCr JPEG preview.</summary>
private static byte[] Gpr(int previewWidth, int previewHeight)
{
+26 -2
View File
@@ -186,6 +186,12 @@ internal sealed record DngSpec
/// <summary>Put the raw image in a SubIFD behind an IFD0 thumbnail, like camera DNGs.</summary>
public bool RawInSubIfd { get; init; }
/// <summary>With <see cref="RawInSubIfd"/>: IFD0 holds this JPEG as the embedded preview (like Adobe-converted DNGs).</summary>
public byte[]? PreviewJpeg { get; init; }
/// <summary>IFD0 Make.</summary>
public string Make { get; init; } = "Titano";
/// <summary>Raw-value transform applied after mosaicking (e.g. the inverse of a gain map), stored-unit domain.</summary>
public Func<int, int, float, float>? RawTransform { get; init; }
}
@@ -301,7 +307,25 @@ internal static class SyntheticDng
if (spec.OpcodeList3 is { } o3) raw.Add(TiffTags.OpcodeList3, TiffType.Undefined, o3.Length, o3);
var ifd0 = raw;
if (spec.RawInSubIfd)
if (spec.RawInSubIfd && spec.PreviewJpeg is { } jpeg)
{
if (output.Position % 2 != 0) output.WriteByte(0);
var offset = output.Position;
output.Write(jpeg);
var info = Titano.Core.Codecs.Jpeg.JpegDecoder.ReadInfo(jpeg);
ifd0 = new TiffDirectory();
ifd0.Long(TiffTags.NewSubfileType, 1);
ifd0.Long(TiffTags.ImageWidth, (uint)info.Width);
ifd0.Long(TiffTags.ImageLength, (uint)info.Height);
ifd0.Short(TiffTags.BitsPerSample, 8, 8, 8);
ifd0.Short(TiffTags.Compression, 7);
ifd0.Short(TiffTags.PhotometricInterpretation, 6);
ifd0.Short(TiffTags.SamplesPerPixel, 3);
ifd0.Long(TiffTags.StripOffsets, (uint)offset);
ifd0.Long(TiffTags.StripByteCounts, (uint)jpeg.Length);
ifd0.Child(TiffTags.SubIfds, raw);
}
else if (spec.RawInSubIfd)
{
ifd0 = new TiffDirectory();
ifd0.Long(TiffTags.NewSubfileType, 1);
@@ -315,7 +339,7 @@ internal static class SyntheticDng
ifd0.Long(TiffTags.StripByteCounts, 48);
ifd0.Child(TiffTags.SubIfds, raw);
}
ifd0.Ascii(TiffTags.Make, "Titano");
ifd0.Ascii(TiffTags.Make, spec.Make);
ifd0.Ascii(TiffTags.Model, "Synthetic");
ifd0.Short(TiffTags.Orientation, spec.Orientation);
ifd0.Bytes(TiffTags.DngVersion, 1, 6, 0, 0);
@@ -473,7 +473,7 @@ public abstract class PartialRowWriterTests(TestContext context) : DatabaseTest(
ManifestStore.WriteSequence(folder.ManifestPath, tiered);
var first = tiered.Frames[0];
await tx.Sequences.RecordTiersAsync(sequence.Id, SequenceStatus.None, 1, fx.Ct);
await tx.Frames.UpdateTiersAsync([new FrameTierFields(first.Id, first.Flags, first.PreviewW ?? 0, first.PreviewH ?? 0)], fx.Ct);
await tx.Frames.UpdateTiersAsync([new FrameTierFields(first.Id, first.Flags, first.PreviewW ?? 0, first.PreviewH ?? 0, first.Format)], fx.Ct);
await tx.CommitAsync(fx.Ct);
}
Assert.SequenceEqual([sequence.Id], (await scan).Sequences);
@@ -0,0 +1,147 @@
using Titano.Core.Model;
using Titano.Data.Jobs;
using Titano.Protocol;
using Titano.Testing;
namespace Titano.Data.Tests.Jobs;
/// <summary>A clock the test moves by hand (BCL <see cref="TimeProvider"/>, no package).</summary>
internal sealed class ManualTime : TimeProvider
{
private long _ticks;
public override long TimestampFrequency => TimeSpan.TicksPerSecond;
public override long GetTimestamp() => Interlocked.Read(ref _ticks);
public void Advance(TimeSpan by) => Interlocked.Add(ref _ticks, by.Ticks);
}
[Category("jobs")]
public sealed class JobThroughputTests(TestContext context)
{
[Test]
public void TheFirstWindowWithProgressSeedsTheRate()
{
var throughput = new JobThroughput(0);
Assert.Null(throughput.Sample(2, 0, 100).Rate);
var (rate, eta) = throughput.Sample(4, 10, 100);
Assert.Equal(5.0, rate);
Assert.Equal(TimeSpan.FromSeconds(18), eta);
}
[Test]
public void AStalledJobLosesItsRateAndTimeLeftWithoutOverflowing()
{
// The owner's log: one sequence of 17 done, then a long one checkpointed every 10 s without moving the count.
var throughput = new JobThroughput(0);
throughput.Sample(600, 1, 17);
(double? Rate, TimeSpan? Eta) last = default;
for (var i = 1; i <= 2000; i++) last = throughput.Sample(600 + i * 10, 1, 17);
Assert.Null(last.Rate);
Assert.Null(last.Eta);
}
[Test]
public void ProgressThatGoesBackStartsANewWindow()
{
var throughput = new JobThroughput(0);
throughput.Sample(2, 20, 100);
throughput.Sample(3, 5, 100);
var (rate, _) = throughput.Sample(5, 15, 100);
Assert.Approximately(0.7 * 10 + 0.3 * 5, rate!.Value, 1e-9);
}
[Theory]
[Case(double.NaN)]
[Case(double.PositiveInfinity)]
[Case(-1.0)]
[Case(1e300)]
[Case(4e7)]
public void UnusableSecondsGiveNoTimeLeft(double seconds) => Assert.Null(JobEta.FromSeconds(seconds));
[Test]
public void UsableSecondsAndRatesGiveTheTimeLeft()
{
Assert.Equal(TimeSpan.FromSeconds(90), JobEta.FromSeconds(90));
Assert.Equal(TimeSpan.FromSeconds(4), JobEta.Of(8, 2));
Assert.Null(JobEta.Of(0, 2));
Assert.Null(JobEta.Of(8, null));
Assert.Null(JobEta.Of(8, 1e-300));
}
[Test]
public void ServerTimeLeftBeyondTheMaximumReadsUnknown()
{
var dto = new JobDto(Guid.NewGuid(), "render", [], null, "running", "normal", 1, 17, 1e-11, 1e300, null, null, 0, null,
DateTimeOffset.UtcNow, null, null);
Assert.Null(JobWire.FromDto(dto)!.Eta);
}
[Test]
public async Task AJobWhoseCountStallsForHoursStillEndsDone()
{
var time = new ManualTime();
var reported = new List<JobProgressInfo>();
await using var db = await TitanoDatabase.OpenAsync(DatabaseOptions.Sqlite(Path.Combine(context.CreateTempDirectory(), "jobs.db")), context.Cancellation);
var handler = new CallbackHandler(JobKind.Proxies, async c =>
{
time.Advance(TimeSpan.FromSeconds(600));
await c.CheckpointAsync("1:0", 1, 17);
for (var frame = 1; frame <= 400; frame++)
{
time.Advance(TimeSpan.FromSeconds(11));
await c.CheckpointAsync($"1:{frame}", 1, 17);
}
});
await using var engine = new JobEngine(db, [handler], new JobEngineOptions { Workers = 1, WorkerId = "t", Time = time });
engine.Progress += p =>
{
lock (reported) reported.Add(p);
};
await engine.StartAsync();
var job = await engine.EnqueueAsync(JobKind.Proxies, [Guid.NewGuid()]);
var done = await WaitForAsync(db, job.Id, JobState.Done);
Assert.Null(done.Eta);
Assert.Null(done.ItemsPerSecond);
lock (reported) Assert.Null(reported[^1].Eta);
}
[Test]
public async Task AProgressSubscriberThatThrowsNeverFailsTheJob()
{
await using var db = await TitanoDatabase.OpenAsync(DatabaseOptions.Sqlite(Path.Combine(context.CreateTempDirectory(), "jobs.db")), context.Cancellation);
var handler = new CallbackHandler(JobKind.Verify, async c =>
{
for (var i = 1; i <= 5; i++) await c.CheckpointAsync(i.ToString(System.Globalization.CultureInfo.InvariantCulture), i, 5);
});
await using var engine = new JobEngine(db, [handler], new JobEngineOptions { Workers = 1, WorkerId = "t" });
engine.Progress += _ => throw new InvalidOperationException("broken subscriber");
await engine.StartAsync();
var first = await engine.EnqueueAsync(JobKind.Verify, [Guid.NewGuid()]);
var second = await engine.EnqueueAsync(JobKind.Verify, [Guid.NewGuid()]);
Assert.Equal(5L, (await WaitForAsync(db, first.Id, JobState.Done)).ProgressDone);
await WaitForAsync(db, second.Id, JobState.Done);
}
private sealed class CallbackHandler(JobKind kind, Func<JobContext, Task> run) : IJobHandler
{
public JobKind Kind => kind;
public Task RunAsync(JobContext context) => run(context);
}
private static async Task<Job> WaitForAsync(TitanoDatabase db, Guid id, JobState state)
{
var until = DateTime.UtcNow.AddSeconds(15);
Job? job = null;
while (DateTime.UtcNow < until)
{
job = await db.Jobs.GetAsync(id);
if (job?.State == state) return job;
await Task.Delay(20);
}
Assert.Fail($"Job {id} is {job?.State}, not {state}");
return null!;
}
}
@@ -708,6 +708,60 @@ public sealed class AnalysisJobTests(TestContext context)
Assert.Empty(SequenceAnalyser.ReadReport(fx.Folder(sequence), sequence.FrameCount)!.Issues.Undecodable);
}
/// <summary>
/// The owner's archive (R4, owner review 1): GoPro DNGs converted by Adobe software were indexed as GPR and recorded
/// preview-only. The scan follow-up lists their sequences again, and the light analysis probes them: they become
/// DNGs decoded natively, in the sidecar and the index.
/// </summary>
[Test]
public async Task GoProDngsIndexedAsGprAreProbedAgainAndBecomeNativeDngs()
{
await using var fx = await ProcessingFixture.CreateAsync(context);
var card = Path.Combine(context.CreateTempDirectory("card"), "DCIM", "100GOPRO");
Directory.CreateDirectory(card);
var start = new DateTime(2024, 10, 11, 18, 0, 0);
for (var i = 0; i < 3; i++)
{
var metadata = new FrameMetadata { Make = "GoPro", Model = "HERO8 Black", BodySerial = "C3441", CapturedAt = start.AddSeconds(5 * i) };
using var sensor = new ImageBuffer(64, 48);
sensor.Plane(1).Fill(0.2f + 0.1f * i);
File.WriteAllBytes(Path.Combine(card, $"GOPR{i + 1:0000}.dng"),
LinearDngWriter.Write(sensor, new LinearDngOptions { Exif = ExifWriter.BuildTiff(metadata), TileSize = 64 }));
}
var service = fx.Archive.Service;
var plan = await service.PlanImportAsync(fx.Archive.Archive.Id, Path.GetDirectoryName(Path.GetDirectoryName(card))!, new ImportOptions(),
cancellationToken: fx.Ct);
await service.Imports.ExecuteAsync(new ImportJobParameters(fx.Archive.Archive.Id, plan, null, true, null), Guid.NewGuid(), 0,
_ => ValueTask.CompletedTask, null, fx.Ct);
var session = plan.Sessions.Single();
Assert.Equal(ImageFileFormat.Dng, session.Format);
var id = await fx.Db.Sequences.FindBySessionKeyAsync(fx.Archive.Archive.Id, session.SessionKey, fx.Ct);
var sequence = (await fx.Db.Sequences.GetAsync(id!.Value, fx.Ct))!;
// What an index from before owner review 1 holds: GPR, preview-only, already light-analysed.
var folder = fx.Folder(sequence);
var manifest = ManifestStore.ReadSequence(folder.ManifestPath);
ManifestStore.WriteSequence(folder.ManifestPath, manifest with
{
Frames = [.. manifest.Frames.Select(f => f with { Format = ImageFileFormat.Gpr, Tier = DecodeTier.EmbeddedPreview, Flags = f.Flags | FrameFlags.PreviewOnly, PreviewW = 64, PreviewH = 48 })],
});
var rows = await fx.Db.Frames.ListBySequenceAsync(sequence.Id, cancellationToken: fx.Ct);
await fx.Db.Frames.UpdateTiersAsync([.. rows.Select(r => new FrameTierFields(r.Id, r.Flags | FrameFlags.PreviewOnly, 64, 48, ImageFileFormat.Gpr))], fx.Ct);
await fx.Db.Sequences.UpsertAsync(sequence with { Status = sequence.Status | SequenceStatus.AnalyzedLight }, fx.Ct);
Assert.Contains(sequence.Id, await AnalysisFollowUp.UnanalysedAsync(fx.Db, fx.Archive.Archive.Id, fx.Ct));
await fx.StartEngineAsync();
var light = await fx.EnqueueAsync(ProcessingJobs.LightAnalysis([sequence.Id]));
await fx.WaitForAsync(light.Id, JobState.Done);
var sidecar = ManifestStore.ReadSequence(folder.ManifestPath).Frames;
Assert.True(sidecar.All(f => f is { Format: ImageFileFormat.Dng, Tier: DecodeTier.Native } && (f.Flags & FrameFlags.PreviewOnly) == 0),
string.Join(", ", sidecar.Select(f => $"{f.Format}/{f.Tier}/{f.Flags}")));
var indexed = await fx.Db.Frames.ListBySequenceAsync(sequence.Id, cancellationToken: fx.Ct);
Assert.True(indexed.All(f => f.Format == ImageFileFormat.Dng && (f.Flags & FrameFlags.PreviewOnly) == 0), "the index follows");
Assert.Equal(0, (await fx.Db.Sequences.GetAsync(sequence.Id, fx.Ct))!.PreviewOnlyCount);
Assert.DoesNotContain(sequence.Id, await AnalysisFollowUp.UnanalysedAsync(fx.Db, fx.Archive.Archive.Id, fx.Ct));
}
[Test]
public async Task DeepAnalysisNeverFlagsFramesThatVanishedOrCouldNotBeRead()
{
@@ -323,7 +323,7 @@ public abstract class CatalogRepositoryTests(TestContext context) : RepositoryTe
var frames = Enumerable.Range(0, count).Select(i => TestData.Frame(sequence.Id, i) with { Flags = FrameFlags.Duplicate }).ToList();
await db.Frames.BulkInsertAsync(frames, Ct);
var tiers = frames.Select(f => new FrameTierFields(f.Id, f.Index % 2 == 0 ? FrameFlags.PreviewOnly : FrameFlags.Undecodable, 1620 + f.Index, 1080)).ToList();
var tiers = frames.Select(f => new FrameTierFields(f.Id, f.Index % 2 == 0 ? FrameFlags.PreviewOnly : FrameFlags.Undecodable, 1620 + f.Index, 1080, f.Format)).ToList();
Assert.Equal(count, await db.Frames.UpdateTiersAsync(tiers, Ct));
var read = await Titano.Data.Processing.SequenceFrames.ListAsync(db, sequence.Id, Ct);
Assert.SequenceEqual(tiers.Select(t => (t.Flags, t.PreviewWidth, t.PreviewHeight)), read.Select(f => (f.Flags, f.PreviewWidth, f.PreviewHeight)));
@@ -327,7 +327,7 @@ public sealed class SequenceTests(TestContext context)
}
// What a light analysis on the server records for CR3s it reads only through their previews.
var frames = await db.Frames.ListBySequenceAsync(first.SequenceId);
await db.Frames.UpdateTiersAsync([.. frames.Select(f => new Titano.Data.Repositories.FrameTierFields(f.Id, Titano.Core.Model.FrameFlags.PreviewOnly, 1620, 1080))]);
await db.Frames.UpdateTiersAsync([.. frames.Select(f => new Titano.Data.Repositories.FrameTierFields(f.Id, Titano.Core.Model.FrameFlags.PreviewOnly, 1620, 1080, f.Format))]);
var sequence = (await db.Sequences.GetAsync(first.SequenceId))!;
await db.Sequences.UpsertAsync(sequence with { PreviewOnlyCount = 2 });