fix(copies): close the ninth verification round of owner review 6
- A merge leaves each second version out of Main as it files it (Copy stage keep-both and SameUnhashed versions, Verify stage versions), so a merge abandoned before its Details stage (details changed meanwhile, a stale stage, a cancel) no longer leaves both versions in Main for good, which a new plan could not undo (owner Q3). - A merge plan whose kept sequence has tombstones hashes the other's unhashed frames matched by size and time, so content the kept sequence deleted is listed as a last copy; a verify that still finds such content drops the journal and fails as a stale plan instead of failing on every retry. - Download originals uses a key of the job only when the holder of the server sequence's key is kept apart from it or linked elsewhere: a link a 404 forgot (pair Candidate) refills and re-links the local copy instead of duplicating every photo into a new sequence. - A 404 for a server sequence no local copy is linked to deletes its Candidate and Kept apart pairs, so Upload all local sends the local sequence again instead of skipping the only copy as a suspected one (owner Q8). Refs #73 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
aad8ae46dd
commit
c1c02d8ef7
10 files changed
+286
-16
No files matched your search
@@ -177,6 +177,32 @@ public sealed class SyncServiceCopyTests(TestContext context)
|
||||
Assert.True(pair.NeedsAttention);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task AMatchWhoseServerSequenceIsDeletedIsGoneAfterTheRefreshAndUploadAllSendsTheLocalOne()
|
||||
{
|
||||
await using var f = await SyncFixture.CreateAsync(context);
|
||||
var nas = new FakeSyncRemote { Server = HomeFolders.IdKey(Guid.NewGuid()) };
|
||||
var photos = f.NewPhotos(3);
|
||||
var local = await f.LocalAsync("Comet", photos);
|
||||
var remote = nas.Add("2026-09-28 Canon", photos);
|
||||
remote.FirstCapture = local.FirstCapture;
|
||||
remote.CameraModel = local.CameraModel;
|
||||
await f.Sync.RefreshAsync(nas, new SyncPolicy(), f.Ct);
|
||||
var pair = (await f.Sync.Copies.ListByServerAsync(nas.Server, f.Ct)).Single();
|
||||
Assert.Equal((CopyState.Candidate, local.Id), (pair.State, pair.LocalId));
|
||||
Assert.Null((await f.Sync.Links.GetAsync(nas.Server, remote.Id, f.Ct))!.LocalId);
|
||||
|
||||
// Deleted on the server: no longer listed, and a 404 when asked for.
|
||||
nas.Sequences.Remove(remote.Id);
|
||||
await f.Sync.RefreshAsync(nas, new SyncPolicy(), f.Ct);
|
||||
|
||||
Assert.Null(await f.Sync.Copies.GetAsync(pair.Id, f.Ct));
|
||||
var entries = (await f.Sync.ListAsync(nas.Server, f.Ct)).Where(e => e.Local?.Id == local.Id).ToList();
|
||||
var (upload, skipped) = UploadAllRule.Select(entries, await f.Sync.Copies.ListAsync(f.Ct), new HashSet<Guid>(), new HashSet<Guid>());
|
||||
Assert.Empty(skipped);
|
||||
Assert.Equal(local.Id, upload.Single().Local!.Id);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task ASequenceReadAsDeletedOnTheServerIsClearedWhenItIsListedAgainOrLinkedAgain()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user