fix(deployments): retire inactive-version side effects by row with bounded outbox continuation

Merged
IC
2mo ago
+874-176

Summary

  • Post-activation cleanup of inactive deployment versions walked every version of the workflow with a dozen round trips each and only checkpointed after a full pass, so a workflow with hundreds of versions hit the 90s outbox handler timeout on every attempt, restarted from zero, and dead-lettered while holding the deploy request the whole time
  • Cleanup is now keyed by side-effect rows: one fenced statement deletes stale schedules, and stale webhooks drain in bounded batches of 20; the prepare handler yields a continuation while rows remain instead of timing out
  • Add continueOutboxHandler to the outbox service (defer without consuming an attempt) and use it at the existing bounded-continuation call sites
  • Legacy inactive/undeployed cleanup handlers honor the abort signal, so a timed-out attempt stops instead of running past its lease
  • Undeploy cleanup no longer walks the payload's version list; the field stays optional for one release of rolling compatibility
  • getProtectedDeploymentVersionId is the single query for the candidate version an in-flight operation is preparing; the boolean helper wraps it

Type of Change

  • Bug fix

Testing

  • bun run type-check, bun run lint, block-registry audit, and check:audits (45 audits) pass
  • Unit tests cover the continuation result, the fenced schedule delete, bounded webhook batches, the protected candidate version, and abort handling; the 21 dependent suites pass unchanged

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)