Skip to content

chore(consumer): drop dead CircuitBreakerController.shouldProbe + fix docs#189

Merged
eschizoid merged 1 commit into
mainfrom
chore/circuit-breaker-doc-and-dead-helper-cleanup
Jun 18, 2026
Merged

chore(consumer): drop dead CircuitBreakerController.shouldProbe + fix docs#189
eschizoid merged 1 commit into
mainfrom
chore/circuit-breaker-doc-and-dead-helper-cleanup

Conversation

@eschizoid

Copy link
Copy Markdown
Owner

Summary

Two-part cleanup surfaced by the CircuitBreaker wiring investigation that ran alongside #186#188:

  1. Delete the stranded CircuitBreakerController.shouldProbe(long, long) helper and its two unit tests. Audit found zero production callers. The Javadoc claimed "a timer asks shouldProbe on each tick" — but no such tick exists in production. The real OPEN → HALF_OPEN transition fires via scheduler.schedule(this::tryHalfOpen, openDuration, …) in ConsumerHealthController.trip(), so the delay itself encodes the threshold (no predicate, no polling).
  2. Rewrite the class Javadoc's OPEN-state description to describe the actual one-shot-scheduler design.
  3. Add a "Circuit breaker" row to the §17 capability table in .claude/CLAUDE.md — the table was missing it entirely, despite the feature being public on both the fluent facade (Stream.withCircuitBreaker(...) / MultiBuilder.withCircuitBreaker(...)) and the explicit Builder (Builder.withCircuitBreaker(CircuitBreakerController)).

Why this is safe

The investigation explicitly verified:

  • shouldProbe callers in production: zero. Test-only callers: 4 assertions across 2 test methods, both in CircuitBreakerControllerTest.
  • recordOutcome callers in production: KPipeConsumer.java:1647 (success path) + KPipeConsumer.java:1765 (failure path). The full circuit-breaker pause path is wired and exercised by KPipeCircuitBreakerIntegrationTest.

This PR only touches the helper, not the wiring.

Test plan

  • ./gradlew :lib:kpipe-consumer:test --tests "*CircuitBreaker*" → BUILD SUCCESSFUL
  • Merge to main
  • KPipeCircuitBreakerIntegrationTest continues to pass on next push

@eschizoid

Copy link
Copy Markdown
Owner Author

@copilot please review

@codecov

codecov Bot commented Jun 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.06%. Comparing base (165b5dc) to head (0e4aaa4).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@             Coverage Diff              @@
##               main     #189      +/-   ##
============================================
- Coverage     77.08%   77.06%   -0.02%     
+ Complexity      752      749       -3     
============================================
  Files            72       72              
  Lines          2858     2856       -2     
  Branches        355      354       -1     
============================================
- Hits           2203     2201       -2     
  Misses          489      489              
  Partials        166      166              

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

`shouldProbe` had zero production callers — the Javadoc advertised "a
timer asks shouldProbe on each tick" but no such tick exists. The real
OPEN → HALF_OPEN transition fires via a one-shot
`scheduler.schedule(this::tryHalfOpen, openDuration, …)` future in
`ConsumerHealthController.trip()`, so the delay itself encodes the
threshold — no predicate, no polling.

Surfaced by the post-#170 dead-code audit. The audit's broader claim
(that the whole circuit-breaker pause path is dead) was a false
positive — `recordOutcome` has two production callsites in
`KPipeConsumer` and the full path is exercised by
`KPipeCircuitBreakerIntegrationTest`. Only this single stranded helper
needed to go.

Changes:
- Delete `CircuitBreakerController.shouldProbe(long, long)`.
- Delete the two unit tests that exclusively exercised it.
- Rewrite the class Javadoc's OPEN-state description to match the
  actual scheduler-based design (and update the test-class Javadoc).
- Add a "Circuit breaker" row to §17 capability table in
  `.claude/CLAUDE.md` — the table was missing it entirely.
@eschizoid eschizoid force-pushed the chore/circuit-breaker-doc-and-dead-helper-cleanup branch from db5e5e8 to 0e4aaa4 Compare June 18, 2026 19:00
@eschizoid eschizoid merged commit 5fad212 into main Jun 18, 2026
4 checks passed
@eschizoid eschizoid deleted the chore/circuit-breaker-doc-and-dead-helper-cleanup branch June 22, 2026 04:02
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.

1 participant