fix: reconcile recurring Action Scheduler actions safely#2895
Conversation
Homeboy Results —
|
|
CI status: Audit and Lint passed. Test failed before running component tests because the Homeboy action dirtied its CI checkout and emitted no structured test result; tracked separately in Extra-Chill/homeboy#7948. No merge while this required check is red. |
…t' into investigate/sqlite-database-bloat
|
Final CI status: Plan, Audit, and Lint passed; Build skipped; Test failed before tests produced results with |
Fixes #2892
Root Cause
Recurring Data Machine actions were scheduled with Action Scheduler uniqueness disabled. Concurrent activation, upgrade, cron, or bootstrap reconciliation could create parallel recurring chains. Later reconciliation cancelled those chains while queue runners held claims, generating repeated
action ignored via Async Requestrows against canceleddatamachine_recurring_*actions.Behavior
action_scheduler_initfor activation and upgrades, and also subscribes to Action Scheduler's nativeaction_scheduler_ensure_recurring_actionsrepair hook.Operational Impact
Existing duplicate pending chains self-heal once into one unique chain. The next reconciliation recreates missing enabled recurrences. The retention task can then remove the 108,439,201 expired Action Scheduler logs observed in #2892 in its existing bounded batches.
The affected table and indexes occupy 19,597,930,496 bytes. Based on the expired-row proportion, cleanup makes approximately 19,349,289,931 bytes (18.02 GiB) reusable. SQLite file size is reclaimed only by a separately approved maintenance compaction after cleanup.
After deployment, an operator should first preview the one-time cleanup:
After reviewing that output, schedule it with:
How To Test
composer install --no-interaction --prefer-dist.php tests/recurring-scheduler-idempotency-smoke.php; confirm all assertions pass, including the concurrent reconciliation case that preserves exactly one unique pending chain without cancellation.php tests/retention-action-scheduler-batching-smoke.php; confirm 38 assertions pass, including expired canceled Data Machine recurrence logs being deleted in bounded batches while recent and non-Data-Machine logs remain.php tests/recurring-scheduler-as-readiness-smoke.php; confirm all readiness assertions pass.composer lint; confirm PHPCS passes.AI assistance