Skip to content

feat: account deletion and data anonymisation - #637

Merged
jim-counter merged 4 commits into
mainfrom
claude/reverent-matsumoto
Apr 1, 2026
Merged

feat: account deletion and data anonymisation#637
jim-counter merged 4 commits into
mainfrom
claude/reverent-matsumoto

Conversation

@jim-counter

Copy link
Copy Markdown
Member

Summary

Implements #626 — GDPR/CCPA-compliant account deletion with a 30-day grace period.

  • User-facing: Delete account button on profile, confirmation modal with reason field, global warning banner with cancel button on all drive pages
  • Anonymisation: After grace period, a backend worker job soft-deletes object ownership, expires credits/intents, anonymises username & avatar, removes org memberships, and revokes API keys
  • Admin panel: View/filter deletion requests by status, add admin notes, audit trail per user
  • Cross-service coordination: Backend orchestrates the flow via auth service HTTP calls (pending → processing → completed/failed)
  • Audit logging: All anonymisation actions logged to deletion_audit_log for compliance
  • Timezone fix: All new timestamp columns use timestamptz to avoid UTC offset drift

Test plan

  • Request deletion as regular user — confirmed modal, banner appears immediately
  • Cancel deletion via banner — banner disappears, delete button reappears
  • Verify admin panel shows all requests with correct statuses
  • Set scheduled time to past, run worker — confirmed anonymisation completes (username replaced, avatar cleared, status=completed, audit log entries written)
  • Re-onboard with same wallet — account works but old files not re-linked
  • yarn auth test — 27 passed
  • yarn backend test — 351 passed (1 pre-existing S3 integration failure)
  • yarn lint — clean across all services

🤖 Generated with Claude Code

Implement GDPR/CCPA-compliant account deletion with 30-day grace period,
PII anonymisation across auth and backend services, admin visibility,
and audit logging.

- User can request deletion from profile, cancel via global banner
- 30-day grace period before automated anonymisation
- Backend worker job processes due requests: soft-deletes ownership,
  expires credits/intents, anonymises username/avatar, removes org
  memberships, revokes API keys
- Admin panel for viewing requests, filtering by status, adding notes
- Audit log tracks all anonymisation actions for compliance
- All timestamp columns use timestamptz for correct timezone handling

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@netlify

netlify Bot commented Mar 31, 2026

Copy link
Copy Markdown

Deploy Preview for auto-drive-storage ready!

Name Link
🔨 Latest commit f8c25cb
🔍 Latest deploy log https://app.netlify.com/projects/auto-drive-storage/deploys/69cbb20c6e783d00087cc117
😎 Deploy Preview https://deploy-preview-637--auto-drive-storage.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread apps/backend/src/infrastructure/services/auth/index.ts
Comment thread apps/backend/src/core/users/deletion.ts
- markDeletionAsProcessing returns null on 404/409 instead of throwing,
  so the race-safety skip branch is reachable and competing workers
  don't incorrectly mark requests as failed
- getUserFromPublicId failure now propagates instead of being silently
  swallowed, preventing incomplete anonymisation from being marked as
  completed

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jim-counter

Copy link
Copy Markdown
Member Author

bugbot run

Comment thread apps/auth/src/useCases/deletion.ts
Comment thread apps/backend/src/app/servers/frontendWorker.ts Outdated
- markAsCompleted requires fromStatus=Processing, preventing cancelled
  or failed requests from being erroneously marked completed
- markAsFailed requires fromStatus=Processing for same reason
- Move deletion job start after the somethingActive guard so the
  "no services active" exit path remains reachable

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jim-counter

Copy link
Copy Markdown
Member Author

bugbot run

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Describes the deletion lifecycle, grace period, anonymisation steps,
DSN data persistence, and audit logging for admin context.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@EmilFattakhov EmilFattakhov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks solid!

@jim-counter
jim-counter merged commit d6b3db4 into main Apr 1, 2026
7 checks passed
@jim-counter
jim-counter deleted the claude/reverent-matsumoto branch April 1, 2026 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants