Skip to content

Introduce a modular middleware-based execution pipeline#31

Merged
cinar merged 4 commits intomainfrom
issue-29
Mar 22, 2026
Merged

Introduce a modular middleware-based execution pipeline#31
cinar merged 4 commits intomainfrom
issue-29

Conversation

@cinar
Copy link
Copy Markdown
Owner

@cinar cinar commented Mar 21, 2026

Introduce a modular middleware-based execution pipeline that allows users to define a custom order for resilience strategies. This refactoring enables flexible policy composition through the new Policy API while maintaining backward compatibility for the existing opinionated defaults.

Fixes #29
Fixes #28
Fixes #27

Key changes:

  • Implement Policy type with NewPolicy, Do, and DoErr methods.
  • Refactor core execution logic into a middleware/interceptor pattern.
  • Add Bulkhead strategy for concurrency limiting in bulkhead.go.
  • Add WithTimeout option and timeoutMiddleware.
  • Update Config and Option to support dynamic pipeline building.
  • Refactor executeHedged to utilize the modular attempt pipeline.
  • Comprehensive documentation updates in README.md and docs/SPEC.md.
  • New tests for policy composition and ordering in policy_composition_test.go.

…sers to

define a custom order for resilience strategies. This refactoring enables
flexible policy composition through the new Policy API while maintaining
backward compatibility for the existing opinionated defaults.

Key changes:
- Implement Policy type with NewPolicy, Do, and DoErr methods.
- Refactor core execution logic into a middleware/interceptor pattern.
- Add Bulkhead strategy for concurrency limiting in bulkhead.go.
- Add WithTimeout option and timeoutMiddleware.
- Update Config and Option to support dynamic pipeline building.
- Refactor executeHedged to utilize the modular attempt pipeline.
- Comprehensive documentation updates in README.md and docs/SPEC.md.
- New tests for policy composition and ordering in policy_composition_test.go.
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 21, 2026

Codecov Report

❌ Patch coverage is 58.05085% with 99 lines in your changes missing coverage. Please review.
✅ Project coverage is 80.82%. Comparing base (2628104) to head (0d4de15).

Files with missing lines Patch % Lines
retry.go 65.35% 34 Missing and 10 partials ⚠️
options.go 28.57% 25 Missing and 5 partials ⚠️
ratelimit.go 0.00% 21 Missing ⚠️
bulkhead.go 83.33% 2 Missing ⚠️
policy.go 80.00% 2 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##             main      #31       +/-   ##
===========================================
- Coverage   93.27%   80.82%   -12.45%     
===========================================
  Files           9       11        +2     
  Lines         476      652      +176     
===========================================
+ Hits          444      527       +83     
- Misses         23      103       +80     
- Partials        9       22       +13     

☔ 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.

cinar added 3 commits March 21, 2026 16:48
Implement a modular resilience engine with support for custom policy
composition and new defense patterns.

Fixes #29
Fixes #28
Fixes #27

Key changes:
- Policy API: NewPolicy for custom ordering of resilience layers (#29).
- Bulkhead: Semaphore-based concurrency isolation (#27).
- Rate Limiting: Time-based token bucket for request throttling (#28).
- Middleware: Modular pipeline for Retry, CB, Bulkhead, and RateLimit.
- Telemetry: Enhanced Instrumenter for bulkhead and rate-limit events.
- Examples: Added standalone examples for bulkhead and ratelimiter.
- Documentation: Updated README.md and SPEC.md with new patterns.
Implement a modular resilience engine with support for custom policy
composition and new defense patterns.

Key changes:
- Policy API: NewPolicy for custom ordering of resilience layers (#29).
- Bulkhead: Semaphore-based concurrency isolation (#27).
- Rate Limiting: Time-based token bucket for request throttling (#28).
- Middleware: Modular pipeline for Retry, CB, Bulkhead, and RateLimit.
- Telemetry: Enhanced Instrumenter for bulkhead and rate-limit events.
- Examples: Added standalone examples for bulkhead and ratelimiter.
- Documentation: Updated README.md and SPEC.md with new patterns.
- Articles: New deep dives into Bulkhead Isolation and Precise Rate Limiting.
@cinar cinar merged commit 3cae080 into main Mar 22, 2026
4 checks passed
@cinar cinar deleted the issue-29 branch March 22, 2026 17:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Policy Composition & Chaining API Feature: Generic Rate Limiting Policy (Token Bucket) Feature: Bulkhead Pattern for Concurrency Isolation

2 participants