Class: Privacy::ManualReviewDetector

Inherits:
Object
  • Object
show all
Defined in:
app/services/privacy/manual_review_detector.rb

Overview

Evaluates whether a party's data-deletion request should be held for human
review before the automated scrub runs. Tier-3 triggers from
doc/operations/PRIVACY_REQUESTS_RUNBOOK.md §6 — situations where
automated deletion would conflict with an active business or legal
obligation.

This is intentionally conservative: false positives ("admin had to click
approve") are cheap, false negatives ("we deleted a customer mid-dispute")
are catastrophic. New triggers go here over time as we encounter edge
cases.

Examples:

result = Privacy::ManualReviewDetector.call(party)
if result.held?
  deletion_request.update!(manual_review_reason: result.reasons)
  deletion_request.hold_for_review
else
  deletion_request.start_processing
end

Defined Under Namespace

Classes: Result

Class Method Summary collapse

Class Method Details

.call(party) ⇒ Object



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'app/services/privacy/manual_review_detector.rb', line 28

def self.call(party)
  return Result.new(held?: false, reasons: {}) if party.nil?

  reasons = {}

  open_order_ids = open_order_ids_for(party)
  reasons[:open_orders] = open_order_ids if open_order_ids.any?

   = (party)
  reasons[:staff_account] =  if 

  disputed_payment_ids = disputed_payment_ids_for(party)
  reasons[:disputed_payments] = disputed_payment_ids if disputed_payment_ids.any?

  Result.new(held?: reasons.any?, reasons: reasons)
end