Repository navigation
Run a pipeline under a rasuvaeff/context budget; release 0.3.0 - #12
Merged
Merged
Conversation
CompiledPipeline::call() takes an optional context: checked before anything starts, retry runs withContext(), a ContextAwareBulkhead caps its slot wait by the budget, and the callback receives the context only when one is given (an extra argument would break internal-function callbacks). The fallback is skipped only when this call's context is cancelled. ContextOutcome::ignoring() wraps a breaker classifier so a context exception is never a failure: the pipeline cannot change the breaker's isFailure, and a context exception must never become a success (a half-open probe out of the caller's budget would close the circuit). Requires bulkhead ^1.4 and context ^0.3; infection ^0.35; CI gains the experimental PHP 8.6 job. Fixes #11
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configuration
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
prefer-lowest installed retry 1.3, which has no Retry::withContext(); 1.6.2 is the first retry that both has it and installs next to context 0.3.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #11
Summary
CompiledPipeline::call(callable $callback, ?callable $fallback = null, ?Context $context = null):assertActive()— a terminated context runs nothingwithContext()per call (Retry is immutable — the compiled pipeline stays reusable)ContextAwareBulkhead(bulkhead 1.4.0) waits ≤ budget, ends with the context's exceptionfallbackisFailure. A context terminated before the call never reaches the breaker; one terminating mid-call does. NewContextOutcome::ignoring(callable $isFailure)returnsfalsefor anyContextException(which extendsRuntimeException, so broad classifiers count it). The pipeline never turns a context exception into a success — a half-open probe out of the caller's budget would close the circuit.Rejection::is()staysfalsefor context exceptions;onRejectednever maps them.rasuvaeff/bulkhead^1.4,rasuvaeff/context^0.3;infection/infection→^0.35(lazy rule).0.3.0 — 2026-10-15.Verification
composer build, rector green;release-check: no BC break vs v0.2.1; mutation MSI 100% (gate 96). Tests: callback argument only with a context, terminated context runs nothing, fallback for cancelled-this / expired / no-context / inner-context cancellation, retry stopped by the budget (3 attempts in 250 ms with 100 ms backoff), bulkhead wait capped (120 ms slept,Rejection::isfalse,onRejectednot applied), plainBulkheadstub still works, no breaker outcome for a terminated context in either order,ContextOutcome.