fix(archive): partial writers keep the folder changed for the scan; image flags follow queued passes and hashed photos

Writers that change part of a sequence (decode tiers, image-pass flags,
analyses, verify flushes and stamps, duplicate flags, title/tags/rating/
notes edits, mass rename) now ask ArchiveIndexer.InStepAsync before their
own sidecar write and record the folder's scan stamps afterwards only when
the index held the folder as it was: the stored stamps are still the
folder's and the row holds the sidecar's frames. What another process
changed in the sidecar alone (frames, a new title) stays visible to the
next incremental scan, which writes the whole row from the sidecar.

EditSequenceInfoAsync reads sidecar and row under the lease and writes the
row through SequenceRepository.EditAsync at the settings version it read,
applying the edit again on a conflict, then the sidecar from the stored
row; settings and frames committed meanwhile stay. MassRenamer writes only
folder and title (RelocateAsync, whose null title now keeps the current
one). Verify flushes and duplicate flags run under one lease.

A scan that finds frames another writer listed in the sidecar itself
clears AnalyzedLight, ThumbsBuilt and ProxiesBuilt only in its own row and
only on a server (ImagesAfterScan); the shared sidecar keeps the writer's
flags, so a desktop's poll no longer makes the server redo its passes.

An image pass overtaken by an upload keeps its flag while a pass of the
same kind is queued for the sequence. ThumbPack.IsFrom accepts a thumbnail
drawn before a verify hashed its photo, in the pass, in SameFrames and in
the server's thumbnail lookup, which answered 404 for every such frame.

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-12 20:16:58 +00:00
1 parent 0475fb9ee4
commit 94ef3c88db
18 files changed
+532 -116

No files matched your search

+9
View File
@@ -223,6 +223,15 @@ public static class ThumbPack
sha256 is { Length: HashLength * 2 }
? Convert.FromHexString(sha256)
: System.Security.Cryptography.SHA256.HashData(System.Text.Encoding.UTF8.GetBytes($"{file}|{size}"));
/// <summary>
/// Whether a thumbnail with <paramref name="sourceHash"/> was drawn from this original: its <see cref="Fingerprint"/>,
/// or, for an original hashed since (a verify hashes the photos a scan adopted), the fingerprint of its file name and
/// size it was drawn with before. The hash changes nothing about the photo.
/// </summary>
public static bool IsFrom(ReadOnlySpan<byte> sourceHash, string? sha256, string file, long size) =>
sourceHash.SequenceEqual(Fingerprint(sha256, file, size))
|| (sha256 is { Length: HashLength * 2 } && sourceHash.SequenceEqual(Fingerprint(null, file, size)));
}
/// <summary>Random access to the thumbnails of a pack without loading the file; safe while a writer appends.</summary>