v0.5.1: automatic Trash purge (cron-less background thread)

Trashed artifacts past a ~3-day retention window are now purged automatically.

- storage.purge_expired_trash(): removes trash older than TRASH_RETENTION
  (all users), tolerant of already-gone rows (concurrent-safe).
- spawn_trash_purge(): runs it on a daemon thread (manages/closes its own DB
  connection), triggered by each delete so it's cron-less and off the request
  thread. Inline fallback when AGENTFEED_ASYNC_PURGE is off (tests).
- Wired into both delete paths (API + session). Manual Empty Trash unchanged.
- Tests: purge removes expired-only; delete triggers the purge. 152 passing;
  live delete verified with the thread enabled (204, server healthy).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
peter 2026-09-07 13:01:12 +01:00
parent 4254164bef
commit 57ad58ff2d
8 changed files with 87 additions and 4 deletions

View file

@ -9,6 +9,16 @@ former name, "Daybook".)
_Nothing yet._
## [0.5.1] — 2026-09-07
### Added
- **Automatic Trash purge.** Trashed artifacts older than a ~3-day retention
window are now permanently removed automatically. It's cron-less: a delete
triggers a sweep that runs on a **background thread** (off the request, so
the click never blocks), tolerant of concurrent runs. Manual "Empty Trash"
still works for immediate reclaim. Controlled by `AGENTFEED_ASYNC_PURGE`
(on by default; tests run it inline).
## [0.5.0] — 2026-09-07
### Added
@ -185,7 +195,8 @@ First tagged release.
- Dockerised (Gunicorn + whitenoise), SQLite, `git`-based deploy with a
runbook (`deploy/cloud_agent_deploy.md`) and health check.
[Unreleased]: https://git.cygnus.systems/peter/daybook/compare/v0.5.0...HEAD
[Unreleased]: https://git.cygnus.systems/peter/daybook/compare/v0.5.1...HEAD
[0.5.1]: https://git.cygnus.systems/peter/daybook/compare/v0.5.0...v0.5.1
[0.5.0]: https://git.cygnus.systems/peter/daybook/compare/v0.4.1...v0.5.0
[0.4.1]: https://git.cygnus.systems/peter/daybook/compare/v0.4.0...v0.4.1
[0.4.0]: https://git.cygnus.systems/peter/daybook/compare/v0.3.2...v0.4.0