Trash retention sweep: auto-purge entries past their window #77

Closed
opened 2026-07-30 03:32:19 +00:00 by Cordy · 0 comments
Owner

Salvaged from the stale feat/onboarding-settings branch before deleting it (commit 5302948 feat(trash): retention sweep — auto-purge old entries). It is the one idea on that branch with no equivalent on main.

Today (#63) retention is passive: it blocks purging inside the keep window, but nothing ever purges afterwards — trash grows forever until someone empties it by hand. The sweep is the other half: a background janitor that deletes trash entries whose retention window has expired (and, for paths with no retention policy, entries older than a configurable default).

Sketch: ticker in internal/storage/trash (hourly, plus once at startup), walks /.trash/*/, reads each sidecar, purges when deletedAt + max(retentionFor(path), trash.autoPurgeAfter) has passed. Config storage.trash.autoPurgeAfter (empty = never auto-purge, preserving today's behavior). Purges must respect legal holds and emit audit events (#61) so a disappearing file is always explainable.

Wants its own greenlight — auto-deletion is exactly the kind of thing that should be opt-in and deliberate.

Salvaged from the stale `feat/onboarding-settings` branch before deleting it (commit `5302948 feat(trash): retention sweep — auto-purge old entries`). It is the one idea on that branch with no equivalent on main. Today (#63) retention is **passive**: it *blocks* purging inside the keep window, but nothing ever purges afterwards — trash grows forever until someone empties it by hand. The sweep is the other half: a background janitor that deletes trash entries whose retention window has expired (and, for paths with no retention policy, entries older than a configurable default). Sketch: ticker in `internal/storage/trash` (hourly, plus once at startup), walks `/.trash/*/`, reads each sidecar, purges when `deletedAt + max(retentionFor(path), trash.autoPurgeAfter)` has passed. Config `storage.trash.autoPurgeAfter` (empty = never auto-purge, preserving today's behavior). Purges must respect legal holds and emit audit events (#61) so a disappearing file is always explainable. Wants its own greenlight — auto-deletion is exactly the kind of thing that should be opt-in and deliberate.
Cordy closed this issue 2026-07-30 04:05:29 +00:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#77
No description provided.