fix(server): omit redundant tombstone reconciliation discards

This commit is contained in:
cabbage committed 2026-11-16 15:18:07 +00:00
1 parent 9e7c409ba7
commit 86a9cfdd72
9 files changed
+228 -3

No files matched your search

+7 -1
View File
@@ -183,7 +183,13 @@ func (store *Store) reconcileClientSnapshotAt(ctx context.Context, clientID stri
incidents = append(incidents, reconcileIncident{issue: parseIssueUnchecked(key), summary: "client and server command state disagree; local process must be terminated", dataLoss: true})
}
case domain.ReconcileDiscardLocalTerminal:
result.DiscardLocalTerminalIssueUuids = append(result.DiscardLocalTerminalIssueUuids, key)
// Tombstones already have no command body or outbox to discard.
// Keep validating their hash/revision and reconciling contradictions
// above, but do not echo the growing compact ledger on every reconnect.
// The redundant UUID list alone can exceed a legacy peer's read limit.
if !client.GetTombstoned() {
result.DiscardLocalTerminalIssueUuids = append(result.DiscardLocalTerminalIssueUuids, key)
}
case domain.ReconcileResumeDelivery:
if generation != 0 && row.target.Valid && uint64(row.target.Int64) != generation || generation != 0 && !row.target.Valid {
if _, err := tx.ExecContext(ctx, `UPDATE commands SET target_session_generation = ? WHERE issue_uuid = ? AND client_id = ? AND lifecycle BETWEEN 2 AND 4`, generation, row.issue[:], clientID); err != nil {