feat(mobile): add in-app permanent account deletion - #481
Conversation
Greptile SummaryThe PR adds an in-app account-deletion flow for mobile, including reauthentication, server submission, localized confirmation and outcome messaging, and account-scoped local cleanup.
Confidence Score: 3/5The PR is not yet safe to merge because malformed responses can trigger destructive teardown and failed cleanup steps can leave durable account state without any retry. A schema-invalid response still becomes Files Needing Attention: apps/mobile/src/runtime/cloud/deletion.ts and apps/mobile/src/components/account/delete-account-section.tsx
|
| Filename | Overview |
|---|---|
| apps/mobile/src/runtime/cloud/deletion.ts | Implements deletion outcome classification and best-effort local teardown; previously reported correctness issues remain unresolved. |
| apps/mobile/src/components/account/delete-account-section.tsx | Adds confirmation, deletion orchestration, teardown invocation, and localized outcome alerts. |
| apps/mobile/src/runtime/cloud/idp.ts | Refactors native Apple authentication to return fresh identity and authorization credentials for deletion. |
| apps/mobile/src/runtime/cloud/tests/deletion.test.ts | Adds initial unit coverage for deletion classification and teardown behavior. |
| apps/mobile/src/runtime/cloud/client.ts | Adds an optional build-time Cloud API origin override while preserving the production default. |
Sequence Diagram
sequenceDiagram
actor User
participant UI as Account settings
participant IdP as Identity provider
participant Cloud as Cloud API
participant Local as Local device state
User->>UI: Confirm account deletion
UI->>IdP: Reauthenticate
IdP-->>UI: Fresh identity proof
UI->>Cloud: DELETE /account
Cloud-->>UI: completed, pending, or rejected
alt completed or pending
UI->>Local: Sign out and remove account-scoped state
UI-->>User: Show deletion outcome
else rejected
UI-->>User: Show failure
end
Reviews (3): Last reviewed commit: "refactor(mobile): rename siwaRevocation ..." | Re-trigger Greptile
A thrown fetch means no response ever arrived; report it as a retryable failure instead of tearing down local state on a guess.
|
Pushed a fix for the transport-failure P1 (7343154): a thrown Recorded as D-23 in the task packet (gitignored, local only). Two things from that review thread are deliberately deferred, not fixed here:
|
Matches the linkcodehq-side rename (D-24): the field is a provider-agnostic deletion-completion status, not something mobile or linkcodehq should name after a specific provider.
Cross-repo context
One-third of CODE-292 (App Store Guideline 5.1.1(v) in-app account deletion). This is the mobile-facing surface: a destructive entry point in Account settings, re-authentication, the single delete request, and local teardown.
Companion PRs: [linkcodehq#51], [auth#20]. Design and the full verification record live in
tasks/CODE-292/in this repo — intentionally untracked (.gitignore'd) so it doesn't ship as product documentation; seetasks/CODE-292/verification.mdfor the full local E2E acceptance record andtasks/CODE-292/scripts/for the reproducible black-box verification scripts.Summary
deleteAccount(): re-authenticates (Apple native re-auth on that branch, a re-run of the existing browser IdP sign-in on the other — mobile has no reliable signal for which central-identity provider a given account actually uses, D-19/D-21), sends oneDELETE /account, and interprets the two independent response dimensions (status,siwaRevocation) into a discriminated outcome.runAccountDeletionTeardown(): local cleanup once the server has accepted deletion (whencompletedandpending— never for a rejected/unreached request) — sign-out, IdP sign-out, device-enrollment clear, and removal of every tunnel-derived host profile (direct/LAN hosts, which aren't account-issued, are left alone).Known gaps (non-blocking)
mobile-release.md05-VR) not yet run.