Skip to content

Tasks: Database cleanup for soft-deleted task snapshots #1283

Closed
coder/coder
#21949

Description

@mafredri

Repo: coder/coder

Scope: Add automatic cleanup of task snapshots when tasks are soft-deleted.

Changes:

  • Add query to delete task snapshots for soft-deleted tasks
  • Integrate cleanup into dbpurge daemon with logging and metrics
  • Add authorization for delete operation
  • Make the task soft-delete query also remove data from the task_snapshots table

Files:

  • coderd/database/queries/tasks.sql
  • coderd/database/dbpurge/dbpurge.go
  • coderd/database/dbpurge/dbpurge_test.go
  • coderd/database/dbauthz/dbauthz.go

Acceptance criteria:

  • Snapshots for soft-deleted tasks are removed on next purge iteration
  • Snapshots for the task are deleted when a task is deleted
  • Snapshots for active tasks are preserved
  • Tests verify cleanup behavior and authorization

Dependencies:

References:

  • PRD: Start/Pause/Resume the Task Workspace
  • RFC: Tasks: Start/Pause/Resume Lifecycle
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions