I've spent too many nights debugging cascading failures caused by "flapping" circuit breakers in Node.js services. The standard tools (like Opossum) often rely on binary logic: if (error_rate > threshold) open(). This static thresholding creates a ping-pong effect where traffic is trapped in a loop.
I wanted a solution that behaves like a physical damper, not a switch. So I built Atrion.
It is a TypeScript implementation of a Deterministic Physics Engine designed to replace traditional circuit breakers in Node.js/Bun runtimes.
How it differs: Instead of counting errors, Atrion simulates a physical object moving through a medium:
1. Momentum: Errors have mass. A sudden spike is dampened by inertia, filtering out noise naturally. 2. Scar Tissue: The system has "memory." It heals over time (Entropy/Decay) rather than resetting instantly. This prevents the "open/close" flapping cycle. 3. Auto-Routing: Using the calculated "Resistance" (Ohms), it can dynamically shift traffic traffic percentages instead of just cutting it off.
Performance:
1. Benchmarks: Compares standard CB (49 state transitions) vs. Atrion (1 stabilized transition) under oscillating load. 2. Overhead: Zero-dependency, uses branded types for math safety, optimized for V8.
Status: The architecture (CDO - Conditioned Deterministic Orchestration) is language-agnostic, but this reference implementation is Node.js only for now. I’ve included the RFCs in the repo if you're interested in porting the math to Go or Rust.
---
NPM: https://www.npmjs.com/package/atrion Repo: https://github.com/laphilosophia/atrion