Mortgage Calculator Shipped With Silent Bug That Made Every Test Pass but Gave Wrong Answers
A code review of a mortgage calculator revealed a bug where the loan comparison panel always ran projections with an empty additional payments list, producing skewed results. Every automated test passed because each test checked individual functions in isolation, and none verified that both scenarios used identical inputs end-to-end. The core issue was a structural flaw in fair-comparison logic: pay-down and invest scenarios were not held to the same fixed monthly cash outflow, making one option appear cheaper simply because less money was being spent. The correct approach enforces a budget invariant where the sum of loan installment and investment contribution remains constant across all scenarios for the entire loan term. The bug was discovered in Cashcolt, a free mortgage calculator hosted in Germany, and was fixed by threading the same parameters through both the headline and comparison panels consistently.
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