clipwright/cloud
juancarlos.cavero 1d9fef7445 feat(cloud): self-service account deletion (GDPR art. 17)
The privacy policy already told users that "deleting your account from the
dashboard removes your content" — there was no way to do it. This adds one:
Account -> Delete account in the dashboard, DELETE /api/account on the server.

The endpoint refuses API-key auth (a leaked osk_ must not destroy the account
it was issued from) and requires the caller to retype the account email; the UI
does the same, collapsed behind a danger zone that itemises what actually goes.
Erasure is immediate and irreversible, because after it there is nothing left
to authenticate a recovery request against.

The order of the steps is the design, each one a failure mode:

- Stripe cancel first, aborting everything if it fails, so we never erase a
  user we are still billing. An InvalidRequestError is treated as already
  cancelled: a portal cancellation whose webhook never landed leaves our row
  reading "active" forever, and the one account that could not be deleted
  would be the one Stripe already stopped charging.
- R2 before the database, because those rows are the only index of which
  objects belong to the user; dropping them first turns a failed purge into
  permanent orphans.
- The DB delete is one transaction over an explicit table list, not the
  declared ON DELETE CASCADEs: create_all never ALTERs an existing table, so a
  constraint added after a table shipped lives in the models and not in
  production. tests/test_account_erasure.py fails if a new table references
  users.id without joining that list.
- A reserved usage_ledger row blocks the delete: erasing under a running job
  would pull the output from beneath it and leave the reservation unsettled.

What survives, and why: the Stripe customer and its invoices (six years,
Spanish commercial law) and one account_deletions row holding a sha256 of the
email as proof the erasure happened, itself purged after five years by the
retention sweeper. app.py registers a callback so the working files in output/
and uploads/ go too instead of waiting for the hourly sweep.

Privacy policy sections 6 (EN + ES) now point at the button and name both
survivors; the Legal hub summary says the same in one line.
2026-08-24 19:12:05 +02:00
..
__init__.py feat(cloud): self-service account deletion (GDPR art. 17) 2026-08-24 19:12:05 +02:00
account.py feat(cloud): self-service account deletion (GDPR art. 17) 2026-08-24 19:12:05 +02:00
alerts.py fix: reject too-short sources at submit and stop alerts blaming recovered downloads 2026-08-20 22:54:51 +02:00
analytics.py feat(analytics): report job outcomes to OpenPanel, with the user's job index 2026-07-28 21:49:40 +02:00
api_keys.py feat(agents): the pipeline as a platform — API keys, MCP server, webhooks 2026-08-03 22:33:16 +02:00
auth.py fix(auth): harden MX verification after code review 2026-08-13 10:07:20 +02:00
billing.py fix(billing): stop stranding customers whose payment failed 2026-07-25 15:14:15 +02:00
config.py feat(cloud): self-service account deletion (GDPR art. 17) 2026-08-24 19:12:05 +02:00
database.py feat: add hosted paid mode (managed keys, Stripe trial, metering) 2026-07-14 13:04:43 +02:00
digest.py fix(digest): harden daily digest after code review 2026-08-18 14:53:31 +02:00
disposable_domains.txt feat(auth): verify email domain MX before sending magic links 2026-08-13 01:03:05 +02:00
disposable_mx.txt fix(auth): harden MX verification after code review 2026-08-13 10:07:20 +02:00
email_policy.py fix(auth): harden MX verification after code review 2026-08-13 10:07:20 +02:00
emails.py feat(cloud): self-service account deletion (GDPR art. 17) 2026-08-24 19:12:05 +02:00
LICENSE fix(cloud): harden paid-mode surface + source-available license for cloud/ 2026-07-16 17:30:12 +02:00
managed_keys.py feat: add hosted paid mode (managed keys, Stripe trial, metering) 2026-07-14 13:04:43 +02:00
metering.py fix(proxy): probe the duration over the static pool, not the per-GB proxy 2026-08-21 22:45:53 +02:00
models.py feat(cloud): self-service account deletion (GDPR art. 17) 2026-08-24 19:12:05 +02:00
oauth.py feat(abuse): abrir free a email normal + bloquear dominios desechables 2026-07-21 00:45:54 +02:00
social_profiles.py feat(social): keep scheduling calendar + add Content calendar button in dashboard 2026-07-16 19:26:51 +02:00
storage.py feat(delivery): serve clips from a custom R2 domain, and show download progress 2026-08-23 13:49:08 +02:00
videos.py feat(cloud): self-service account deletion (GDPR art. 17) 2026-08-24 19:12:05 +02:00