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
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:
- the metric's definition, population and grain, with a hash of the definition;
- the dbt model and the two columns that carry the result (the work order and whether it passed);
- a hash of the compiled SQL, a hash of the input, and the identity of the run that produced the rows;
- whether the rows that run produced conform to the definition, decided from the rows, not from the model's name.
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
| Kind | Where it comes from | What it establishes |
|---|---|---|
| Declared dependencies | dbt's own project graph | Which model reads which |
| Metric-to-column mapping | Written explicitly for this engagement | Which columns carry which business metric |
| Observed execution | dbt's run results, checked against the database | What 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.