Add DELETE /developers/me for self-service profile deletion - #158
Merged
Conversation
Lets a developer permanently delete their own publisher profile, for the privacy-focused account-deletion flow being added on the extensions site. Refuses (409) while the profile still has published extensions or a pending submission, 404s (developer_not_found) if the caller has no profile, and otherwise deletes any transfer token and claims for it before deleting the profile row itself. developer_history rows are deliberately kept — it's an append-only, moderator-only audit log that's never rendered publicly. Keeping history required a schema change: developer_history.developer_id had a hard FK to developers(id) with no ON DELETE action, and D1 enforces foreign keys, so hard-deleting a developers row with any history (i.e. every developer, since every write logs one) failed outright — confirmed empirically against local D1 before writing the fix. 0009 rebuilds developer_history without that FK (SQLite can't ALTER one away), preserving existing rows and the append-only triggers. Claude-Session: https://claude.ai/code/session_01Co1bu2gU5kEHN65KooNUHN
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
api | 41c5f89 | Commit Preview URL Branch Preview URL |
Jul 26 2026, 07:49 PM |
Contributor
There was a problem hiding this comment.
All reported issues were addressed across 5 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
- P0: deleteOwn() authenticated ownership only in its initial lookup, then deleted by id alone — a transfer/claim landing in between could move the profile to someone else, and the original caller's delete would still go through and remove it out from under the new owner. Fixed by re-checking owner_user_id in the delete's own WHERE clause, atomically, rather than trusting the earlier read. - P1: the extensions/pending-submission counts were checked separately from the delete, so either could appear in between and slip through. Fixed by folding both checks into the same guarded DELETE (via correlated NOT EXISTS subqueries) instead of a separate check-then-act step — there's no window left for anything to appear in. Both guards are repeated identically across all three deletes (transfer tokens, claims, the profile row) so they stay all-or-nothing: if the guard fails, nothing in the batch is touched, rather than transfers/ claims being deleted while the profile deletion itself gets blocked. Verified the guarded SQL directly against local D1 (eligible case deletes correctly; ownership-changed case leaves all three rows untouched) before wiring it into deleteOwn(). Added a regression test simulating the ownership-race window via a new mock-only seam. Claude-Session: https://claude.ai/code/session_01Co1bu2gU5kEHN65KooNUHN
Contributor
There was a problem hiding this comment.
0 issues found across 3 files (changes from recent commits).
Auto-approved: Adds a self-service DELETE endpoint for developer profile deletion, with proper guards against conflicts. Migration drops FK to keep audit history; tests cover success and error paths.
Re-trigger cubic
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
DELETE /extensions/v2/developers/me, letting a developer permanently delete their own publisher profile — part of a privacy-focused account-deletion flow being added on the extensions site.CONFLICT) while the profile still has published extensions or a pending submission; 404s (NOT_FOUND) if the caller has no profile. Error codes match the rest of v2's convention (generic code + a specific message), rather than introducing resource-specific codes.developer_historyrows are deliberately left alone — it's an append-only, moderator-only audit log that's never rendered publicly.