Skip to content

adding player delete feature - #39

Merged
automoto merged 1 commit into
mainfrom
player-delete
Aug 11, 2026
Merged

adding player delete feature#39
automoto merged 1 commit into
mainfrom
player-delete

Conversation

@automoto

Copy link
Copy Markdown
Owner

Adding disable then delete after grace period feature.

@greptile-apps

greptile-apps Bot commented Aug 11, 2026

Copy link
Copy Markdown

Greptile Summary

The PR adds per-project player deletion with a configurable grace period, cancellation paths, and an hourly permanent-purge job.

  • Adds authenticated API, player-account portal, and control-panel request/cancel flows.
  • Disables affected players and revokes their sessions when deletion is requested.
  • Adds tenant-scoped, transactional purging with cascade cleanup, audit retention, and quota-counter release.
  • Extends configuration, migrations, generated queries, OpenAPI documentation, templates, and integration coverage.

Confidence Score: 5/5

The PR appears safe to merge, with no concrete blocking or independently actionable non-blocking defects identified.

Deletion requests, cancellation races, authorization boundaries, grace-period configuration, transactional purging, cascade cleanup, audit retention, and quota release are consistently guarded and covered by focused tests.

Important Files Changed

Filename Overview
db/migrations/0043_player_delete_request.up.sql Adds deletion-request state, a purge index, audit actor nullification on player deletion, and portal-visible deletion status.
internal/httpapi/auth_account.go Adds authenticated deletion requests and credential-based cancellation with project scoping and password reauthentication.
internal/players/account.go Adds account-portal request and cancellation flows scoped to players linked to the active global account.
internal/controlpanel/players.go Adds administrator request/cancel handlers with tenant, project, and player scoping.
internal/jobs/player_delete_purge.go Implements tenant-scoped transactional batches that lock due requests, clean non-cascading signals, hard-delete players, audit purges, and release quota slots.
internal/db/queries/player_delete.sql Defines account-scoped request/cancel operations and locked tenant-scoped purge queries.
internal/db/queries/auth.sql Adds self-service request and cancellation queries while preserving pre-existing suspensions.
cmd/ggscale-server/main.go Wires the validated grace period into all deletion surfaces and registers the purge worker.

Sequence Diagram

sequenceDiagram
    actor Player
    participant API as API / Portal / Control Panel
    participant DB as PostgreSQL
    participant Job as Hourly Purge Job

    Player->>API: Request project-player deletion
    API->>DB: Set delete_requested_at and disabled_at
    API->>DB: Increment session_epoch and revoke sessions
    DB-->>API: Deletion timestamp
    API-->>Player: Scheduled purge time

    alt Cancellation before cutoff
        Player->>API: Cancel deletion
        API->>DB: Lock/update pending player row
        DB->>DB: Clear request and request-owned disable
        API-->>Player: Deletion cancelled
    else Grace period elapsed
        Job->>DB: Select due rows FOR UPDATE
        Job->>DB: Delete signals and player rows
        DB->>DB: Cascade project data and preserve audits
        Job->>DB: Release quota slots
    end
Loading

Reviews (1): Last reviewed commit: "adding player delete feature" | Re-trigger Greptile

@automoto
automoto merged commit 3aa1d08 into main Aug 11, 2026
3 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