Skip to content

feat(settings): add Danger Zone with self-service data and account deletion#379

Open
junhoyeo wants to merge 2 commits intomainfrom
feat/settings-danger-zone
Open

feat(settings): add Danger Zone with self-service data and account deletion#379
junhoyeo wants to merge 2 commits intomainfrom
feat/settings-danger-zone

Conversation

@junhoyeo
Copy link
Copy Markdown
Owner

@junhoyeo junhoyeo commented Mar 31, 2026

Summary

  • Add a Danger Zone section to the Settings page with two destructive actions:
    • Delete submitted data — removes leaderboard entries, profile stats, and usage history while keeping the account active
    • Delete account — permanently deletes the user and all associated data (sessions, tokens, submissions) via ON DELETE CASCADE
  • Both flows use a 3-step confirmation modal (intent → warning → typed confirmation) matching the CLI's triple-confirmation pattern from tokscale delete-submitted-data

Diff scope

  • packages/frontend/src/app/settings/SettingsClient.tsx — Danger Zone UI section with DangerConfirmationModal component (3-step flow, step dots, typed confirmation input)
  • packages/frontend/src/app/api/settings/account/route.ts — new DELETE route that removes the users row (cascades to sessions, apiTokens, submissions → dailyBreakdown, deviceCodes), clears the session cookie, and invalidates caches
  • packages/frontend/__tests__/api/settingsAccountDelete.test.ts — 5 test cases covering auth, success, 404, 500, and cookie-cleanup-failure paths

Test proof

  • bunx vitest run packages/frontend/__tests__/api/*.test.ts
    • 9 files, 51 tests passed

Related


Open with Devin

Summary by cubic

Adds a Danger Zone to Settings for self‑service deletion of submitted data and full account removal. Introduces DELETE /api/settings/account with cascade deletion, session cleanup, and cache revalidation.

  • New Features
    • Settings UI: Two actions — Delete submitted data and Delete account — each with a 3‑step confirmation modal (intent → warning → typed phrase with step dots). Account deletion signs out and redirects home; data deletion stays on page and shows a success alert.
    • Backend: DELETE /api/settings/account deletes the users row (cascades to sessions, tokens, submissions), clears the auth cookie (best‑effort), and revalidates leaderboard/user caches. Data deletion uses DELETE /api/settings/submitted-data.
    • Tests: 5 cases covering auth, success, 404, 500, and cookie‑cleanup failure.

Written for commit 40c5965. Summary will update on new commits.

…letion

Add a Danger Zone section to the Settings page with two destructive actions:

- Delete submitted data: removes leaderboard entries, profile stats, and
  usage history while keeping the account active
- Delete account: permanently deletes the user and all associated data
  (sessions, tokens, submissions) via ON DELETE CASCADE

Both flows use a 3-step confirmation modal (intent → warning → typed
confirmation) matching the CLI's triple-confirmation pattern.

New API route: DELETE /api/settings/account
New tests: settingsAccountDelete.test.ts (5 cases)
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Mar 31, 2026

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

Project Deployment Actions Updated (UTC)
tokscale Ready Ready Preview, Comment Apr 1, 2026 11:53pm

Request Review

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

devin-ai-integration[bot]

This comment was marked as resolved.

Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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