#4541·career-ops

reply-matcher: the short-name gate strips combining marks, so Indic company names are treated as acronyms

Author: abankar1Created Sep 28, 2026Updated Sep 28, 2026
Labelsbug🔧 scripts

Summary

checkCompanyMatch decides whether a company name is a short acronym — one that needs a word boundary so HP cannot match inside PHP — by counting characters with combining marks stripped out. Devanagari and Bengali write most vowels as combining marks, so ordinary company names count 2 or 3 and are handed the rule written for two- and three-letter Latin acronyms. Replies mentioning them are then not matched to their application.

The code

reply-matcher.mjs:

javascript
const alphanumeric = company.replace(/[^\p{L}\p{N}]/gu, '');
const isShortName = Array.from(alphanumeric).length <= SHORT_NAME_MAX;   // SHORT_NAME_MAX = 3
if (isShortName && !NO_WORD_SEPARATOR_RE.test(company)) {
  return matchesOnWordBoundary(text, company);
}

\p{M} is absent from the class, so every mark is discarded before the count. Note the return — the short-name branch is terminal, so the substring, lowercase and spacing-insensitive paths below it never run for a name routed there.

The file already states that this is wrong. matchesOnWordBoundary's lookarounds include \p{M}, with the reason given:

\p{M} sits alongside \p{L}/\p{N} in both lookarounds so a combining mark counts as part of a word rather than as a boundary.

and the note at the role branch is explicit that these predicates are coupled:

Three predicates define "word material" here (this strip, LATIN_WORD_RE, and matchesOnWordBoundary's lookarounds) and they have to move as a unit. Updating two of the three is what produced that bug (CodeRabbit, #3535).

The length gate is a fourth predicate over the same notion, and it is the one that was left behind.

What it counts

Name Code points Counted Classified
विप्रो (Wipro) 6 3 short
टाटा (Tata) 4 2 short
ज़ोमैटो (Zomato) 7 3 short
क्रेड (CRED) 5 3 short
Wipro 5 5 not short
Tata 4 4 not short

टाटा counting 2 puts it below even the cNorm.length > 2 floor further down.

Reproduction

Marathi and Bengali attach case suffixes to the noun, so this is standard orthography rather than informal writing — -मध्ये is the Marathi locative, -তে the Bengali one:

javascript
checkCompanyMatch("विप्रोमध्ये तुमच्या अर्जाबद्दल धन्यवाद.", "विप्रो")   // false — expected true
checkCompanyMatch("টাটাতে আপনার আবেদনের জন্য ধন্যবাদ।",      "টাটা")    // false — expected true

A reply-watch run over those mails matches no application, so the tracker is never updated and the user is not told the outcome. The repo ships modes/hi/ (naukri / aavedan, CTC vs in-hand, PF/EPF), so Indian-market users are explicitly in scope.

Why the threshold is not the problem

The same construction, in the same script, behaves differently depending on whether mark-stripping happened to cross the threshold — and the Latin spelling of the same company never meets the rule at all:

javascript
checkCompanyMatch("উইপ্রোতে আপনার আবেদন গৃহীত হয়েছে।", "উইপ্রো")  // true   (6 code points, counted 4)
checkCompanyMatch("টাটাতে আপনার আবেদনের জন্য ধন্যবাদ।", "টাটা")   // false  (4 code points, counted 2)
checkCompanyMatch("Thanks for applying to Tatawards.", "Tata")   // true   (Latin, counted 4)

Raising SHORT_NAME_MAX cannot reconcile those, because the gate is measuring in a unit whose size depends on the script. The fix is to count \p{M}, bringing the fourth predicate in line with the three that already do.

Counting marks makes fewer names short, so the direction of risk is a name losing a boundary it needed. Latin, Han, Hiragana and Katakana names carry no combining marks, so no count among them can move — HP/PHP, 3M, IBM and the NO_WORD_SEPARATOR_RE substring path are all unaffected.

Adjacent, and deliberately not proposed here

NO_WORD_SEPARATOR_RE lists Han, Hiragana and Katakana, but Thai also runs without word separators, so a short Thai name is required to land on a boundary that cannot exist. I am not proposing a change to that list in this issue: the comments around it record that enumerating scripts "has no clean answer" and that earlier drafts produced real false negatives found one script at a time, so it deserves its own discussion rather than being folded into a counting fix.