Skip to content

Conversation

@tomas-zijdemans
Copy link
Contributor

@tomas-zijdemans tomas-zijdemans commented Jan 12, 2026

  • Simplified API: removed isAvailable, failureCount, getStats
  • Added onHalfOpen callback for complete state observability
  • Added signal option in execute() for AbortSignal support
  • Changed validation errors from TypeError to RangeError (aligns with stable @std/async)
  • Improved timestamp consistency
  • Improved typing
  • Updated docs and tests

Add optional AbortSignal to CircuitBreaker.execute() for pre-flight
abort checking. This enables timeout and graceful shutdown scenarios
when composing with other async primitives like retry().

- Add CircuitBreakerExecuteOptions interface with signal property
- Check signal.throwIfAborted() before executing the function
- Aborts do not count as circuit failures
- Update JSDoc examples to show realistic usage patterns
@codecov
Copy link

codecov bot commented Jan 12, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.07%. Comparing base (29d1698) to head (32d949e).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6951      +/-   ##
==========================================
- Coverage   94.27%   94.07%   -0.21%     
==========================================
  Files         584      600      +16     
  Lines       43169    43516     +347     
  Branches     6922     6984      +62     
==========================================
+ Hits        40697    40936     +239     
- Misses       2419     2526     +107     
- Partials       53       54       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@tomas-zijdemans tomas-zijdemans changed the title feat(async/unstable): enhance CircuitBreaker with AbortSignal, onHalfOpen, and align error types feat(async/unstable): enhance CircuitBreaker with AbortSignal and onHalfOpen callback Jan 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant