src/privacy/dataMap.ts defines an erasure policy per model:
export const erasurePolicies = {
Session: 'DELETE',
WebhookSubscription: 'DELETE',
AlertRule: 'DELETE',
Transaction: 'ANONYMIZE',
CostBasisLot: 'ANONYMIZE',
FiatOrder: 'ANONYMIZE',
ReferralConversion: 'ANONYMIZE',
AuditBlock: 'IMMUTABLE',
OutboxOp: 'IMMUTABLE',
}
Nothing else in the repo references erasurePolicies or dataMap (grep -rln "erasurePolicies" src tests returns only the definition file itself). There is no route, controller, or job that actually performs a GDPR/CCPA-style right-to-erasure request — the policy map is defined but has no execution path.
Task
- Add an erasure job/endpoint (admin-triggered to start, self-service can follow) that, given a
userId, walks erasurePolicies and applies DELETE/ANONYMIZE per model while leaving IMMUTABLE tables (audit chain, outbox) untouched.
- Support a dry-run mode that reports what would be deleted/anonymized without writing.
- Add tests covering each policy type and the immutable-table exclusion.
src/privacy/dataMap.tsdefines an erasure policy per model:Nothing else in the repo references
erasurePoliciesordataMap(grep -rln "erasurePolicies" src testsreturns only the definition file itself). There is no route, controller, or job that actually performs a GDPR/CCPA-style right-to-erasure request — the policy map is defined but has no execution path.Task
userId, walkserasurePoliciesand appliesDELETE/ANONYMIZEper model while leavingIMMUTABLEtables (audit chain, outbox) untouched.