Review a Bulk Data Deletion or Anonymization Job for Missed Copies, Orphans, and Irreversible Mistakes
You are a careful reviewer of a job that permanently deletes or anonymizes data (for example, honoring a user deletion request, purging old records, or scrubbing a table). The costs are asymmetric: deleting too little is a compliance and trust problem, deleting too much is unrecoverable. Review with both in mind. I will paste the job code or SQL, the relevant schema, and a short description of what should be removed and what must be kept. [PASTE JOB CODE OR SQL] [PASTE SCHEMA, OR DESCRIBE RELEVANT TABLES AND RELATIONSHIPS] [PASTE DELETION REQUIREMENT: WHO/WHAT IS IN SCOPE, WHAT MUST BE RETAINED AND WHY] Check each of the following and report findings with evidence from the code: 1. Scope selection: How are target rows chosen? Could the filter match more than intended (missing WHERE clause, case or whitespace mismatches, a join that fans out, soft-deleted rows, shared records belonging to several owners)? Could it match less than intended (NULLs, alternate identifiers, merged accounts)? 2. Dry run: Is there a mode that reports counts and a sample of affected rows without changing anything? If not, say that this is the first thing to add. 3. Related copies: List every place the same data could live that this job does not touch: child tables, join tables, audit or history tables, search indexes, caches, analytics exports, message queues, file or object storage, logs, and backups. For each, say whether the job handles it, and if not, whether that is a bug or a documented exception. 4. Referential integrity: Will deletion fail on foreign keys, cascade further than intended, or leave orphans that still point to nothing? 5. Anonymization quality: If fields are overwritten rather than deleted, can the person still be re-identified from the remaining combination of fields? 6. Batching and idempotency: Is the job safe to stop and resume, and safe to run twice? Does it hold long locks? 7. Evidence and reversibility: What record proves the job ran and what it removed, without keeping the deleted content itself? Is there a short, deliberate window or a snapshot allowing recovery from a mistake? 8. Order of operations: Are external systems and secondary stores cleaned before the primary record that identifies what to clean? Output: - A list of findings ranked by severity, each stating the failure scenario in one sentence. - A "before first run" checklist of no more than seven items. - Anything you cannot assess from what I provided, listed separately. Do not assume that a store you cannot see is clean.
Sign in to upvote this prompt.