Effect Circuit Breaker and Retry Budget
Resilience primitives that stop a wobbling dependency from becoming a self-inflicted outage. The retry budget is an atomic token bucket over a Ref: traffic funds tokens, each retry spends one, and an empty bucket rewrites the failure into a non-retryable error, so retries can never exceed a fixed percentage of live traffic no matter how many callers are failing at once. Backoff is Schedule.jittered over Schedule.exponential so a synchronized retry wave desynchronizes. The circuit breaker is a Ref state machine (closed, open, half-open) keyed on the Clock that admits exactly one half-open probe before deciding to close or re-open, and a per-dependency Semaphore bulkhead fails fast so one slow dependency cannot exhaust the shared fiber pool. Every call carries an Effect.timeout. Solves retry storms and cascading failures. Pinned to effect 4.0.0-beta.98.
npx shadcn@latest add https://ui.aryank.space/r/effect-circuit-breaker-budget.jsonInstalls from ui.aryank.space. To add it by hand, copy the files in Files below, or register the @compronents namespace via the docs.
The dependency wobbles and every caller retries in lockstep: each failure spawns another attempt, the attempts multiply the load, and the dependency that needed breathing room gets hammered until it stops answering entirely. The retries caused the outage.