Urgent.News

the world's headlines, one feed

Editions

Tech

Three checks in our codebase that could not fail

Last night I found three checks in our own codebase that could not fail. Not checks that were failing to catch things. Checks that were structurally incapable of ever going red, while reporting green forever. We run a site where every factual claim has to be checked and the check shown. That is the whole product. So this was worth understanding properly, and the three had the same shape…

Three checks within our codebase proved to be structurally incapable of failing, despite being designed to catch potential issues. This discovery was made through a thorough examination of our site, which requires every factual claim to be verified and displayed. The three checks shared a common trait, a shape that seems to be prevalent in many test suites.

The first check relied on a verifier that contained a line-for-line copy of the rule it was supposed to enforce. Instead of checking the actual implementation, the verifier compared its own expectations against the copy, resulting in a perfect agreement despite both inheriting the same bug. The check never received the data it was meant to verify, creating a false sense of security.

The second check was a pinned result that asserted its own arithmetic. The page displaying this check claimed a PASS with 109/109 assertions, while the actual verifier reported a FAIL with 106/109 assertions. The issue persisted for two weeks before being corrected by a single line of code. The corrected version ensures that the failures are read before the assertion is made, resulting in a fixed point.

The third check was an estimator used in a page about Zipf's law. It fit a power law to word frequencies and printed the exponent, citing a continuous maximum-likelihood estimator. However, the estimator had been wrong for two years, and all the checks tolerated this error because a plausible number is not a valid check. The estimator's right-hand side was based on a range wide enough to contain any answer the estimator could produce.

These findings highlight the importance of designing assertions that are based on the thing being tested, rather than a function of the thing itself. A check whose right-hand side moves with the code cannot fail, as it confirms a derivation. Additionally, introducing a defect to test the check's effectiveness is a crucial step in ensuring its proper functioning.

With these lessons learned, we can now focus on improving our test suite by planting known answers, reproducing published numbers, and intentionally breaking the system to confirm the checks' effectiveness.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — it may contain errors, so check the original before relying on it.

Read the original at dev.to →

More in Tech

What I Learned Building a Production LMS with Node.js, MongoDB & AWS in 2026

Building an LMS looks simple at the beginning. You need users, classes, payments, attendance, recordings, homework, notifications, and reports. Then you move into production.

  • Building a production LMS with Node.js, MongoDB, and AWS proved more complex than anticipated.
  • Proper system design matters more than technology choice.
  • Avoid treating schema design in MongoDB as optional; use dedicated collections for data growth.

How ReactJS Can Improve User Experience and Boost Your Bottom Line?

Most content about ReactJS and business value follows the same template: virtual DOM makes it fast, components make it reusable, fast and reusable means good for business.

  • ReactJS improves user experience with virtual DOM updating only changed components.
  • Component reusability speeds development, reduces bugs, and enhances codebase stability.
  • React Native enables cross-platform app development, lowering maintenance costs.

Head-of-Line Blocking in HTTP

An asynchronous HTTP/1.1 server can handle many connections concurrently while still serializing work within each connection.

  • Head-of-line blocking delays fast HTTP requests in slow connections
  • HTTP/2 solves this at application layer with independent streams
  • HTTP/3 uses QUIC transport-level streams to avoid blocking