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:
Alby96andClaude Opus 5.5 committed 2026-11-17 13:12:00 +01:00
1 parent 96b5b4078b
commit fe752a0a21
33 files changed
+957 -123

No files matched your search

+8 -3
View File
@@ -341,8 +341,11 @@ public sealed class SyncTableViewModel : ObservableObject, IDisposable
: new SyncMark(Copies.PairOf(entry.Id), null, _shell.Services.Server.Flow.Info?.Name);
/// <summary>The rule of Upload all local (design §6.4): what it sends, and what it leaves out and why.</summary>
private (IReadOnlyList<SyncEntry> Upload, IReadOnlyList<(SyncEntry Entry, UploadSkip Why)> Skipped) SelectUploads(IReadOnlySet<Guid> busy) =>
UploadAllRule.Select(LocalOnly, [.. Copies.Pairs.Select(p => p.Copy)],
/// <param name="busy">The targets of pending Integrate and Merge jobs.</param>
/// <param name="pairs">Every pair of the index (the last reload's when null), never only the ones listed for this server.</param>
private (IReadOnlyList<SyncEntry> Upload, IReadOnlyList<(SyncEntry Entry, UploadSkip Why)> Skipped) SelectUploads(IReadOnlySet<Guid> busy,
IReadOnlyList<FoundCopy>? pairs = null) =>
UploadAllRule.Select(LocalOnly, pairs ?? Copies.AllPairs,
_shell.Services.Settings.KnownServers.Select(k => k.OriginalsArchiveId).OfType<Guid>().ToHashSet(), busy);
/// <summary>Counts, rows, footer and the Library's sync glyphs after a reload.</summary>
@@ -523,7 +526,9 @@ public sealed class SyncTableViewModel : ObservableObject, IDisposable
busy.UnionWith(await db.Jobs.ListPendingTargetsAsync(JobKind.Integrate));
busy.UnionWith(await db.Jobs.ListPendingTargetsAsync(JobKind.MergeSequences));
}
var (upload, skipped) = SelectUploads(busy);
// The pairs as stored now: one found or answered since the last reload counts too.
var pairs = Copies.Engine is { } copies ? await copies.ListAllPairsAsync(CancellationToken.None) : Copies.AllPairs;
var (upload, skipped) = SelectUploads(busy, pairs);
_skipped.Clear();
foreach (var (entry, why) in skipped) _skipped[entry.Local!.Id] = why;
foreach (var entry in upload) await service.EnqueueUploadAsync(engine, server, entry.Local!);