retention: compose the audit detail in the store with the real body count

RetainWithAudit now takes only the actor; the store builds the detail after
body clearing so bodies_cleared is a real number, and still writes the row
before the cap.
This commit is contained in:
Builder
2026-10-13 10:44:01 +11:00
parent d8788ef8e7
commit 453d8a2dc9
3 changed files with 16 additions and 11 deletions

View File

@@ -346,9 +346,7 @@ func runRetain(cfg *config.Config, logger *slog.Logger) error {
}
// The audit row is written inside the same transaction, before the cap, so
// the cap counts it. This is what keeps actions_log bounded across runs.
detail := fmt.Sprintf("bodies_cleared=%%d retention_days=%d max_rows=%d",
cfg.RetentionDays, cfg.ActionsLogMaxRows)
res, err := st.RetainWithAudit(ctx, policy, "scheduler", detail)
res, err := st.RetainWithAudit(ctx, policy, "scheduler")
if err != nil {
return err
}