PRO

Cloudflare Workflow Saga Rollback

A Cloudflare Workflow that compensates instead of unwinding by hand. Each side-effecting step.do registers a WorkflowStepRollbackOptions handler with its own rollbackConfig retry budget, so a terminal failure refunds the charge and revokes the seats in reverse step-start order. Includes a dynamic retries.delay function that reads the provider's Retry-After out of the error, NonRetryableError fail-fast on 402/409, sensitive step output, cron-versus-user detection through WorkflowEvent.schedule, and a control-plane Worker doing terminate({ rollback: true }) and restart({ from }).

Install
npx shadcn@latest add https://ui.aryank.space/r/cloudflare-workflow-saga-rollback.json

Installs from ui.aryank.space. To add it by hand, copy the files in Files below, or register the @compronents namespace via the docs.

Visualization
outcome
charge
ProvisionSubscription
reserve seats
unknown
confirm
unknown
await step.do("capture payment", capture, { rollback }); await step.do("grant seats", grant)

The happy path never touches the compensations: charge, reserve, and confirm each complete, and the registered rollback handlers simply expire with the workflow.

Files

Dependencies
@cloudflare/[email protected]