How to Move Fast with Confidence

Zhiwei Li28 May 2025

Problem

More engineers and faster hardware do not let a team ship with confidence. What slows it down is the unpredictable way many services interact. A system's purpose is rarely written down. It becomes clear only after an incident, so teams understand their system ten minutes after an outage instead of during months of development.

Coinbase wanted to state the expected behavior before an incident and get an alert when real events break it. With money flows, an undetected error is expensive.

Example from the article: a P2P BTC send, once started, must complete within 2 hours, and a crypto sale must credit the user with the BTC price times the amount sold, minus commission fees.

Solution in brief

Coinbase describes expected behavior as causality invariants: when event A happens, event B must follow (at time t). O2, a real-time platform, checks these invariants on an event stream and alerts when one is violated. It runs as an Extract, Transform, Check pipeline in memory.

Questions this case answers
  • How to detect violations of expected cause-and-effect behavior across several services in real time, when failures are rare and no labeled anomalies exist
  • How to evaluate time-based invariants over event streams that arrive late and out of order, with deterministic results
  • How to detect unintended product behavior in real time without waiting for an incident or a user complaint?
  • How to write down what a system is supposed to do as a check that runs on production events?

Tools and methods

  • Causality invariants — rules of the form (Cause) Event A → (Effect) Event B at time t, written in an in-house DSL.
  • O2 — event-sourced Extract, Transform, Check pipeline that evaluates the invariants.
  • Logical clocks and watermarks — process events by event time so results do not depend on delays.
  • Redis — state of the stateful rule engine (architecture diagram).
  • Slack, Datadog — alert destinations (architecture diagram).
Continue reading — it's free

Google or a one-time email code. No password.