How a Simple Kotlin Validator Prevents Silent Data Corruption in Distance Tracking

A software engineering team discovered that five distance metrics in their tracking system — original, cleaned, mock, abnormal, and spike — had no code-level checks ensuring their mathematical relationships held true. To fix this, they built an 80-line Kotlin validator that enforces key invariants, such as cleaned distance equaling original minus mock and abnormal, while deliberately excluding spike to avoid double-counting. The validator uses a 0.1-metre floating-point tolerance to avoid false failures and separates hard errors, which block data submission, from warnings that flag unusual ratios without stopping the pipeline. Ratio-based warnings catch a different class of problem: cases where all numbers are internally consistent but a classification filter is quietly discarding large portions of a genuine journey. The team argues that asserting system invariants explicitly in code is far cheaper than discovering silent data corruption weeks later through customer support complaints.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in