Decision
Between extraction and modelling, a dedicated stage asserts the expected grain and fails the run if the row count has multiplied.
Context
Eight cross-referenced sources, several of them one-to-many.
Alternatives, and why not
- Check row counts by eye during developmentIt catches the problem the day you introduce it and never again. A join that starts fanning out six months later is invisible.
Rationale
Row multiplication is a silent correctness failure: the model trains happily on duplicated evidence and reports plausible metrics. The only reliable defence is an assertion in the pipeline.
What it cost
A stage that can fail a run for a data-shape reason rather than a code reason, which needs an operator who understands the distinction.
Outcome
Grain violations became a failed run rather than a quietly wrong model.