fix(archive,analysis): an unreadable photo changes nothing; a report stale by proxies never replaces a current one

The orphans fix and scans treated a folder whose only new photo could not be
read yet (held open, no permission, an offline placeholder) as changed: the
sidecar was rewritten, the covering flags cleared and analyses queued again at
every click. SequenceAdopter.Reconcile now returns null when it indexed nothing
and changed no flag, as its contract says.

A deep pass counted as current by frames version alone, so a pass whose verdict
a proxy made stale overwrote the report a later pass made from the proxies,
then dropped the deep status. It now counts as current only when its report
describes the frames as they are, and otherwise replaces only a saved report
that does not describe them either.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
Claude committed 2026-10-13 00:31:30 +00:00
1 parent 00823b0328
commit 0085765a12
4 files changed
+84 -12

No files matched your search

@@ -78,6 +78,25 @@ public sealed class ArchiveFolderTests(TestContext context)
Assert.Equal(FrameFlags.None, restored.Frames[2].Flags);
}
[Test]
public void APhotoThatCannotBeReadYetChangesNothing()
{
var archive = NewArchive();
var sequence = archive.Sequence("s");
TestPhotos.WriteSeries(sequence.Originals, Start, 3, TimeSpan.FromSeconds(10));
var manifest = SequenceAdopter.Build(Guid.CreateVersion7(), sequence, null);
var added = Path.Combine(sequence.Originals, "IMG_0009.JPG");
TestPhotos.Write(added, Start.AddSeconds(60), 9);
// Held open by another program (or without read permission): it stays unindexed, and the sidecar is as it was.
using (new FileStream(added, FileMode.Open, FileAccess.Read, FileShare.None))
{
Assert.SequenceEqual(["originals/IMG_0009.JPG"], SequenceAdopter.FindOrphans(sequence, manifest).UnindexedFiles);
Assert.Null(SequenceAdopter.Reconcile(sequence, manifest));
}
Assert.Equal(4, SequenceAdopter.Reconcile(sequence, manifest)!.Frames.Count);
}
[Test]
public async Task VerifyDetectsAFlippedByteAMissingFileAndAChangedFile()
{