Skip to content

Projects/organizations: permanent (hard) deletion after archive #841

Open

Description

@unjica

Current behaviour (develop @ 0c45ad3)

Organizations and projects can only be archived (soft-deleted); there is no way to permanently delete them or their data from the product.

  • POST /meta/organizations/:orgId/archive and POST /meta/projects/:projectId/archive in apps/api/src/routes/project-dashboard.ts (~L544–600) only set deleted_at = now(), gated by canArchiveOrganization / canArchiveProject.
  • Every read path filters on deleted_at: null, so archived rows (and their events, errors, sessions, API keys, alert rules, etc.) stay in Postgres indefinitely.
  • Dashboard: apps/dashboard/app/dashboard/settings/organization/OrganizationArchiveSection.tsx offers archive only.
  • No purge job for archived orgs/projects exists in apps/api/src.

Seen in practice during the Business Heartbeats prod test (2026-10-20): the test project could be archived but not removed.

Proposal (scope to be refined)

  • Owner-only "Delete permanently" for an already-archived project/org, with typed-name confirmation and an audit log entry.
  • Delete or cascade dependent data (check existing onDelete relations in apps/api/prisma/schema.prisma), revoke all API keys and MCP/agent tokens for the scope first.
  • Optionally: automatic purge of archived orgs/projects after a grace period (e.g. 30 days), restorable until then.
  • Billing: block or handle orgs with an active Stripe subscription.

Data retention / GDPR

Retained archived data may include end-user personal data (user IDs, IPs, emails in events/errors). GDPR Art. 17 (erasure) and storage limitation expect a real deletion path; the privacy policy and DPA should state the archive→deletion timeline. Backups retention should be documented separately.

Not a security bug; normal/low priority backlog item.

Activity

  1. added
    enhancement
    dashboard
    api
    backend
    priority:9
    triage:roadmap
    on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    apibackenddashboardenhancementpriority:9triage:roadmap

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions