Expand description
Historical-data retention — managing the one unbounded-growth table, historical_tasks (one
per-task status snapshot per save-snapshot). The admin screen surfaces the snapshot count + the
oldest snapshot, lets the admin pick a cutoff date, shows a dry-run count of exactly what a
prune would remove, and only then offers a confirmed delete (gated + audited — same safety
pattern as delete_corpus). The run summaries (historical_runs) are never touched, so the
run history and charts survive; only the bulky per-task snapshots age out.
Structs§
- Historical
Stats Dto - Per-task snapshot retention stats, as exposed over the API/UI.
- Prune
Form - The prune form: the cutoff date the preview was shown for.
Functions§
- api_
historical_ stats - The per-task snapshot retention stats (agent twin of the
/admin/retentionscreen). Token- gated.503if the pool is exhausted. - prune
- Prunes per-task snapshots older than the cutoff (
POST /admin/retention/prune). Confirmed by the two-step preview + the form’sconfirm()dialog; gated (AdminSession) and audited (the audit fairing records the action + actor). Onlyhistorical_tasksis touched — run summaries survive. Redirects back to the screen with the count removed; a malformed cutoff is a no-op. - retention_
page - The data-retention screen (
GET /admin/retention?<before>&<pruned>): snapshot stats; with?before=YYYY-MM-DD, a dry-run count of how many snapshots that cutoff would prune (the page then offers a confirmed delete).?pruned=Nflashes the result of a completed prune. Signed-in admins only (unauthenticated → sign-in, returning here). - routes
- The human retention screen + prune (the agent
api_historical_statsread twin is mounted viafrontend::apidoc; there is intentionally no agent mutation twin — see the note above).