Tarik Al Hadethi Download CV

Three green tests that tested nothing

I fixed a word list, and in doing so I made three of my own regression tests unable to fail. They stayed green. I could have deleted the code they guarded and nothing would have told me.

Clarus reads text out of screenshots. The engine it uses is accurate per character and careless with spaces, so it hands back things like thenextsteps and Amazonorders. A chain of repair passes puts the spaces back, and the load-bearing one is dictionary-driven: if a token is not a word, but splits cleanly into two or three words, split it.

The complaint was that it split words that were already fine. runtimes came out as run times. sitemaps as site maps. payloads as pay loads.

Not a tuning problem, a data one

My instinct was that the splitter was too eager and needed a threshold. It was not. The splitter skips any token the dictionary already accepts, so I went to check why it was not accepting these:

  • runtime is rank 9052. runtimes is absent.
  • sitemap 2223, sitemaps absent.
  • payload 14813, payloads absent.
  • integration 2424, integrations absent.

The list holds singulars and not plurals. Every plural fell straight through to the splitter, which then did its job correctly on a token that should never have reached it. And this was not a gap in technical vocabulary I could wave away: cannot is missing outright from all 39,481 entries.

I fixed it at three depths, cheapest first. Plural-aware matching, since strip-an-s is permissive and permissive is the safe direction here: that function can only ever leave a token alone, never split it. Forty words appended, deliberately at the end of a frequency-ordered file, so the splitter trusts them least as pieces while still counting them as whole words. And a guard refusing any split whose trailing piece is an English suffix, because every damaging split I had measured ended in one and not one correct split did.

On 27 real captures that took damaged lines from 22 to 18.

The part I did not expect

The suffix guard had its own test. It passed. It also passed when I deleted the guard.

Adding those forty words meant the token in my test case was now accepted by the dictionary, so the function returned before the splitter was ever reached. The test was still running, still asserting the right output, still green, and it had quietly stopped touching the code it existed to protect.

A fix that makes an earlier layer succeed can silently disarm the test of a later one. The suite goes green not because the bug is gone but because the bug moved out of reach.

The only thing that found it was running the negative control again: break the guard on purpose, confirm the test fails. I had run that control when I wrote the guard, hours earlier, and it worked then. It was true when I checked it and false by the end of the day, and nothing in between announced the change.

Once I knew the shape I went looking, and it had happened twice more that day. Three tests, all green, none of them reaching what they claimed to cover. Two I fixed by calling the inner function directly, so no earlier layer can intercept the input. The third needed a case built from coinages no word list will ever hold, like hoverable and paddingless, so the dictionary can never short-circuit it.

A sample that shows no damage is not proof there is none

Later the same day I allowed two-letter pieces in a split, gated on frequency, because English glues its short words more than any others: of, to, in, us. I checked it across the library. Six tokens newly split, all six correct, not one token split differently. Clean.

It was not clean. resizable became re sizable, because re is rank 113 and slipped under the cap while de, co and un sat safely above it. My library probe never saw it. An existing unit test did.

The corpus I was measuring against was real, which is the right instinct, but real is not the same as complete. It told me what I had changed on the captures I happened to have, and nothing at all about the word I had never photographed.

Knowing when to stop

What ended the work was building a taxonomy: run the real pipeline over the real captures and sort every token the dictionary cannot account for. Of 3369 tokens, 80.1% are dictionary words. The only bucket that is genuinely wrong is 1.8%. And over half of that is not a misread at all, but ordinary words my list lacks, printed perfectly.

That number is what let me reject three plausible improvements on evidence rather than taste. The clearest was single-edit spell correction. It fixes subseription, and it corrupts repointed into reprinted and iterate into literate. One win, three losses, and the losses are the dangerous kind: the output still reads as fluent English, so nobody would ever spot it.

Before that measurement I was picking work by whichever bad example happened to be on screen. After it I could see that the remaining errors were 0.09% of tokens, and that the cheapest-looking fix made things worse. That morning I would have told you the opposite of both.

Written while building Clarus.  ·  More writing