fix: full verification against the brief — 137 confirmed findings fixed over six passes #4

Merged
Alby96 merged 169 commits from claude/keen-knuth-uhxv8w into main 2026-10-13 12:10:04 +02:00
2 changed files with 34 additions and 1 deletions
Showing only changes of commit 8927ac97e2 - Show all commits

No files matched your search

+4 -1
View File
@@ -767,6 +767,9 @@ public sealed class SyncService
if (metadata)
{
var manifest = SequenceWriter.ReadLocked(folder, row.Id);
// Asked before the sidecar is written: frames or flags another process wrote there since this index last
// synced the folder keep it changed for the next scan (ArchiveIndexer.InStepAsync).
var inStep = await Archives.Indexer.InStepAsync(archive, folder, manifest, cancellationToken).ConfigureAwait(false);
ManifestStore.WriteSequence(folder.ManifestPath, manifest with
{
Title = updated.Title,
@@ -776,7 +779,7 @@ public sealed class SyncService
Versions = manifest.Versions with { Settings = Math.Max(manifest.Versions.Settings, updated.SettingsVersion) },
UpdatedAt = DateTimeOffset.UtcNow,
});
await Archives.Indexer.RecordStampsAsync(archive, folder, row.Id, cancellationToken).ConfigureAwait(false);
if (inStep) await Archives.Indexer.RecordStampsAsync(archive, folder, row.Id, cancellationToken).ConfigureAwait(false);
}
return updated;
}
@@ -1,6 +1,8 @@
using Titano.Core.Model;
using Titano.Core.Project;
using Titano.Data.Archiving;
using Titano.Data.Sync;
using Titano.Data.Tests.Archiving;
using Titano.Protocol;
using Titano.Protocol.Client;
using Titano.Testing;
@@ -289,6 +291,34 @@ public sealed class SyncServiceTests(TestContext context)
Assert.SequenceEqual(["sunset"], (await f.Db.Sequences.GetAsync(local.Id, f.Ct))!.Tags);
}
[Test]
public async Task InfoTakenFromTheServerLeavesPhotosAnotherWriterAddedHereToTheNextScan()
{
await using var f = await SyncFixture.CreateAsync(context);
var photos = f.NewPhotos(2);
var local = await f.LocalAsync("Harbour", photos);
var remote = f.Remote.Add("Harbour", photos);
await f.Sync.LinkAsync(f.Server, remote.Id, local.Id, f.Ct);
await f.RefreshAsync();
// A desktop sharing this PC's archive imports a photo into the sequence: its own index follows the sidecar, this one not yet.
var (desktop, archive) = await f.Archive.OtherWriterAsync();
var staged = f.Archive.Stage(ArchiveFixture.Start.AddMinutes(10), seed: 90);
await desktop.Ingest.CommitAsync(new IngestRequest(archive.Id, local.Id, null, null, staged.Path, "IMG_0009.JPG", staged.Size, staged.Sha256, null, null),
f.Ct);
// The server's new title reaches this PC meanwhile, in its index and the sidecar.
await f.Remote.UpdateSequenceAsync(remote.Id, new UpdateSequenceRequest("Harbour at dusk", null, null, null, null, null), f.Ct);
await f.RefreshAsync();
var taken = (await f.Db.Sequences.GetAsync(local.Id, f.Ct))!;
Assert.Equal(("Harbour at dusk", 2), (taken.Title, taken.FrameCount));
// The next scan still finds the folder changed, and indexes the photo.
Assert.Contains(local.Id, (await f.Archive.ScanAsync()).Sequences);
var row = (await f.Db.Sequences.GetAsync(local.Id, f.Ct))!;
Assert.Equal(("Harbour at dusk", 3), (row.Title, row.FrameCount));
}
[Test]
public async Task TheSameEditOnBothSidesIsAgreedWithoutAConflict()
{