Add data-retention/cleanup jobs — most tables and the SPC image cache grow forever #52
Labels
No labels
area:ai
area:ci-cd
area:notifications
area:observability
area:public-pages
backlog
bug
duplicate
enhancement
help wanted
invalid
question
type:decision
type:feature
type:infra
type:maintenance
type:security
v1.0.1
v1.1.0
v1.2.0
v1.3.0
v2.0.0
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
rbrooks/WeatherBot#52
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Only
sent_forecastsandproduct_freshness_sampleshave delete-basedretention. Growing without bound:
sent_alerts(MCD rows never even clear —expires=None, spc_processor.py:568-577, excluded by the expiry job'sexpires != Nonefilter),nws_alert_snapshots,ai_summary_records+ai_summary_attempts(large JSONB/source-text payloads),spc_outlook_pages/_impact_locations/_risk_transitions(retained_untilonly gates reads),
public_tokens(disabled, never deleted), and thedate-keyed SPC PNG/GIF disk cache (radar.py:284-311 — new files daily, no
pruning).
Scope: (1) set a real
expireson MCD SentAlert rows; (2) prune SPC cachefiles older than N days; (3) a scheduled retention job with per-table,
config-backed windows — deliberately long defaults, chosen with #22 in mind
(the Historical Explorer will consume this history; deleting aggressively now
would gut it). Document the windows in README.
Acceptance criteria:
Filed from the 2026-07-17 codebase audit (
docs/.internal/report-2026-07-17.md), finding F-13.Done in #97 (merged). MCD
SentAlertrows now get a real 6h expiry (they previously hadexpires=Noneand never cleared/pruned). SPC radar cache files are pruned by age (RADAR_CACHE_RETENTION_DAYS, default 7). A new dailyretention_cleanup_jobprunes clearedsent_alerts(90d), AI records/attempts (30d), SPC pages pastretained_until+30d,nws_alert_snapshots(180d), and disabled/revoked public tokens (30d) — each table in its own session/try-except, children before parents. Defaults are deliberately long and config-backed, aligned with the v2.0.0 Historical Explorer (#22) which will consume this history; windows documented in README.