feat(09-01): implement retention cleanup service with configurable retention period

- Add CONFIG_RETENTION_DAYS setting (default 90) to config.py
- Create retention_service.py with cleanup_expired_snapshots (parameterized SQL via make_interval)
- APScheduler IntervalTrigger runs cleanup every 24h with 1h jitter
- Prometheus counter and histogram for observability
- CASCADE FKs handle diff/change deletion automatically
- All 4 unit tests pass

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Jason Staack
2026-03-12 23:33:27 -05:00
parent 00bdde9975
commit a9f7a45a9b
2 changed files with 88 additions and 0 deletions

View File

@@ -125,6 +125,9 @@ class Settings(BaseSettings):
PASSWORD_RESET_TOKEN_EXPIRE_MINUTES: int = 30
APP_BASE_URL: str = "http://localhost:3000"
# Retention cleanup — delete config snapshots older than N days
CONFIG_RETENTION_DAYS: int = 90
# App settings
APP_NAME: str = "TOD - The Other Dude"
APP_VERSION: str = "0.1.0"