> ## Documentation Index
> Fetch the complete documentation index at: https://offthepace.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# assert_additive_identity

> Validates that an additive identity holds: total = sum(components) + residual ± tolerance

Validates that an additive identity holds: total = sum(components) + residual ± tolerance

## Signature

```sql theme={null}
{{ assert_additive_identity(model_ref, total_col, component_cols, residual_col, tolerance=0.0001) }}
```

## Arguments

| Argument         | Description                                                                                   |
| ---------------- | --------------------------------------------------------------------------------------------- |
| `model_ref`      | ref() to the model to validate                                                                |
| `total_col`      | name of the total column (e.g., 'pace\_delta\_s')                                             |
| `component_cols` | list of component column names (e.g., \['fuel\_component\_s', 'compound\_component\_s', ...]) |
| `residual_col`   | name of the residual closure column (e.g., 'driver\_skill\_residual\_s')                      |
| `tolerance`      | allowable deviation in the same units as total\_col (default 0.0001 s)                        |

## Returns

rows where the identity does NOT hold (i.e., failing rows). Usage in a singular test file: \{\{ assert\_additive\_identity( ref('int\_lap\_residual\_decomposed'), 'pace\_delta\_s', \['fuel\_component\_s', 'compound\_component\_s', 'rubber\_component\_s', 'ambient\_component\_s', 'constructor\_component\_s', 'dirty\_air\_tax\_s'], 'driver\_skill\_residual\_s' ) }} The test fails (returns rows) if the identity does not hold to within tolerance.
