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:
Alby96andClaude Opus 5.5 committed 2026-11-18 14:01:45 +01:00
1 parent e002c583d6
commit 6db4c2e80c
10 files changed
+168 -10

No files matched your search

+8 -4
View File
@@ -55,10 +55,10 @@ public static class UploadAllRule
foreach (var entry in localOnly)
{
if (entry.Local is not { } local) continue;
// A Kept apart answer about a server sequence confirmed deleted there (two 404s apart) holds nothing back: that
// sequence is no copy of anything any more, and the local one is this PC's only.
var pairs = (bySequence.GetValueOrDefault(local.Id) ?? []).Where(p => p is not { Kind: CopyKind.LocalServer, State: CopyState.KeptApart, RemoteGone: true })
.ToList();
// A Kept apart answer given before a server sequence was confirmed deleted there (two 404s apart) holds nothing
// back: that sequence is no copy of anything any more, and the local one is this PC's only. A Keep here, answered
// once the deletion was shown, is the user's answer about the deletion itself: it still skips.
var pairs = (bySequence.GetValueOrDefault(local.Id) ?? []).Where(p => !ApartBeforeDeletion(p)).ToList();
UploadSkip? why =
busy.Contains(local.Id) || pairs.Any(p => p.State == CopyState.Integrating) ? UploadSkip.Busy
: pairs.Any(p => p.Kind == CopyKind.LocalServer && p.RemoteGoneHits >= 1) ? UploadSkip.DeletedOnServer
@@ -71,6 +71,10 @@ public static class UploadAllRule
}
return (upload, skipped);
static bool ApartBeforeDeletion(FoundCopy p) =>
p is { Kind: CopyKind.LocalServer, State: CopyState.KeptApart, RemoteGone: true, AnsweredAt: { } answered, RemoteGoneAt: { } gone }
&& answered < gone;
void Add(Guid id, FoundCopy copy)
{
if (!bySequence.TryGetValue(id, out var list)) bySequence[id] = list = [];