@@ -12,10 +12,11 @@ without churning under them. |
| 12 | 12 | |
| 13 | 13 | ## SQL schema |
| 14 | 14 | |
| 15 | | -Actions migrations currently span 0042–0051, 0053, and 0057. Migration |
| 16 | | -0052 belongs to the repo source-remotes feature, 0054 belongs to push |
| 17 | | -event protocol tracking, 0055 belongs to the social feed, and 0056 |
| 18 | | -belongs to user profile contribution settings. |
| 15 | +Actions migrations currently span 0042–0051, 0053, 0057, and 0060. |
| 16 | +Migration 0052 belongs to the repo source-remotes feature, 0054 |
| 17 | +belongs to push event protocol tracking, 0055 belongs to the social |
| 18 | +feed, 0056 belongs to user profile contribution settings, 0058 belongs |
| 19 | +to repo name reuse, and 0059 belongs to GitHub org imports. |
| 19 | 20 | |
| 20 | 21 | | # | Table | Purpose | |
| 21 | 22 | | ----- | --------------------------- | ------------------------------------------------------------- | |
@@ -31,6 +32,7 @@ belongs to user profile contribution settings. |
| 31 | 32 | | 0051 | `workflow_runs.trigger_event_id` | Trigger idempotency for retries/admin replays | |
| 32 | 33 | | 0053 | `runner_jwt_used` | Single-use replay gate for runner job JWTs | |
| 33 | 34 | | 0057 | `workflow_job_secret_masks` | Encrypted claim-time log mask snapshots per job | |
| 35 | +| 0060 | Actions retention indexes | Narrow cleanup indexes for terminal steps/runs | |
| 34 | 36 | |
| 35 | 37 | A few load-bearing choices, called out so they're easy to spot in a |
| 36 | 38 | later schema diff: |
@@ -376,6 +378,43 @@ Other admin surfaces are scoped to later sub-sprints: |
| 376 | 378 | UI re-run completed/cancelled runs. Re-runs read the workflow YAML |
| 377 | 379 | from the original run's `head_sha`, create a fresh queued |
| 378 | 380 | `workflow_runs` row, and set `parent_run_id` to the source run. |
| 381 | +- S41g: `workflow:cleanup` is a daily retention worker enqueued by |
| 382 | + `shithubd-cron.service`. Operators can run it manually with |
| 383 | + `shithubd admin run-job workflow:cleanup`. |
| 384 | + |
| 385 | +## Retention cleanup (S41g) |
| 386 | + |
| 387 | +`workflow:cleanup` applies the durable Actions retention contract in |
| 388 | +this order: |
| 389 | + |
| 390 | +1. Delete hot `workflow_step_log_chunks` for steps completed more than |
| 391 | + 7 days ago. Finalized logs already live in object storage. |
| 392 | +2. Delete expired `workflow_artifacts` rows after deleting their |
| 393 | + `actions/runs/...` blob objects. The row's `expires_at` value is |
| 394 | + authoritative so per-upload retention overrides keep working. |
| 395 | +3. Delete unpinned terminal `workflow_runs` older than 365 days. Child |
| 396 | + jobs, steps, artifacts, and consumed JWT rows cascade through FK |
| 397 | + ownership. |
| 398 | +4. Delete consumed `runner_jwt_used` rows whose JWT expiry is more than |
| 399 | + 30 days old. This preserves replay/audit evidence for recent jobs |
| 400 | + without letting the replay table grow forever. |
| 401 | + |
| 402 | +The defaults can be overridden in the worker payload: |
| 403 | + |
| 404 | +```json |
| 405 | +{"step_log_chunk_days":7,"run_days":365,"jwt_used_days":30,"artifact_batch":1000} |
| 406 | +``` |
| 407 | + |
| 408 | +`artifact_batch` caps each object-delete page and may not exceed 10000. |
| 409 | +Negative values are poison-job errors. The worker exports |
| 410 | +`shithub_actions_runs_pruned_total{kind}` where `kind` is one of |
| 411 | +`chunks`, `blobs`, `runs`, or `jwt_used`. |
| 412 | + |
| 413 | +Production object storage also needs provider-side lifecycle on the |
| 414 | +same prefix: `deploy/spaces/actions-lifecycle.json` expires |
| 415 | +`actions/runs/` objects after 90 days and aborts stale multipart |
| 416 | +uploads after 2 days. Apply it with |
| 417 | +`deploy/cutover/apply-actions-lifecycle.sh`. |
| 379 | 418 | |
| 380 | 419 | ## Trigger pipeline (S41b) |
| 381 | 420 | |