Skip to content

feat(profile): self-service account deletion - #1253

Open
JamieRuderman wants to merge 12 commits into
mainfrom
feat/self-service-account-deletion
Open

JamieRuderman wants to merge 12 commits into
mainfrom
feat/self-service-account-deletion

Conversation

@JamieRuderman

Copy link
Copy Markdown
Member

Summary

Replaces the "request account deletion" email form on the Profile page with real self-service deletion, using the graphql-api requestAccountDeletion / deleteAccount(code) mutations.

How to remove Remote.It is the main action. It opens instructions for uninstalling from each kind of device (Debian/Raspberry Pi and OpenWrt commands, the desktop apps, and a link to the support article), plus a list of the devices the person owns.

Delete my account is the secondary action. It opens a three-step dialog:

  1. Acknowledge. Lists the owned devices and requires a checkbox: "Remote.It stays installed and running on my devices, and deleting my account won't remove it." Continue stays disabled until the device list has loaded, so whether this device gets unregistered is never left to a fetch that hasn't finished.
  2. Optional survey. The existing reasons list, now skippable. A Zendesk ticket ("Account deleted: …") is only sent when something was filled in.
  3. Confirm with an emailed code. Wrong codes show inline, and after the fifth the dialog asks for a new code (matching the server's limit). Server refusals (active subscription, organization members) appear in place.

When the computer running the desktop app is registered to the person, that device is unregistered first (registration: DELETE through the local backend). If that fails, the account is not deleted. After deletion the dialog shows a confirmation and signs out.

The paid-plan and organization-member notices are now advisory and link to the place to fix them. The server makes the final decision, so a client check that's stricter than the server can no longer block someone permanently.

Copy is in en/ja/de/es. The obsolete ui.deleteAccount flag and the old "3–5 business days" strings are removed, and common.continue now has ja/de/es translations, which were missing.

Notes

  • This device is unregistered before deleteAccount(code) runs, because the CLI needs the person's credentials to unregister. A mistyped code or a refusal at confirmation therefore leaves this device unregistered while the account remains. A verify-without-consuming step in graphql-api would close that gap.
  • The client mirrors the server's 5-attempt limit and assumes a refusal at confirmation has used up the code (it does today: the code is deleted before the cascade checks run).

Test plan

  • npx tsc --noEmit
  • npx vitest run (157 tests). New tests cover the dialog flow (acknowledgement gate, unregister-before-delete, failed unregister aborts the deletion, wrong-code limit, refusals, network failure keeps the code, the survey is optional), backend.unregisterThisDevice, and owned-device parsing.
  • npm run i18n:check
  • Ran through the whole flow in a local preview with mocked GraphQL and a faked local backend: acknowledgement, survey, code, wrong code, unregister failure, server refusal, done screen. Also checked ja/de at phone width.
  • Real deletion against the dev API with a throwaway account, in the desktop app with a registered device

@JamieRuderman

Copy link
Copy Markdown
Member Author

@codex review

@aws-amplify-us-west-1

Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-1253.d20k671nqqv4kl.amplifyapp.com

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f69d909b71

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread frontend/src/hooks/useOwnedDevices.ts Outdated
return () => {
current = false
}
}, [enabled, userId])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Refetch ownership when the local device ID changes

When this hook fetches while backend.thisId is still empty—for example, before the desktop backend reports its registration—or when this device is registered after the first fetch, the cached result has thisDeviceOwned: false. Because the effect omits thisId from its dependencies and also stops once owned is set, the ownership state is never refreshed; DeleteAccountDialog consequently skips unregisterThisDevice() and deletes the account without first unregistering the local agent. Invalidate and refetch the cached ownership whenever thisId changes.

Useful? React with 👍 / 👎.

@JamieRuderman

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4861aef81b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread frontend/src/hooks/useOwnedDevices.ts Outdated

useEffect(() => {
if (!enabled || !userId) return
if (owned && (!thisId || thisId === fetchedFor.current)) return

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Refresh ownership whenever a dialog is reopened

After either dialog has loaded once, closing and reopening it leaves owned populated, so this guard prevents a new request even though enabled toggled off and back on. If the local device is transferred to or from this account while the Profile page remains mounted, its ID stays the same but thisDeviceOwned changes; the deletion flow then either skips the required unregister or attempts to unregister a device the user no longer owns. Invalidate the cached result when the dialog closes or fetch again on each open.

Useful? React with 👍 / 👎.

@JamieRuderman

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. You're on a roll.

Reviewed commit: 6b4496fe1b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@JamieRuderman JamieRuderman changed the title feat(profile): self-service account deletion feat(profile): self-service account deletion. Nov 16, 2026
@JamieRuderman JamieRuderman changed the title feat(profile): self-service account deletion. feat(profile): self-service account deletion Nov 16, 2026
@JamieRuderman JamieRuderman reopened this Nov 16, 2026
@github-actions

Copy link
Copy Markdown

Amplify branch preview (ready once the build finishes): https://feat-self-service-account-deletion.d20k671nqqv4kl.amplifyapp.com

@JamieRuderman JamieRuderman changed the title feat(profile): self-service account deletion feat(profile): self-service account deletion. Nov 16, 2026
@JamieRuderman JamieRuderman changed the title feat(profile): self-service account deletion. feat(profile): self-service account deletion Nov 16, 2026

This branch has not been deployed

No deployments
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