Skip to content

Fix/account deletion cascade - #69

Merged
PaladinKnightMaster merged 8 commits into
devfrom
fix/account-deletion-cascade
Jun 7, 2026
Merged

PaladinKnightMaster merged 8 commits into
devfrom
fix/account-deletion-cascade

Conversation

@PaladinKnightMaster

@PaladinKnightMaster PaladinKnightMaster commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Summary

War-room #14 → 🟢. Account deletion is now provably complete + guarded.

  • Audited all 42 user-scoped tables: deletion cascades via the
    profiles.id → auth.users ON DELETE CASCADE chokepoint. The one gap —
    events.user_id SET NULL — is fixed to ON DELETE CASCADE
    (migration 10_account_deletion_events_cascade.sql, applied to the live DB
    via MCP; the committed SQL is idempotent).
  • New public.account_deletion_completeness() audit function (returns offending
    tables; verified empty) + a gated RPC regression test (auto-skips in CI).
  • Same-origin (CSRF) check on POST /api/auth/delete-account.
  • docs/technical/account-deletion.md documents the flow + GDPR follow-ups
    (auth audit log, Stripe, Sentry/Umami, backups, Art-15/20 portability).

Test Plan

  • Migration applied; account_deletion_completeness() returns 0 rows
  • lint clean · 90 tests pass (gated RPC test skips without creds) · build green
  • (optional) run the gated test locally with real Supabase creds before dev→main

PaladinKnightMaster and others added 8 commits June 4, 2026 13:57
…on guard (war-room #14)

Audit found deletion is sound (profiles-cascade chokepoint) except events, which
SET-NULLs instead of deleting. Fix: events.user_id -> ON DELETE CASCADE. Add a
gated schema-completeness test (pg + SUPABASE_DB_URL, skips in CI) + one-time MCP
proof + external-processor GDPR follow-up docs.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Pivot regression guard from pg+DB-URL to a Postgres account_deletion_completeness()
function + service-client RPC test (no new dep, MCP-verifiable). NOT EXISTS orphan
scrub. Downgrade one-time proof to structural+admin.createUser. Add CSRF/SameSite
note, .env*.local gitignore check, auth.audit_log_entries + Art 15/20 GDPR
follow-ups, test:db checklist.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
#14)

5 tasks: MCP migration (events CASCADE + audit fn, verify empty), gated RPC test,
same-origin CSRF check, docs + gitignore check, tracker to green. T1/T5 are
controller-run (Supabase MCP); T2-T4 subagent-implementable.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…udit fn (war-room #14)

Applied to the ai-form-coach Supabase project via MCP. Changes events.user_id
FK SET NULL -> ON DELETE CASCADE, and adds account_deletion_completeness()
(SECURITY DEFINER) which returns zero rows == every user table cascade-deletes.
Verified empty post-apply.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…se-in-depth)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…uarded

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

vercel Bot commented Jun 7, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ai-form-coach Ready Ready Preview, Comment Jun 7, 2026 5:58pm

@PaladinKnightMaster
PaladinKnightMaster merged commit c5fe801 into dev Jun 7, 2026
4 checks passed
@PaladinKnightMaster
PaladinKnightMaster deleted the fix/account-deletion-cascade branch June 7, 2026 18:12
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.

1 participant