feat(settings): add Danger Zone with self-service data and account deletion#379
Open
feat(settings): add Danger Zone with self-service data and account deletion#379
Conversation
…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)
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: devin-ai-integration[bot] <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
ON DELETE CASCADEtokscale delete-submitted-dataDiff scope
packages/frontend/src/app/settings/SettingsClient.tsx— Danger Zone UI section withDangerConfirmationModalcomponent (3-step flow, step dots, typed confirmation input)packages/frontend/src/app/api/settings/account/route.ts— newDELETEroute that removes theusersrow (cascades to sessions, apiTokens, submissions → dailyBreakdown, deviceCodes), clears the session cookie, and invalidates cachespackages/frontend/__tests__/api/settingsAccountDelete.test.ts— 5 test cases covering auth, success, 404, 500, and cookie-cleanup-failure pathsTest proof
bunx vitest run packages/frontend/__tests__/api/*.test.tsRelated
DELETE /api/settings/submitted-dataAPI route)Summary by cubic
Adds a Danger Zone to Settings for self‑service deletion of submitted data and full account removal. Introduces
DELETE /api/settings/accountwith cascade deletion, session cleanup, and cache revalidation.DELETE /api/settings/accountdeletes theusersrow (cascades to sessions, tokens, submissions), clears the auth cookie (best‑effort), and revalidates leaderboard/user caches. Data deletion usesDELETE /api/settings/submitted-data.Written for commit 40c5965. Summary will update on new commits.