What
Add configurable data retention policy with automated event purging.
Why
BMAD CLO finding: Error events accumulate indefinitely by default. Under UU PDP Article 16, retention must be purpose-limited and time-bound. Self-hosted users also need this to prevent unbounded storage growth.
Changes
- Config option:
TRAPFALL_RETENTION_DAYS=30 (default: 30 days, 0 = unlimited)
- Automated purge task: Background task (tokio interval) that runs daily and deletes events older than retention period
- Per-project override: Allow
retention_days column in projects table for per-project customization
- Purge logging: Log purge counts for observability
- Graceful handling: Don't purge events linked to open alert rules (optional, can defer)
- Migration: Add
retention_days column to projects table (nullable, falls back to global config)
Testing
- Unit test: events older than retention → purged
- Unit test: events within retention → preserved
- Unit test: per-project override takes precedence over global config
- Integration test: purge task runs without affecting concurrent queries
What
Add configurable data retention policy with automated event purging.
Why
BMAD CLO finding: Error events accumulate indefinitely by default. Under UU PDP Article 16, retention must be purpose-limited and time-bound. Self-hosted users also need this to prevent unbounded storage growth.
Changes
TRAPFALL_RETENTION_DAYS=30(default: 30 days, 0 = unlimited)retention_dayscolumn inprojectstable for per-project customizationretention_dayscolumn toprojectstable (nullable, falls back to global config)Testing