Source of Truth (System of Record)

The single authoritative original data record across an entire system. Even if multiple copies or views exist across nodes, this canonical source always takes precedence whenever discrepancies arise.

General Meaning

In distributed systems and multi-application environments, identical data often exists in multiple locations, such as in-memory caches, search indexes, and local worker workstations. If there is no strict agreement on which data represents the definitive reality, recovering from conflicting updates or contradictory states becomes nearly impossible.

A Source of Truth (also known as a System of Record) designates the single agreed-upon data store or record where canonical mutations must be written. All copies or transformed representations elsewhere are merely derived projections, and any inconsistency is resolved by prioritizing the authoritative source.

Why It Matters

  • Preventing data inconsistency: Designating a single write path and storage location prevents uncoordinated edits across nodes from corrupting canonical records.
  • Serving as the recovery foundation: Even if local working states or presentation caches are corrupted, the system can reliably rebuild and restore the correct state directly from the source of truth.
  • Unifying success and failure criteria: When network partitions or timeouts occur, inspecting whether the mutation committed to the source of truth provides an objective standard to determine operation success.

How the Site Factory Uses It

In the Site Factory, Cloudflare D1 serves as the source of truth for task management (work_items), execution jobs (execution_jobs), and service leases (service_leases). Git repository files like ops/work/tasks.json and task tables in README.md are not sources of truth; they are read-only projections generated for human operators and review tools. Meanwhile, operational rules and architectural decisions treat rules.md and decisions.md in Git as their authoritative source of truth.

The CLI script tools/work.py reads and writes directly to Cloudflare D1 as its canonical store. While operators can inspect local Git projections using python3 tools/work.py list --projection, the tool strictly prevents claiming executable work by rejecting --projection when paired with --ready, ensuring autonomous agents only claim tasks from the authoritative database.

Caveats & Operational Rules

  • Never create alternative sources of truth during outages: When Cloudflare D1 is unreachable, local files must never be promoted to an authoritative write target, as doing so causes split-brain conflicts upon reconnection; workers must pause and wait for recovery.
  • Git is not always the source of truth: While Git is authoritative for source code and ADRs, rapidly mutating task statuses and execution locks belong in D1; boundaries of responsibility must be strictly separated based on data lifecycle.
  • Directly modifying projections will not update the source of truth: Manually editing Markdown tables in README.md or JSON in tasks.json has zero effect on D1; all state updates must go through official CLI commands like tools/work.py.

Related Terms

References

  • Book: Martin Kleppmann, *Designing Data-Intensive Applications*, Chapter 11 (Stream Processing: Systems of Record and Derived Data)

Verified: 2026-11-08