KB-5DCB rev 2

5000x-live — Retention policy dry-run

3 min read Revision 2
iu-core5000x-liveretentiondry-runhygiene-repaired-by-6000x

5000x-live — Retention policy dry-run

Hygiene note (6000x): title/tags renormalised from "5500x" to "5000x-live" to match the path. Content preserved verbatim except this banner.

Verdict: PASS — 3 policies dry-runnable, 0 eligible rows; gate stays inert.

Live policies (iu_core_retention_policy)

target_table age_column keep_days actor_scope reason
dot_iu_command_run created_at 90 runtime_500x_op_proof, iu_core_2400x_full_reindex, iu_core_3000x_runtime_330_smoke, iu_5000x_pilot keep 90d of one-off operator command-run rows for governance; trim only macro/sandbox actors
iu_three_axis_envelope_refresh_log started_at 30 iu_lifecycle_trigger, iu_5000x_pilot keep 30d of lifecycle-trigger fires; older redundant with v_iu_three_axis_envelope_refresh_status
iu_three_axis_envelope_trigger_error_log captured_at 90 null (ALL) keep 90d of trigger exceptions; rare

Dry-run executed this macro

SELECT * FROM fn_iu_core_retention_cleanup('iu_5000x_live_dry_run_probe', true);

target_table cutoff rows_eligible rows_deleted dry_run
dot_iu_command_run 2026-02-22 0 0 true
iu_three_axis_envelope_refresh_log 2026-04-23 0 0 true
iu_three_axis_envelope_trigger_error_log 2026-02-22 0 0 true

All three queries returned 0 eligible rows — corpus is too young (oldest macro iu_core_2400x_full_reindex ran 2026-05-23).

Gate iu_core.retention_enabled — stays false

Flipping the gate now is a no-op (0 rows). Without paired cron, a live gate flip just creates risk of an out-of-band manual fn_iu_core_retention_cleanup(..., false) call deleting data unexpectedly. Gate stays inert.

Reversibility

Gate is a single dot_config row; flip back with one UPDATE dot_config SET value='false' WHERE key='iu_core.retention_enabled';.

Next macro (5700x) — paired enable

  1. Install cron line: 45 3 * * * docker exec postgres psql -U directus -d directus -c "SELECT * FROM fn_iu_core_retention_cleanup('iu_retention_cron', false);" >> /var/log/incomex/iu-core-retention.log 2>&1
  2. Flip gate: UPDATE dot_config SET value='true', updated_at=NOW() WHERE key='iu_core.retention_enabled';
  3. First scheduled run executes at 03:45 UTC the next day.
  4. Capture before/after count(*) of all 3 tables in pre/post snapshot.
Back to Knowledge Hub knowledge/dev/laws/dieu44-trien-khai/v0.6-iu-core-5000x-live-ui-ops-real-corpus-pilot-open-goal/04-retention-dry-run.md