Skip to content

0023. Customer deletion with tombstones so replays cannot recreate data

  • Status: Accepted
  • Date: 2026-11-08

Deleting a customer removes their history and stops waiting runs. Events and webhooks can be replayed after a deletion; without a record of the deletion, a replay would recreate the customer and restart runs.

  • Deleting a customer runs in one project transaction: delete the customer, their events, messages, and step-log personal data; insert a tombstone keyed by hash(external_id); exit their waiting runs with exited:customer_deleted through the per-customer run index; delete their trigger fire rows.
  • Hashed deduplication keys, run IDs, and fire keys outlive the deletion, so replaying a pre-deletion event or occurrence is a no-op.
  • The tombstone records the deletion time. An event for that external ID whose client timestamp is before the deletion (for example a delayed retry with a new key) is dropped instead of recreating the customer; the ingest response reports it as ignored with reason customer_deleted, and the drop is counted. The same rule applies to customer updates. A new event or update with a later timestamp creates a new customer. Client clock skew can drop a genuinely new event sent right after a deletion; this is accepted.
  • Queue messages carry IDs only, so no personal data sits in a queue.
  • Buffered ingest (ADR 0010) writes the payload as an encrypted blob in R2 (S3 in containers), under a key prefixed by project and HMAC(external_id), before acknowledging the request; the queue message carries only the blob reference. The consumer deletes the blob after applying it. Customer deletion also deletes the customer’s unconsumed blobs by that prefix, and a blob consumed after the deletion is dropped by the tombstone rule.
  • Deletion also covers archives in R2 (ADR 0010), asynchronously after the transaction, and is appended to the deletion log in D1 so a point-in-time restore can replay it.
  • Tombstones and deduplication hashes contain no personal data and follow the deduplication key retention.
  • The archive format must allow removing one customer’s records; it is chosen with the hot-window design, before the archival code is written.

Amendment (2026-11-19, pending ADR 0045, ADR 0046, ADR 0047, and ADR 0048, Proposed): the deletion transaction also deletes the customer’s event summary rows, open and click records, and experiment assignments. Conditions hold internal customer IDs only, so workflow versions keep no personal data after a deletion.