pub async fn sweep_retention(
pool: &SqlitePool,
days: u32,
now: DateTime<Utc>,
) -> Result<u64>Expand description
Deletes every tune run with started_at at or before the days-day cutoff (see
cutoff_for), along with – via ON DELETE CASCADE – its samples, results, and
write-back audit rows. Returns the number of runs deleted.
Logs at INFO when something was actually deleted (so deletions are never silent, per
history-retention’s design note) and at DEBUG otherwise, so a no-op sweep – the common
case for an install well under its retention window – doesn’t add log noise at the
default level.