fix(analysis): record nothing for frames that changed while an analysis ran
A light or deep analysis read its frames at the start and, under the sequence lock, recorded AnalyzedLight, the warning count and the advisor's Auto values for them whatever happened meanwhile. Frames added by an upload, an import or a scan's reconcile then kept advice and warnings counted on the old frame count, over a newer light analysis, and scans never queued another one because AnalyzedLight was set again. Under the lock the analysis now compares the row's frames version with the one it read. When it moved and no light analysis is queued for the sequence, it records nothing (a deep pass keeps only analysis.json and its per-frame measurements), and the job logs it and queues a light analysis of the frames as they are. A queued light analysis replaces what the pass records, as for image passes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
7 files changed
+143
-7
No files matched your search
@@ -44,6 +44,7 @@ internal sealed class AnalyseJobHandler(TitanoDatabase db, SequenceAnalyser anal
|
||||
var outcome = await analyser.AnalyseAsync(targets[i], deep, progress, context.Cancellation).ConfigureAwait(false);
|
||||
await chain.FlushAsync().ConfigureAwait(false);
|
||||
if (outcome is null) context.Log(Loc.L("Archive.Log.SequenceMissing", targets[i]));
|
||||
else if (outcome.FramesChanged) await AnalyseAgainAsync(context, outcome.Sequence).ConfigureAwait(false);
|
||||
else Report(context, outcome, deep);
|
||||
}
|
||||
catch (Exception ex) when (ex is not (OperationCanceledException or ArchiveOfflineException))
|
||||
@@ -63,6 +64,17 @@ internal sealed class AnalyseJobHandler(TitanoDatabase db, SequenceAnalyser anal
|
||||
if (failed.Count > 0) throw new InvalidOperationException(failed.Count == 1 ? failure : Loc.L("Errors.Analysis.Failed", failed.Count, targets.Count));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A sequence whose frames changed while it was analysed, with no light analysis queued for it: nothing was recorded
|
||||
/// from the frames the analysis read, so a light analysis of the frames as they are is queued (the deep report it saved
|
||||
/// counts only for the frames it describes).
|
||||
/// </summary>
|
||||
private async Task AnalyseAgainAsync(JobContext context, Sequence sequence)
|
||||
{
|
||||
context.Log(Loc.L("Advisor.Log.FramesChanged", sequence.DisplayTitle));
|
||||
await AnalysisFollowUp.QueueAsync(db, context, [sequence.Id], sequence.DisplayTitle).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private async Task<string> TitleAsync(Guid sequenceId, CancellationToken cancellationToken) =>
|
||||
(await db.Sequences.GetAsync(sequenceId, cancellationToken).ConfigureAwait(false))?.DisplayTitle ?? sequenceId.ToString();
|
||||
|
||||
|
||||
Reference in new issue
Block a user