The Engagement · Architecture

Architecture and lineage

How a business definition is tied to the SQL that implements it and to the run that produced the number.

A fictional field-service company with invented data. The fault was planted so the right answer is known. Built and run on DuckDB and dbt on 17 November 2026; running the same exercise on a Snowflake account is the next step. Change approval inside the scenario is simulated.

The layers

SourcesSix tables: customers, assets, service contracts, service-level obligations, work orders, response events.
StagingOne cleaned view per source table.
Response factsValid response events, one row per valid response. Work-order responses, one row per eligible work order with its earliest valid response.
ReportsDispatch and Contract Management read the work-order fact. Legacy Dispatch read the event fact before the correction, and reads the work-order fact after it.
ConsumerThe compliance reporting that depends on all three reports.

That is the whole defect in one sentence: the legacy report was attached to the layer with one row per response when its definition needed the layer with one row per work order.

From meaning to code

Each report is bound, explicitly, to a named business metric. The binding records:

Legacy Dispatch is bound to Dispatch's metric. It fails conformance before the correction and passes after it. The bindings for the before and after builds are separate records, so the history stays readable.

Three kinds of lineage, kept apart

KindWhere it comes fromWhat it establishes
Declared dependenciesdbt's own project graphWhich model reads which
Metric-to-column mappingWritten explicitly for this engagementWhich columns carry which business metric
Observed executiondbt's run results, checked against the databaseWhat actually ran, and what it produced

A model appearing in a graph does not make its number right. Correctness here rests on the row checks described under verification. The metric-to-column mapping is written by hand for these reports; generating it automatically across a whole warehouse is future work.

What the correction touches downstream

Moving Legacy Dispatch to the work-order fact removes the duplicate row from that report and from the reporting that consumes it. Dispatch, Contract Management, staging and the source tables are unaffected.

All the evidenceAssessmentThe changeVerification and rollbackLineage← The engagement