Skip to main content
This is the biggest single page in the CI Contract by test count and the smallest by idea: three dbt test kinds, repeated once per declared key or required column across every staging, reference, intermediate, and mart model (plus the two reference seeds). One pattern, explained once, then a gated table carrying the per-model breakdown.
The most common test in the suite. Declared on every column a downstream model or the app is allowed to assume is populated a surrogate key, a foreign key, a physics component that’s supposed to exist on every valid lap. A not_null failure means either an upstream join silently dropped rows it shouldn’t have, or a column that’s genuinely optional (and should read NULL downstream, like compound_component_s on a lap with no tyre data) had its test declared too strictly.
Every model between stg_laps and a feature mart joins back to the same lap, directly or transitively, by lap_id (or a sector/corner-grain extension of it). The unique test on every model’s grain key is what makes that join spine trustworthy: if any one of the ~30 models a lap passes through on its way to fct_lap_residuals silently duplicated a row, every downstream JOIN on that model would fan out, and a single lap’s contribution to a race-level or season-level aggregate would be counted more than once invisibly, since the duplicated rows would carry consistent-looking values. This is also what protects the identity itself: assert_lap_7term_identity checks that pace_delta_s equals the sum of six components plus the residual on every row of int_lap_residual_decomposed, but that check is only meaningful once per lap. A duplicated lap_id would pass the identity test twice instead of failing it once.

Every model, by structural test count