Skip to content

Hard-delete projects, states, labels and assets after the retention window (follow-up to #59) #348

Open

Description

@aRustyDev

Context

#59 (the daily hard delete, F-D10, D-001) deletes, at 00:00 UTC, work items that were deleted for longer than THRUST_HARD_DELETE_AFTER_DAYS (30) with their join rows, history and attachment blobs, and dispatched outbox rows older than THRUST_OUTBOX_RETENTION_DAYS (90). It was scoped to those two by the owner on 2026-11-18 (the plan for #59, and ADR-0043's issue #59 update).

projects, states, labels and assets also carry deleted_at and nothing ever deletes them for good, so they keep growing the way work items did before #59.

What is known

  • Every foreign key in the schema is NO ACTION, so a row cannot be deleted while another row names it: the order is children first, and a parent waits for its children (as a work item waits for a child that is not old, in feat(jobs): daily hard-delete retention cleanup (F-D10, 30-day default per D-001) #59).
  • project_sequences is never touched by the work-item purge (ADR-0043 B1: a purged number is not handed out again). A purged project is a different case.
  • Attachments are blobs under <workspace>/<project>/<work item>/, deleted before the row they belong to (run_retention).
  • The job is run_retention (crates/core/usecases/src/retention.rs), the schedule is in crates/core/usecases/src/schedules.rs, and the database half is purgeable_* / purge_* on Database (crates/core/ports/src/lib.rs), memory and Postgres.

To decide (these are questions, not decisions)

  1. The rule per table. The same strict deleted_at < now - window as for work items, with one window, or one per table?
  2. A deleted label or state that something live still names. A work_item_labels row or a work item's state_id would block the delete. Delete the join rows with the label (and what happens to a work item whose state was deleted), or wait until nothing names it, as a parent waits for a child?
  3. A purged project. What goes with it: its members, states, labels, work items (all of them, deleted or not?), attachments (the blobs under <workspace>/<project>/), and its project_sequences row. Is the counter deleted with the project (a project id is not reused), or kept?
  4. Identifiers. Does a purged project's identifier (and a label's or state's name) become free to use again? What the unique indexes say today decides this; check before choosing.
  5. Assets. An asset's blob goes before its row, as an attachment's does; which other rows name an asset?

Acceptance

  • The shape of feat(jobs): daily hard-delete retention cleanup (F-D10, 30-day default per D-001) #59's tests for each table: a use-case matrix of 31 days, 30 days + 1 s, 30 days and 29 days in both tenants, a property over any window and deletion ages, the adapters' own rule tests (memory and Postgres), the contract test in the sweeper pass on all four targets, and a mutation control per rule in scripts/mutants.sh.
  • Any deviation from Plane recorded in DEVIATIONS.md, as D-043 was.
  • docs/src/testing/status.md G-50's "not purged" item closed.

Not in scope

API logs, email logs and webhook logs: F-D10 names them, and there are no such tables yet.

Activity

  1. added
    area:app
    on Nov 23, 2026
  2. added a commit that references this issue on Nov 23, 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

    area:app

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions