fix(dedup): distinct non-Latin companies merged into one, deleting a row - #2587
Conversation
dedup-tracker.mjs kept its own local normalizeCompany() using the pre-career-ops-hq#2429 ASCII fold (`[^a-z0-9 ]`). Every company name written entirely in a non-Latin script folds to the empty string under that, so two DIFFERENT employers share a grouping key, pass the role match when their titles agree (common — "Engineer", "Backend Engineer"), and the lower-scored row is deleted. Silent: the run prints its normal success output. Only the .bak preserves the lost application. | 1 | アクメ株式会社 | Engineer | 4.2/5 | | 2 | グロベックス合同会社 | Engineer | 3.0/5 | -> before: "Remove career-ops-hq#2 (グロベックス合同会社) -> kept career-ops-hq#1"; row 2 gone -> after: 0 duplicates removed This is the third instance of one defect class in this area. f589ce8 (career-ops-hq#2429) made tracker-utils.mjs Unicode-aware, and merge-tracker.mjs and set-status.mjs inherited it because they import the shared helper; dedup-tracker.mjs had forked its own copy and was missed. fe4561b then fixed this same file's blind-via key (career-ops-hq#2397) while the ordinary company path twelve lines below kept the old fold — the comment above that code even describes the bug for the Via key. Fix: delete the local copy and import the shared normalizeCompany, so the two cannot drift again. The key is only ever an in-memory grouping key, never persisted or compared across scripts, so adopting the shared normalization changes no stored data. The comment describing the old behaviour is corrected in the same change. Tests: a sibling of the existing career-ops-hq#2393 blind-via block, on the ordinary company path. Two distinct non-Latin employers stay apart; punctuation variants of one Latin employer ("Acme (Inc.)" / "Acme Inc") still merge; two distinct Latin employers still stay apart. Verified the first fails before this change. test-all: 0 failed.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesUnicode company deduplication
Estimated code review effort: 3 (Moderate) | ~15–30 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Merged, @darkpandawarrior, and this is the right shape for it. #2429 made Reproduced here before merging, with both controls: the local function on Worth naming: the blind-via channel path right above it was fixed for this exact class in #2393, and the ordinary path underneath it stayed broken. A fix that lands next to its sibling and doesn't get applied to it is a pattern I want to catch earlier 🚀 |
The bug
dedup-tracker.mjskept its own localnormalizeCompany()using the pre-#2429 ASCII fold:Any company name written entirely in a non-Latin script folds to
''under that. Two different employers therefore share a grouping key, passroleMatch()when their titles agree — common, since "Engineer" / "Backend Engineer" recur everywhere — and the lower-scored row is deleted.The run prints its normal success output. Nothing warns. Only the
.bakpreserves the deleted application.This is the third instance of the same class here
That's the part I think matters more than the fix:
f589ce83(merge-tracker: every non-Latin company name normalizes to "", so different companies silently overwrite each other #2429) madetracker-utils.mjs'snormalizeCompanyUnicode-aware.merge-tracker.mjsandset-status.mjspicked it up automatically because they import the shared helper.dedup-tracker.mjshad forked its own copy, so it didn't.fe4561b(fix(dedup): use Unicode-aware Via key for blind-employer grouping #2397) then fixed this same file's blind-via key — while the ordinary company path twelve lines below kept the old fold.So the fix is to delete the local copy and import the shared one, rather than patch the regex — that's what stops a fourth instance.
Why this is safe
The value is only ever an in-memory grouping key (
groupsMap,dedup-tracker.mjs:328). It is never persisted, never written to a row, and never compared against a key produced by another script. Adopting the shared normalization changes no stored data.I checked the Latin path explicitly rather than assuming:
Acme (Inc.)andAcme Incstill merge, andGlobex/Initechstill stay apart.Tests
A sibling of the existing #2393 blind-via block, placed next to it, on the ordinary company path:
The last two are the regression guards for the normalization swap.
node test-all.mjs→ 0 failed.Filed directly per CONTRIBUTING.md (bug fix, no issue needed).
Summary by CodeRabbit
Bug Fixes
Tests