Skip to content

feat(api): let people delete their own account - #703

Merged
mwoods79 merged 9 commits into
mainfrom
claude/project-thread-lq551j
Nov 25, 2026
Merged

mwoods79 merged 9 commits into
mainfrom
claude/project-thread-lq551j

Conversation

@mwoods79

@mwoods79 mwoods79 commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

DELETE /api/auth/account { password }
  AuthController.delete_account
    rate_limit (:delete_account, 5 / 5 min per user) -> 429 + Retry-After
    Accounts.delete_account (checks password, locks row) -> 422 on wrong/missing password
      User.Changes.DeleteAccount
        anonymize row (placeholder email, "Deleted member", role: :user, deleted_at, clear PII)
        cut_ties (in transaction):
          revoke all stored tokens & destroy API keys
          soft-delete profile pictures
          destroy own notifications
          destroy group invitations (by invitee_id or pre-deletion email)
          release upcoming RSVP & waitlist spots
          for owned groups (active + already archived):
            destroy draft huddlz
            if active: cancel upcoming published huddlz & archive group
          leave non-owned groups
      SuspensionEvents.notify -> disconnect open web sessions
  Notifications.Attribution -> render deleted users as "Deleted member"
  -> 204 No Content

Evidence

  • Before: No self-service account deletion endpoint (DELETE /api/auth/account 404); draft PR left group_invitations.email intact, leaked names in Notifications.Attribution, left drafts in owned/archived groups, kept admin role, and returned 403 instead of 429 on rate limit.
    After: mix format --check-formatted and MIX_ENV=test mix ash.codegen --check pass locally; full Cucumber (account_deletion.feature: deletion, spots, archived groups, drafts in active & archived groups, invitations, notifications, admin role reset, email re-registration, wrong/missing password) and AuthRateLimitControllerTest (429 + Retry-After) running in CI.

Merge Danger

Door: one-way

Adds a database migration (deleted_at column on users) and a destructive user-initiated anonymization action. Reverting code is easy, but once a real user deletes their account the anonymization cannot be undone.

Blast Radius: medium

Touches User, AuthController, Notifications.Attribution, SuspensionEvents, GroupInvitation, and Notification. Existing active accounts are unaffected unless they invoke DELETE /api/auth/account.

DELETE /api/auth/account takes the current password and anonymizes the
signed-in account. The row stays so shared history keeps its author, but
the email, name, password, home location and pictures are cleared.

- Revoke sessions, destroy API keys, release upcoming spots
- Leave groups; archive owned groups after cancelling their upcoming huddlz
- Deleted accounts receive no notifications
Adds users.deleted_at, which the account deletion action sets.
@mwoods79 mwoods79 self-assigned this Nov 9, 2026

mwoods79 commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

dependency-audit / Audit Hex dependencies is failing, and it is not caused by this PR.

mix hex.audit now reports a new advisory on ash_ai 1.5.0: EEF-CVE-2026-119613 (GHSA-vhmw-fwrr-r6c6, medium), "AshAi sends unrecognized tool errors verbatim to MCP clients and the model". This PR does not touch mix.exs or mix.lock, and the lockfile matches main, whose last scheduled audit on Nov 8 passed before the advisory was published. The next scheduled audit on main should fail the same way.

No fix exists on main yet. The likely patch is bumping ash_ai past 1.5.0 in mix.lock (mix deps.update ash_ai) in its own dependency PR, or adding the advisory to the audit ignore list if no patched release is out. I can't resolve Hex packages from my environment, so I have not ported it here. Once it lands on main I will merge main into this branch.


Generated by Claude Code

claude and others added 3 commits November 9, 2026 21:19
The host holds one seat, so the huddl needs room for two, and only people
who RSVPd can see who else went.
…-lq551j

* origin/main:
  chore(deps): update Cucumber and patch Ash and DBConnection (#706)
  test(browser): stop browser scenarios flaking on slow external requests and LiveView joins (#700)
  chore(deps): refresh stable dependencies for November 22 (#701)
@mwoods79
mwoods79 marked this pull request as ready for review November 25, 2026 03:35
@mwoods79
mwoods79 merged commit 53cd6b6 into main Nov 25, 2026
5 checks passed
@mwoods79
mwoods79 deleted the claude/project-thread-lq551j branch November 25, 2026 04:06
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