fix(clients): withdraw delete tombstones for clients any serialized write re-creates

Deleting a client tombstones its email for 90s, so a node snapshot taken
before the delete reached the node cannot resurrect it. Client create and
bulk create withdrew that tombstone, but a client re-created through
InboundService.AddInbound (SyncInbound / syncInboundClients) did not. On a
master, re-adding a node inbound with a just-deleted email therefore let
the next node merge filter the new client out of the snapshot, unlink it
from its inbound and mark it a sync orphan; ReapSyncOrphans then
hard-deleted it 15 minutes later and the node lost it.

syncInboundClients now records the emails it creates on the serialized
transaction, and runSerializedTx withdraws their tombstones only after the
commit, still on the writer, so no merge runs in between and a rolled-back
create leaves the tombstone standing. The per-call withdraws in Create and
bulkCreate are covered by this and removed.

Co-authored-by: FZ1010 <FZ1010@users.noreply.github.com>
This commit is contained in:
Farhan Zare
2026-10-23 13:30:13 -04:00
committed by GitHub
parent f172bc3f10
commit 47be06358e
6 changed files with 129 additions and 14 deletions
-5
View File
@@ -1505,9 +1505,6 @@ func (s *ClientService) bulkCreate(inboundSvc *InboundService, payloads []Client
skip(prep[idx].client.Email, reason[idx])
continue
}
// The client is already live after fanout; never leave a stale delete
// tombstone merely because applying its optional HWID limit failed.
withdrawClientTombstones(prep[idx].client.Email)
if err := s.setClientLimitHwidByEmail(prep[idx].client.Email, prep[idx].limitHwid); err != nil {
skip(prep[idx].client.Email, err.Error())
continue
@@ -1517,8 +1514,6 @@ func (s *ClientService) bulkCreate(inboundSvc *InboundService, payloads []Client
inserted = append(inserted, prep[idx].payloadIdx)
}
}
// A re-created email is a live identity again: a delete tombstone left
// standing makes the next node merge prune the new client's inbound links.
return result, inserted, needRestart, nil
}