Why this matters
Erasure must be complete, consistent, and auditable.
Provide a single idempotency-keyed erasure workflow that scrubs PII in primary DB, caches, search indices, and object storage; emit an audit event with erasure_request_id. (GDPR Art. 17)
Erasure must be complete, consistent, and auditable.
Side-by-side examples engineers can pattern-match during review.
function eraseUser(userId){
db.exec("DELETE FROM users WHERE id=?", [userId]);
}function eraseUser(userId, key){
if(alreadyProcessed(key)) return;
db.exec("UPDATE users SET email=NULL, name=NULL WHERE id=?", [userId]);
cache.del("user:"+userId);
search.delete("user", userId);
storage.deletePrefix("users/"+userId+"/");
audit.emit("gdpr.erased", { userId, erasure_request_id: key, at: now() });
markProcessed(key);
}eraseUser(userId, "req-9b3a");eraseUser(userId); // no idempotency, no cache/search cleanupFrom the same buckets as this rule.