Description
Extend RPC endpoint health handling with a proper breaker and proactive recovery.
Problem Statement
RpcClient currently quarantines an endpoint for a fixed duration after N transport failures — deliberately simple, but it neither backs off progressively for an endpoint failing repeatedly, nor probes carefully before restoring full traffic. Recovery is also only discovered when a user request happens to retry a quarantined endpoint, so the first request after an outage pays the latency cost. Both concerns touch the same health state, which is why they belong in one change.
Proposed Changes
Technical Implementation Scaffolding
- Target Repository: vero-sdk
- Target Path: src/resilience/
- Branch Naming: feat/issue--endpoint-health
- Authority Context: Reliability
Acceptance Criteria
Definition of Done
This issue is self-contained. Everything it needs already exists on main; it does not wait on any other issue. Deliver the module and its tests in one PR.
Description
Extend RPC endpoint health handling with a proper breaker and proactive recovery.
Problem Statement
RpcClientcurrently quarantines an endpoint for a fixed duration after N transport failures — deliberately simple, but it neither backs off progressively for an endpoint failing repeatedly, nor probes carefully before restoring full traffic. Recovery is also only discovered when a user request happens to retry a quarantined endpoint, so the first request after an outage pays the latency cost. Both concerns touch the same health state, which is why they belong in one change.Proposed Changes
src/resilience/circuit-breaker.tswith closed/open/half-open states; in half-open allow a single probe before fully restoring; expose state transitions for loggingsrc/resilience/health-scheduler.tsprobing quarantined endpoints on a configurable interval, withstart()/stop()wherestop()clears every timer — no dangling handles keeping a process aliveRpcClientmust behave exactly as it does today when neither is suppliedTechnical Implementation Scaffolding
Acceptance Criteria
stop()leaves no active timersRpcClientbehaviour is unchanged without opt-innpm test,npm run typecheck,npm run lint, andnpm run buildall passDefinition of Done
This issue is self-contained. Everything it needs already exists on
main; it does not wait on any other issue. Deliver the module and its tests in one PR.