Skip to content

Add archived account deletion with DeleteMe API and UI - #75

Merged
legokichi merged 4 commits into
mainfrom
codex/account-delete-archive
Jun 11, 2026
Merged

Add archived account deletion with DeleteMe API and UI#75
legokichi merged 4 commits into
mainfrom
codex/account-delete-archive

Conversation

@legokichi

Copy link
Copy Markdown
Member

Summary

  • Add deleted_* archive tables and move user-related data there on account deletion instead of hard-deleting it
  • Expose DeleteMe through the service layer and /api/delete_me server fn
  • Add self-service account deletion UI on / and /login with CSRF protection, nickname confirmation, and an explicit acknowledgement checkbox
  • Log the user out and invalidate the session after deletion; the same OAuth identity can register a new account afterward

Test plan

  • make test
  • make clippy
  • Log in as a normal user, confirm delete preview counts, delete account, and verify redirect to /
  • Log in again with the same OAuth provider and confirm a new user_id is created
  • Confirm admin accounts see the disabled delete message and cannot delete via DeleteMe

@github-actions

Copy link
Copy Markdown

Terraform Plan Results

Terraform Plan Output

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # google_cloud_run_service.litestream_sandbox will be updated in-place
  ~ resource "google_cloud_run_service" "litestream_sandbox" {
        id                         = "locations/asia-northeast1/namespaces/duxca-298210/services/litestream-sandbox"
        name                       = "litestream-sandbox"
        # (4 unchanged attributes hidden)

      ~ template {
          ~ metadata {
              ~ annotations      = {
                  + "autoscaling.knative.dev/minScale"         = "0"
                  - "run.googleapis.com/client-name"           = "gcloud" -> null
                  - "run.googleapis.com/client-version"        = "571.0.0" -> null
                  + "run.googleapis.com/cpu-boost"             = "false"
                  - "run.googleapis.com/startup-cpu-boost"     = "false" -> null
                    # (3 unchanged elements hidden)
                }
                name             = null
                # (6 unchanged attributes hidden)
            }
          ~ spec {
              ~ timeout_seconds       = 3 -> 60
                # (4 unchanged attributes hidden)

                # (1 unchanged block hidden)
            }
        }

        # (2 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Pusher: @legokichi, Action: pull_request

Move deleted user data into deleted_* tables instead of hard-deleting
it, clear active OAuth identities so the same provider can register a
new account, and expose self-service deletion from the home and login
pages with CSRF protection and confirmation checks.
@legokichi
legokichi force-pushed the codex/account-delete-archive branch from df5913b to 23fcd80 Compare June 11, 2026 20:10
@github-actions

Copy link
Copy Markdown

Terraform Plan Results

Terraform Plan Output

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # google_cloud_run_service.litestream_sandbox will be updated in-place
  ~ resource "google_cloud_run_service" "litestream_sandbox" {
        id                         = "locations/asia-northeast1/namespaces/duxca-298210/services/litestream-sandbox"
        name                       = "litestream-sandbox"
        # (4 unchanged attributes hidden)

      ~ template {
          ~ metadata {
              ~ annotations      = {
                  + "autoscaling.knative.dev/minScale"         = "0"
                  - "run.googleapis.com/client-name"           = "gcloud" -> null
                  - "run.googleapis.com/client-version"        = "571.0.0" -> null
                  + "run.googleapis.com/cpu-boost"             = "false"
                  - "run.googleapis.com/startup-cpu-boost"     = "false" -> null
                    # (3 unchanged elements hidden)
                }
                name             = null
                # (6 unchanged attributes hidden)
            }
          ~ spec {
              ~ timeout_seconds       = 3 -> 60
                # (4 unchanged attributes hidden)

                # (1 unchanged block hidden)
            }
        }

        # (2 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Pusher: @legokichi, Action: pull_request

Remove POST /account/delete and route deletion through /api/delete_me
with nickname and confirmation validation in the service layer. The
static account page now calls the server fn via fetch and then logs out.
@github-actions

Copy link
Copy Markdown

Terraform Plan Results

Terraform Plan Output

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # google_cloud_run_service.litestream_sandbox will be updated in-place
  ~ resource "google_cloud_run_service" "litestream_sandbox" {
        id                         = "locations/asia-northeast1/namespaces/duxca-298210/services/litestream-sandbox"
        name                       = "litestream-sandbox"
        # (4 unchanged attributes hidden)

      ~ template {
          ~ metadata {
              ~ annotations      = {
                  + "autoscaling.knative.dev/minScale"         = "0"
                  - "run.googleapis.com/client-name"           = "gcloud" -> null
                  - "run.googleapis.com/client-version"        = "571.0.0" -> null
                  + "run.googleapis.com/cpu-boost"             = "false"
                  - "run.googleapis.com/startup-cpu-boost"     = "false" -> null
                    # (3 unchanged elements hidden)
                }
                name             = null
                # (6 unchanged attributes hidden)
            }
          ~ spec {
              ~ timeout_seconds       = 3 -> 60
                # (4 unchanged attributes hidden)

                # (1 unchanged block hidden)
            }
        }

        # (2 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Pusher: @legokichi, Action: pull_request

Use Leptos islands on / and /login so AccountDeleteForm runs in WASM
via ServerAction<DeleteMe> instead of inline fetch JavaScript. Static
pages load HydrationScripts in islands mode; /app keeps full hydration.
@github-actions

Copy link
Copy Markdown

Terraform Plan Results

Terraform Plan Output

Terraform used the selected providers to generate the following execution
plan. Resource actions are indicated with the following symbols:
  ~ update in-place

Terraform will perform the following actions:

  # google_cloud_run_service.litestream_sandbox will be updated in-place
  ~ resource "google_cloud_run_service" "litestream_sandbox" {
        id                         = "locations/asia-northeast1/namespaces/duxca-298210/services/litestream-sandbox"
        name                       = "litestream-sandbox"
        # (4 unchanged attributes hidden)

      ~ template {
          ~ metadata {
              ~ annotations      = {
                  + "autoscaling.knative.dev/minScale"         = "0"
                  - "run.googleapis.com/client-name"           = "gcloud" -> null
                  - "run.googleapis.com/client-version"        = "571.0.0" -> null
                  + "run.googleapis.com/cpu-boost"             = "false"
                  - "run.googleapis.com/startup-cpu-boost"     = "false" -> null
                    # (3 unchanged elements hidden)
                }
                name             = null
                # (6 unchanged attributes hidden)
            }
          ~ spec {
              ~ timeout_seconds       = 3 -> 60
                # (4 unchanged attributes hidden)

                # (1 unchanged block hidden)
            }
        }

        # (2 unchanged blocks hidden)
    }

Plan: 0 to add, 1 to change, 0 to destroy.

Pusher: @legokichi, Action: pull_request

@legokichi
legokichi merged commit f7e7fdd into main Jun 11, 2026
6 of 7 checks passed
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