Repository navigation
fix(node): debounce health failures and recovery - #950
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
WalkthroughNode health checks now use configurable consecutive failure and recovery thresholds. The job tracks per-node result streaks and assigns shared status transitions and core restarts to the health-check owner. Status writes can require the database status to match the observed status. ChangesNode Health Check Flow
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~45 minutes Change: Bug fix · Severity of issue fixed: Medium Sequence Diagram(s)sequenceDiagram
participant process_node_health_check
participant verify_node_backend_health
participant NodeOperation
participant update_node_status
process_node_health_check->>verify_node_backend_health: Probe node health
verify_node_backend_health-->>process_node_health_check: Return health result
process_node_health_check->>process_node_health_check: Apply configured streak threshold
process_node_health_check->>NodeOperation: Request status update with observed status
NodeOperation->>update_node_status: Apply guarded database update
Suggested reviewers: Merge Risk: ⚪ Minimal · up to No actionable merge-blocking issue was established in the reviewed changes. Normal checks can proceed. Security Architecture Review
Pre-merge checks |
|
|
@coderabbitai review |
✅ Action performedReview finished.
|
8894045 to
8dc37e7
Compare
Add tests for the fail and recover thresholds: probes below the fail threshold keep a node connected, a good probe restarts the failure streak, an errored node needs consecutive good probes, streaks restart for a replaced node object or a changed stored status, followers never write status or repair, a dead core is repaired before the threshold, and thresholds of 1 react to a single probe. List NODE_HEALTH_FAIL_THRESHOLD and NODE_HEALTH_RECOVER_THRESHOLD in .env.example, with the usage polling note for dead nodes.
|
@coderabbitai review |
✅ Action performedReview finished.
|
A single failed probe currently changes node health and can trigger a reconnect, while a single successful probe or automatic reconnect immediately reports recovery. This adds consecutive failure/recovery thresholds so transient errors do not produce false downtime or premature recovery notifications.
NODE_HEALTH_FAIL_THRESHOLD=3andNODE_HEALTH_RECOVER_THRESHOLD=2, validated as positive integers. Setting both to1restores single-probe transitions.Validation: 134 passing tests on Python 3.14 with node-bridge 0.9.2: 58 existing node/leader/database tests, 33 local threshold/configuration/race checks, 2 real-NATS integration tests (including four Python processes), and 41 node API tests. Ruff and
git diff --checkpass. The PR contains only four production Python files; local validation files are excluded.Existing test limitation:
test_health_poll_recovers_claim_that_expires_after_startuptimes out at line 291 while awaiting the bridge's idle sync worker, before invoking the health checker. The same failure was reproduced with the unchangedorigin/devhealth checker and node-bridge 0.9.2.Closes #620.
Summary by CodeRabbit