Sync: take the server having no such item as a delete done, not a rejection nobody can clear

This commit is contained in:
jaap-jan committed 2026-10-02 14:18:28 +02:00
1 parent b2516ca7fb
commit ff8a790f6c
2 files changed
+75 -1

No files matched your search

+15
View File
@@ -539,6 +539,17 @@ public sealed class SyncEngine
return resealed;
}
/// <summary>Whether a refused operation is a delete of an item the server never had.</summary>
/// <remarks>
/// A delete queued over a create that never reached the server carries no expected version, and the
/// server's only reason to refuse one of those is that it has no such item — which is the state the delete
/// asked for, so it is done. It used to be parked as a rejection: a "conflict" about an item nobody else
/// had ever seen, which the user could neither resolve nor dismiss. A create that did land is no exception
/// to this — the server has the item then, and applies the delete.
/// </remarks>
private static bool DeletesSomethingNeverCreated(PendingOperation operation) =>
operation is { Operation: SyncOperation.Delete, ExpectedVersion: null };
/// <returns>Whether this answer warrants another push round.</returns>
private async Task<bool> HandleAsync(
Guid vaultId,
@@ -581,6 +592,10 @@ public sealed class SyncEngine
cancellationToken).ConfigureAwait(false);
return false;
case SyncOperationStatus.Invalid when DeletesSomethingNeverCreated(operation):
await outbox.CompleteAsync(operation, cancellationToken).ConfigureAwait(false);
return false;
case SyncOperationStatus.Invalid:
await RejectAsync(
vaultId,