Developer discovers coverage check that could only ever show 100% by design
A software developer found that a code coverage check in their project always displayed 13/13, not because coverage was genuinely complete, but because both the numerator and denominator were derived from the same array. Since the numerator was simply the array mapped through a function, its length could never differ from the denominator, making failure mathematically impossible. The real risk — an error case with no matching classifier arm — was invisible because missing entries were absent from both sides of the fraction simultaneously. The fix involved replacing the denominator with an independent source, the full set of known error kinds, so any gap would cause the ratio to drop. The developer has since added an 'aggregation gap' audit rule to automatically flag coverage checks where the numerator and denominator share the same source.
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