Skip to content

[codex] Add price source circuit breakers#64

Draft
vku2018 wants to merge 1 commit into
SmartDropLabs:mainfrom
vku2018:grantfox-11-price-source-circuit-breakers
Draft

[codex] Add price source circuit breakers#64
vku2018 wants to merge 1 commit into
SmartDropLabs:mainfrom
vku2018:grantfox-11-price-source-circuit-breakers

Conversation

@vku2018

@vku2018 vku2018 commented Jul 4, 2026

Copy link
Copy Markdown

Refs #11

Summary

  • Add a reusable CircuitBreaker utility with closed/open/half-open states, configurable thresholds, cooldown, and INFO-level transition logging.
  • Wrap each price source in priceOracle with an independent breaker so open circuits skip upstream calls and return null immediately.
  • Expose current source circuit states from /health and document the circuit breaker environment defaults.
  • Add focused Jest coverage for state transitions, health output, config defaults, and oracle-level open-circuit skip behavior.

Validation

  • npm ci --ignore-scripts --no-audit
  • npm test -- test/circuitBreaker.test.js test/config.test.js test/health.test.js test/resilience.test.js (20 passing)
  • git diff --check

Full npm test was also attempted. It still fails on unrelated existing suites, including test/webhookSignature.test.js parse failure and pre-existing response-shape expectations in auth/rate-limit/prices/webhook/airdrop/requestId tests.

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.

2 participants