fix(archive): the orphans fix queues the deep analysis a scan would
A desktop scan queues a background deep analysis of the sequences whose frames it changed when Settings > Analysis > After a scan is on; photos the Archive screen's orphans fix indexed got only the light analysis, which then dropped the deep status. ArchiveService.ReconcileAsync takes that setting and queues the deep analysis too, at background priority. A follow-up is left out when a queued job of its kind already covers the sequence, whatever else that job targets, as the scan's follow-ups check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
4 files changed
+57
-11
No files matched your search
@@ -101,13 +101,14 @@ public sealed class AnalysisFollowUpTests(TestContext context)
|
||||
// light analysis it queues waits on the first new photo's probe, so what the fix left can be seen.
|
||||
fx.Write(SyntheticSequence.Create(new SyntheticSequenceOptions { FrameCount = 18 }), "Roof", first: 12);
|
||||
fx.Decoder.HoldProbeOf(12);
|
||||
await fx.Archive.Service.ReconcileAsync(sequence.Id, fx.Engine, fx.Ct);
|
||||
await fx.Archive.Service.ReconcileAsync(sequence.Id, fx.Engine, deepAnalysis: false, fx.Ct);
|
||||
const SequenceStatus covering = SequenceStatus.AnalyzedLight | images;
|
||||
var row = (await fx.Db.Sequences.GetAsync(sequence.Id, fx.Ct))!;
|
||||
Assert.Equal((18, SequenceStatus.None), (row.FrameCount, row.Status & covering));
|
||||
Assert.Equal(SequenceStatus.None, ManifestStore.ReadSequence(folder.ManifestPath).Status & covering);
|
||||
var again = (await fx.Db.Jobs.ListAsync(null, JobKind.LightAnalyse, cancellationToken: fx.Ct)).Items.Single(j => j.Id != first.Id);
|
||||
Assert.SequenceEqual([sequence.Id], again.TargetIds);
|
||||
Assert.Empty((await fx.Db.Jobs.ListAsync(null, JobKind.DeepAnalyse, cancellationToken: fx.Ct)).Items);
|
||||
|
||||
await fx.Decoder.Holding.Task.WaitAsync(TimeSpan.FromSeconds(60), fx.Ct);
|
||||
fx.Decoder.Release();
|
||||
@@ -118,6 +119,44 @@ public sealed class AnalysisFollowUpTests(TestContext context)
|
||||
Assert.Contains("18", ProjectSettings.FromJson(await File.ReadAllTextAsync(folder.ProjectPath, fx.Ct)).Timing.FrameRate.ReasonArgs!);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task PhotosTheOrphansFixIndexesGetTheDeepAnalysisAScanWouldQueue()
|
||||
{
|
||||
await using var fx = await ProcessingFixture.CreateAsync(context);
|
||||
var sequence = await fx.AddAsync(SyntheticSequence.Create(new SyntheticSequenceOptions { FrameCount = 12 }), "Roof");
|
||||
var lake = await fx.AddAsync(SyntheticSequence.Create(new SyntheticSequenceOptions { FrameCount = 12 }), "Lake");
|
||||
var folder = fx.Folder(sequence);
|
||||
await fx.StartEngineAsync(withArchive: true);
|
||||
Task<IReadOnlyList<Job>> QueuedDeepAsync() => fx.Db.Jobs.ListQueuedAsync(JobKind.DeepAnalyse, 50, fx.Ct);
|
||||
|
||||
// The host asks for a deep analysis after scans: the orphans fix queues one in the background too, behind the light
|
||||
// analysis, which waits on the first new photo's probe so the queue can be seen.
|
||||
fx.Write(SyntheticSequence.Create(new SyntheticSequenceOptions { FrameCount = 18 }), "Roof", first: 12);
|
||||
fx.Decoder.HoldProbeOf(12);
|
||||
await fx.Archive.Service.ReconcileAsync(sequence.Id, fx.Engine, deepAnalysis: true, fx.Ct);
|
||||
var light = (await fx.Db.Jobs.ListAsync(null, JobKind.LightAnalyse, cancellationToken: fx.Ct)).Items.Single();
|
||||
var deep = (await QueuedDeepAsync()).Single();
|
||||
Assert.SequenceEqual([sequence.Id], deep.TargetIds);
|
||||
Assert.Equal(JobPriority.Background, deep.Priority);
|
||||
await fx.Decoder.Holding.Task.WaitAsync(TimeSpan.FromSeconds(60), fx.Ct);
|
||||
|
||||
// The user cancels it, and asks for a deep analysis of both sequences instead. More photos and the fix again: the
|
||||
// one waiting covers them, so no other is queued.
|
||||
await fx.Engine.CancelAsync(deep.Id, fx.Ct);
|
||||
var both = await fx.EnqueueAsync(Titano.Data.Processing.ProcessingJobs.DeepAnalysis([lake.Id, sequence.Id]));
|
||||
fx.Write(SyntheticSequence.Create(new SyntheticSequenceOptions { FrameCount = 20 }), "Roof", first: 18);
|
||||
await fx.Archive.Service.ReconcileAsync(sequence.Id, fx.Engine, deepAnalysis: true, fx.Ct);
|
||||
Assert.SequenceEqual([both.Id], (await QueuedDeepAsync()).Select(j => j.Id));
|
||||
|
||||
fx.Decoder.Release();
|
||||
await fx.WaitForAsync(light.Id, JobState.Done);
|
||||
await fx.WaitForAsync(both.Id, JobState.Done);
|
||||
var row = (await fx.Db.Sequences.GetAsync(sequence.Id, fx.Ct))!;
|
||||
Assert.Equal(20, row.FrameCount);
|
||||
Assert.True(row.Status.HasFlag(SequenceStatus.AnalyzedDeep), row.Status.ToString());
|
||||
Assert.Equal(20, Titano.Data.Processing.SequenceAnalyser.ReadReport(folder, 20)?.FrameCount);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AScanAskedForDeepAnalysisQueuesItInTheBackgroundForNewSequencesOnly()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user