fix(archive): an upload indexes the whole sequence when another writer changed it
ArchiveIngest appended the new frame rows and recorded the folder's stamps whenever the batch appended at the end and the frame count matched, even when a desktop sharing the archive had changed the sidecar alone (a verify's hashes and Missing/Corrupt flags, decode tiers, duplicates, a title). The server's frames then never got those changes, and the stamps hid them from every incremental scan until a full scan. A batch now asks ArchiveIndexer.InStepAsync under the lease, before it changes the folder, and appends only when the index held the folder as it was; otherwise it syncs the whole row and every frame from the sidecar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012iLMBNwBE2GnphAsu4cjaC
This commit is contained in:
3 files changed
+40
-8
No files matched your search
@@ -182,6 +182,30 @@ public abstract class PartialRowWriterTests(TestContext context) : DatabaseTest(
|
||||
Assert.SequenceEqual(sidecar.Frames.Select(f => f.Id), (await fx.Db.Frames.ListBySequenceAsync(sequence.Id, cancellationToken: fx.Ct)).Select(f => f.Id));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AnUploadAfterAnotherWriterVerifiedTheSequenceIndexesWhatTheVerifyFound()
|
||||
{
|
||||
var fx = await FixtureAsync();
|
||||
var sequence = await IndexedAsync(fx);
|
||||
// A desktop sharing the archive verifies the sequence: the photos' first hashes go into the sidecar and its own index.
|
||||
var (desktop, archive) = await fx.OtherWriterAsync();
|
||||
await desktop.Verifier.VerifyAsync(archive, [sequence.Id], default, (_, _, _) => ValueTask.CompletedTask, null, fx.Ct);
|
||||
|
||||
// A photo uploaded here before this index's next scan is appended after the others.
|
||||
var staged = fx.Stage(Start.AddMinutes(1), seed: 90);
|
||||
await fx.Service.Ingest.CommitAsync(new IngestRequest(fx.Archive.Id, sequence.Id, null, null, staged.Path, "IMG_0004.JPG", staged.Size, staged.Sha256, null, null),
|
||||
fx.Ct);
|
||||
|
||||
// The upload indexes the sequence whole from the sidecar, hashes and verify included, and leaves the folder in step.
|
||||
var sidecar = ManifestStore.ReadSequence(fx.Paths.Sequence("a").ManifestPath);
|
||||
var frames = await fx.Db.Frames.ListBySequenceAsync(sequence.Id, cancellationToken: fx.Ct);
|
||||
Assert.Count(4, frames);
|
||||
Assert.True(frames.All(f => f.Sha256 is not null), "hashed");
|
||||
Assert.SequenceEqual(sidecar.Frames.Select(f => (f.Id, f.Sha256)), frames.Select(f => (f.Id, f.Sha256)));
|
||||
Assert.True((await fx.Db.Sequences.GetAsync(sequence.Id, fx.Ct))!.Status.HasFlag(SequenceStatus.Verified), "verified");
|
||||
Assert.Empty((await fx.ScanAsync()).Sequences);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AnInfoEditKeepsTheSettingsTheApiSavedAfterItReadTheSequence()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user