feat: add trip() to force breaker into open state#2
Conversation
Greptile SummaryThis PR adds a single Confidence Score: 5/5Safe to merge; no logic or data-correctness bugs found in the implementation. All findings are P2 (test coverage gaps). The production code correctly delegates to existing, well-tested internals with no new edge cases introduced. tests/unit/CircuitBreakerTest.php — minor gaps in telemetry assertions for the two new test methods. Important Files Changed
Reviews (3): Last reviewed commit: "feat: add trip() to force breaker into o..." | Re-trigger Greptile |
0757603 to
35e0417
Compare
35e0417 to
961e516
Compare
Useful for tests that need to exercise breaker-open behaviour without driving N failures through call(), and for operational manual breaks (e.g. an admin endpoint disabling a backend). Idempotent: calling on an already-open breaker refreshes openedAt without recording a transition.
961e516 to
976f722
Compare
Summary
Adds a single
trip()method toCircuitBreakerthat forces the breaker into the OPEN state, syncing through any configured cache adapter and recording state telemetry.Why
call()to flip state.trip()is the obvious shortcut.call().Behaviour
trip()on an already-open breaker refreshesopenedAtwithout re-recording a transition.Adapteris configured (state, openedAt persisted).breaker.transitionscounter and updates state gauges astransitionToOpen()does internally.Test plan