fix: truthful health signal — isHealthy no longer lies during a breaker trip - #292
Merged
Conversation
… breaker together Handle.isHealthy() returned consumer.isRunning(), which is RUNNING || PAUSED - so a tripped circuit breaker (which pauses the consumer) read as HEALTHY during the exact incident the breaker exists for. Meanwhile ConsumerHealthController computed the real signal with zero production callers, and HttpHealthServer was an orphan no example ever started (the demo even documents HEALTH_HTTP_PORT without wiring it). - New HealthSnapshot record (running, paused, pauseSources, circuitBreaker, inFlight) with healthy() = running && breaker != OPEN - the single place the health question is answered - KPipeConsumer.health() builds it from ConsumerHealthController (first production caller for circuitBreakerState/isPaused/currentSources) - Handle.health() added; DefaultHandle.isHealthy() delegates to snapshot.healthy() - Demo app now starts HttpHealthServer from env, suppliers bound to handle.health() - the documented /health endpoint exists for real, and reports breaker state - getPartitionState labeled as a test observation point (audit finding 16) - KPipeCircuitBreakerIntegrationTest extended: during OPEN, snapshot must report running=true, paused=true, source=CIRCUIT_BREAKER, healthy()=false
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #292 +/- ##
============================================
- Coverage 79.26% 79.22% -0.05%
- Complexity 1032 1034 +2
============================================
Files 83 84 +1
Lines 3560 3567 +7
Branches 457 457
============================================
+ Hits 2822 2826 +4
- Misses 546 547 +1
- Partials 192 194 +2 ☔ View full report in Codecov by Harness. |
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.
Architecture-pass P0 item #1 (+#16). Bug:
Handle.isHealthy()=isRunning()=RUNNING || PAUSED— a tripped circuit breaker pauses the consumer, so liveness probes read healthy during the exact incident the breaker exists for. Root cause was three disconnected health pieces: the controller that knows (zero production callers), the handle that answers (wrong source), and the HTTP server that serves (orphaned — the demo documentsHEALTH_HTTP_PORTwithout ever starting it).One seam fixes all three:
HealthSnapshot(running/paused/sources/breaker/in-flight, withhealthy()= running && breaker ≠ OPEN) built byKPipeConsumer.health(), exposed viaHandle.health(), consumed byDefaultHandle.isHealthy()and the demo's now-real/healthendpoint.Test: CB integration test now asserts the snapshot during OPEN (running=true, healthy=false, source named). Also labels
getPartitionStateas the test-observation point it is (finding #16).