Derived Data and Projection

A read-only view computed and transformed from the authoritative source of truth. Even if corrupted or out of sync, it can always be completely reconstructed from scratch as long as the source of truth exists.

General Meaning

In modern architectures, system data is typically divided into authoritative source data written directly by processes, and derived data produced through transformation, aggregation, or indexing. In patterns such as Command Query Responsibility Segregation (CQRS) and event sourcing, transforming write-optimized models into read-optimized formats is known as projection.

A projected view acts strictly as a read-only representation without autonomous authority. Because projections possess no canonical authority of their own, any corruption, desynchronization, or format evolution can be resolved safely by replaying or recalculating the historical log from the source of truth.

Why It Matters

  • Optimizing read performance: Data can be structured into tailored query representations, static HTML, or index caches without being constrained by normalized relational schemas.
  • Reducing load on canonical datastores: Offloading high-frequency read traffic and heavy aggregations to static projections shields the primary database from throughput bottlenecks.
  • Enabling non-destructive schema changes: When display requirements or calculation logic change, developers can safely rebuild projections by re-reading the unaltered source of truth.

How the Site Factory Uses It

The Site Factory generates multiple read-only projections from the authoritative Cloudflare D1 database so that humans and autonomous agents can inspect system state across Git and web browsers. Key projections include ops/work/tasks.json for tracking work item diffs in Git history, markdown task tables in README.md rendered via tools/work.py render, and static HTML pages in dashboard/site/ that allow operational monitoring without reading D1 directly. Artifacts and observations in artifacts.json and observations.json are similarly derived receipts.

The CLI provides python3 tools/work.py list --projection to inspect local Git projections during offline triage without connecting to D1. However, because local projections may lag behind canonical reality, safety guards in tools/work.py reject combining --projection with --ready, enforcing that executable work items are extracted solely from live D1 state.

Caveats & Operational Rules

  • Direct edits to projections do not alter the source of truth: Manually tweaking tables in README.md or task definitions in tasks.json never updates D1; all state transitions require CLI commands like tools/work.py.
  • Projections reflect eventual consistency: Because projections update asynchronously, there is often a slight lag after canonical records change; strict concurrency checks and claims must query D1 rather than stale projections.
  • Projection corruption does not imply data loss: If a local projection file is deleted or damaged by merge conflicts, running python3 tools/work.py render or triggering a resync reconstructs the exact state immediately from D1.

Related Terms

References

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

Verified: 2026-11-08