What This Library Is

causal-order is a deployable event-ordering runtime for distributed systems that cannot rely on a globally synchronized clock.

What This Library Is

It is designed for situations where events come from multiple services, devices, workers, regions, or replicas, and where ordinary wall-clock timestamps are not enough to tell a trustworthy story. The library's job is to help those systems stay operationally honest without requiring one perfect global time source.

What It Does

At a high level, the library helps a developer:

  • validate event metadata
  • order what can be ordered
  • preserve concurrency only when it can be justified honestly
  • flag anomalies and suspicious records
  • preserve the difference between strong evidence and weak inference
  • run batch and streaming workflows without pretending global clock sync is the truth model

What It Is Not

It is not:

  • a general date-time library
  • a tracing platform
  • a database
  • a queue
  • a generic distributed systems framework

It is also not a promise that every event set can be fully ordered.

That is one of the central ideas of the project: some timelines should not be flattened into a fake single sequence just because a system wants a neat answer.

Why It Exists

Many systems still do something like this:

  1. collect events from different places
  2. sort them by timestamp
  3. treat the result as a reliable timeline

That often produces a clean-looking answer. But in distributed systems, clean-looking answers are often wrong.

causal-order exists to make that uncertainty visible instead of hiding it.

In practice, that means the library focuses on a few specific jobs:

  • bounded and streaming event ordering
  • raw-record translation into the event envelope
  • validation and anomaly visibility
  • confidence-aware outputs that distinguish proof from inference

That work is intentionally kept payload-agnostic and environment-free rather than growing into file parsing, CLI tooling, or transport adapters inside the core package.

So this library is more than a nicer sort function. It is a deployable ordering layer for pipelines that need to survive drift, replay, late sync, and partial causal evidence without falling back to fake global-clock certainty. The event-integrity outcome matters, but it is the result of the runtime doing its job, not a smaller replacement label for what the package has become.