Founder Notes
A Matcher Inherits Its Error Preference
Two features in our system asked the same question, so they shared the same code. That was the bug, and it took me an embarrassingly long time to see it, because the question really was the same question.
The question was: are these two records the same company?
One caller was deduplication. The other was an exclusion list — companies we had decided, deliberately, not to contact.
The same question with opposite stakes
Deduplication wants a generous matcher. Strip the punctuation, fold the case, drop the corporate suffixes, ignore the spacing. Merge anything that looks close. This is the right instinct there, because of how the errors behave: if you wrongly merge two companies, a human eventually opens the record, sees two businesses fused into one, and says that is wrong. The error announces itself. The recovery is a split and an apology.
The exclusion list wants the opposite matcher, and I had not thought about why until I went looking for a different bug entirely.
If the exclusion matcher wrongly matches, a company nobody ever decided to exclude is silently never contacted. There is no merged record to notice. There is no row that says this was skipped and here is why. The outcome of a false positive is an absence, and absences do not raise their hand.
So the two callers have opposite error preferences. Deduplication prefers false positives to false negatives. Exclusion prefers false negatives, strongly, because its false positives are invisible.
They were sharing one implementation, tuned for the first one.
What generous matching actually does
The specific failure was worse than the comment in the code admitted, which is usually how this goes. Normalisation had been tuned until short, common words inside longer names were enough to match. A word like "launch" or "pitch" appearing in one company's name would pull in every unrelated company that happened to contain it.
The worst instance was an entity being excluded on its own unrelated domain — a match so aggressive it suppressed the very record it was supposed to be scoped to.
None of that is exotic. It is what happens when you take a matcher tuned to be forgiving and point it at a decision where being forgiving means silently doing nothing.
The fix, which was boring
Strict identity for the exclusion path, plus a small set of adjudicated keys for the cases where two spellings genuinely are the same company and somebody made that call on purpose and wrote it down. Regression tests where the TODO had been. No legitimate record suppressed.
The interesting part was not the fix. It was that the shared helper looked like good engineering. One definition of company identity, used consistently, no duplicated logic. Every code review instinct I have says that is correct.
What I think the actual rule is
A matcher does not have an error preference of its own. It inherits one from whoever calls it.
"Are these the same?" is not a complete question. The complete question is "are these the same, given what it costs me to be wrong in each direction?" Two callers whose costs point opposite ways cannot share one answer, no matter how identical the question sounds when you say it out loud.
The tell is not accuracy. Both callers were about equally accurate. The tell is visibility: ask, for each kind of error, whether anything in the system would report it. Deduplication's mistakes are self-reporting. Exclusion's mistakes are self-concealing. That asymmetry, not the match rate, is what decided how strict the matching should have been.
I now think shared identity logic is one of the places where the usual instinct against duplication is actively wrong. Three similar matchers with three different thresholds, each owned by the caller that has to live with its errors, is better than one matcher that is correct for whichever caller was written first.