fix(puppetdb): reset circuit breaker failures on success while closed - #62
Merged
alvagante merged 1 commit intoSep 24, 2026
Merged
Conversation
LifetimeCount accumulated for the process lifetime while closed, so sparse failures on long-running instances tripped the breaker even when PuppetDB was healthy. Clear the streak on success, and log grouping query errors. Closes #59 Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
Remaining feedback is limited to non-blocking test coverage nits.
Review effort: Lite
Findings: None
What changed in this PR
Fixes PuppetDB circuit-breaker failure streak handling and improves grouping-query error diagnostics.
Changes:
- Reset closed-state failures after successful requests.
- Log underlying grouping-query errors.
- Add circuit-breaker unit tests.
| File | Summary |
|---|---|
backend/test/unit/integrations/CircuitBreaker.test.ts |
Tests failure thresholds, reset behavior, and open rejection. |
backend/src/integrations/puppetdb/PuppetDBService.ts |
Logs grouping-query error details. |
backend/src/integrations/puppetdb/CircuitBreaker.ts |
Clears consecutive failures after success. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
alvagante
deleted the
alvagante/circuitbreaker-failurecount-never-resets-during
branch
September 24, 2026 17:08
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.
Summary
failureCounton success while the circuit is closed so only consecutive failures trip the breaker (fixes spurious trips on long-running instances).Closes #59
Test plan
cd backend && npx vitest run test/unit/integrations/CircuitBreaker.test.tserror.messagein the warn logMade with Cursor