fix(copies): close the eleventh verification round of owner review 6
- A merge's Verify stage journals a second version, with the hash it is filed as, before it files it. A run that stops between filing it and leaving it out of Main (a drive dropping out, project.json held, the app closing) now leaves it out on resume, instead of reading it as the kept sequence's own photo and keeping both versions in Main for good. - Upload all local ignores a Kept apart pair whose server sequence is confirmed deleted only when the answer came before the first 404. A Keep here, answered after the deletion was shown, skips the sequence again instead of uploading it and erasing the answer. - An upload's checkpoint records whether the job joined a server sequence this PC already knew. A resumed or retried upload no longer takes such a sequence for one it made and overwrites its details. Refs #73 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e002c583d6
commit
6db4c2e80c
10 files changed
+168
-10
No files matched your search
@@ -183,6 +183,30 @@ public sealed class CopyEngineTests(TestContext context)
|
||||
Assert.NotNull(await f.Sync.Links.GetAsync(f.Server, remote.Id, f.Ct));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task KeepHereOfASequenceDeletedOnTheServerIsLeftOutOfUploadAllLocal()
|
||||
{
|
||||
await using var f = await FixtureAsync(context);
|
||||
var local = await f.LocalAsync("Comet", f.NewPhotos(2));
|
||||
var gone = Guid.CreateVersion7();
|
||||
var pair = await f.Sync.Copies.EnsureLinkedAsync(f.Server, gone, local.Id, f.Ct);
|
||||
// Deleted on the server: two 404s the re-check apart, read as deleted on server.
|
||||
var at = DateTimeOffset.UtcNow.AddHours(-2);
|
||||
await f.Sync.Copies.MarkRemoteGoneAsync(f.Server, gone, local.Id, Guid.NewGuid(), at, f.Ct);
|
||||
await f.Sync.Copies.MarkRemoteGoneAsync(f.Server, gone, local.Id, Guid.NewGuid(), at.AddHours(1), f.Ct);
|
||||
using var engine = Engine(f);
|
||||
|
||||
await engine.KeepHereAsync(pair.Id, f.Ct);
|
||||
|
||||
// Kept here: Upload all local leaves it out, and the answer stays.
|
||||
var row = (await f.Sync.Copies.GetAsync(pair.Id, f.Ct))!;
|
||||
Assert.Equal((CopyState.KeptApart, true), (row.State, row.RemoteGone));
|
||||
var entry = new SyncEntry(local, null, SyncStatus.LocalOnly);
|
||||
var (upload, skipped) = UploadAllRule.Select([entry], await f.Sync.Copies.ListAsync(f.Ct), new HashSet<Guid>(), new HashSet<Guid>());
|
||||
Assert.Empty(upload);
|
||||
Assert.Equal(local.Id, skipped.Single().Entry.Local!.Id);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task LinkIsRefusedWhenTheLocalCopyIsLinkedToAnotherServerSequence()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user