fix(copies): address the owner review 6 findings
The review of the found-copies work showed pairs that could stick, jobs that could act on a pair the user had answered otherwise, and detection gaps: - forgetting a link on an address-keyed server deletes the pair and Candidate rows of that remote and resets the probe, so the sequence is found again when it is back; a Linked/Integrated row with no link is asked again - 404s count only on id-keyed servers, at most once per recheck interval - probes store the server's newest update time (copy_probes.server_newest, migration 0012) instead of comparing with this PC's clock; the lookup sample carries hashed photos by size and capture time too, for servers that have not hashed their copy - the older-server gate no longer re-compares unchanged manifests - a failed Integrate keeps its job id so a retry resumes only an untouched pair; cancel and stale plans release the pair (ReleaseAsync) - automatic photo transfers never create or retarget a sequence - a first upload files photos the server holds elsewhere into the new sequence - Unlink re-compares before keeping apart; Trash here names only true last copies; Drop... trashes one version on both sides after re-checking the other - a merge keeping the pair's other sequence swaps the dialog's columns and re-keys Different choices; Upload all reads every pair Each fix has a regression test where it makes sense. Refs #73 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
96b5b4078b
commit
fe752a0a21
33 files changed
+957
-123
No files matched your search
@@ -239,6 +239,51 @@ public sealed class SyncServiceCopyTests(TestContext context)
|
||||
Assert.True((await f.Sync.Copies.ListByServerAsync(f.Server, f.Ct)).All(p => p.RemoteGoneHits == 0));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task ASequenceForgottenOnAServerKnownByItsAddressIsFoundAgainWhenItIsBack()
|
||||
{
|
||||
await using var f = await SyncFixture.CreateAsync(context);
|
||||
f.Remote.Capabilities.Add(ServerCapabilities.PhotoLookup);
|
||||
var photos = f.NewPhotos(2);
|
||||
var local = await f.LocalAsync("Comet", photos);
|
||||
var remote = f.Remote.Add("Comet", photos);
|
||||
await f.Sync.LinkAsync(f.Server, remote.Id, local.Id, f.Ct);
|
||||
await f.RefreshAsync();
|
||||
f.Remote.Sequences.Remove(remote.Id);
|
||||
await f.RefreshAsync();
|
||||
Assert.Null(await f.Sync.LinkOfAsync(f.Server, local.Id, f.Ct));
|
||||
|
||||
// Back on the server: nothing remembers the forgotten link, so the two are found and asked about again.
|
||||
f.Remote.Sequences[remote.Id] = remote;
|
||||
await f.RefreshAsync();
|
||||
|
||||
var pair = (await f.Sync.Copies.ListByServerAsync(f.Server, f.Ct)).Single();
|
||||
Assert.Equal((local.Id, remote.Id, CopyState.Candidate), (pair.LocalId, pair.RemoteId!.Value, pair.State));
|
||||
Assert.Null(await f.Sync.LinkOfAsync(f.Server, local.Id, f.Ct));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task ALinkedPairWhoseLinkIsGoneIsAskedAboutAgain()
|
||||
{
|
||||
await using var f = await SyncFixture.CreateAsync(context);
|
||||
f.Remote.Capabilities.Add(ServerCapabilities.PhotoLookup);
|
||||
var photos = f.NewPhotos(2);
|
||||
var local = await f.LocalAsync("Comet", photos);
|
||||
var remote = f.Remote.Add("Comet", photos);
|
||||
await f.Sync.LinkAsync(f.Server, remote.Id, local.Id, f.Ct);
|
||||
await f.RefreshAsync();
|
||||
// The link removed by another hand, the pair's row left as it was.
|
||||
await f.Sync.Links.DeleteAsync(f.Server, remote.Id, f.Ct);
|
||||
var raised = new List<CopyFindResult>();
|
||||
f.Sync.CopiesFound += (_, result) => raised.Add(result);
|
||||
|
||||
await f.RefreshAsync();
|
||||
|
||||
var pair = (await f.Sync.Copies.ListByServerAsync(f.Server, f.Ct)).Single();
|
||||
Assert.Equal((CopyState.Candidate, false), (pair.State, pair.AutoPhotos));
|
||||
Assert.Contains(pair.Id, raised.SelectMany(r => r.New).Select(p => p.Id));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task DeletionCountsFollowEachComparison()
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user