I was generating call-to-action blocks for about twenty pages. Each block needed a human-readable phrase derived from the page slug, so "best-crm-software" would become something I could drop into a sentence.
The obvious implementation is to split on hyphens and capitalize each word. I wrote it, ran it, and checked three samples.
They looked fine. So I applied it to all twenty files and committed.
Then I read the generated text properly for the first time. "Our Best Crm Software breakdown covers that in more detail." And "Our Ai Video Subtitle Tools breakdown."
CRM had become Crm. AI had become Ai. The formatter had gone through every word and lowercased everything except the first letter, which is exactly what capitalize does, and it is exactly wrong for acronyms.
Nothing crashed. No test failed. The output was valid English sentences that happened to systematically mangle every abbreviation in the corpus.
The part that made it worse: I had a rollback available and used it. I reverted all twenty files, fixed the function, and regenerated. The cost was a few minutes. But without version control this would have been twenty files of quietly wrong copy sitting on a live site, findable only by someone reading each page.
The fix itself was trivial. Keep a set of known acronyms, check membership before touching case, and leave everything else lowercase when the phrase sits mid-sentence. CRM, HRIS, LMS, AI, SEO, HR, OKR, VPN. Maybe forty entries covers it.
What I actually learned is about my sampling. I checked three pages and they happened not to contain acronyms. Three samples felt like diligence and was not, because I chose them by convenience rather than by what could break.
Now when I write a text transform I check specifically against the inputs most likely to break it, not against the first few inputs that come to hand. For case transforms that means acronyms. For escaping it means quotes and ampersands. For truncation it means the longest string in the set.
The bug was never hard to fix. Finding it before deployment was the whole job, and I nearly skipped that by sampling badly.
More of these at https://yongrui-services.pages.dev/













