[object Object]

← back to Rentv 2026

pr/taxonomy: Cody gate — collapse whitespace at the top of classifyTitle. The fixed-width (?<!vice[\\s-]) lookbehinds were defeated by dirty input ('Vice President' w/ double-space, tab), re-mislabeling VPs as president/c_suite — exactly the bug class the guards fix. .replace(/\\s+/g,' ') normalizes before any pattern runs, fixing both rules + all [\\s-] separators. Verified double/triple-space + tab VPs now classify correctly, clean titles unregressed

d185923108f7bf6008fd0468b90c939d36434088 · 2026-08-05 19:58:23 -0700 · Steve

Files touched

Diff

commit d185923108f7bf6008fd0468b90c939d36434088
Author: Steve <steve@designerwallcoverings.com>
Date:   Wed Aug 5 19:58:23 2026 -0700

    pr/taxonomy: Cody gate — collapse whitespace at the top of classifyTitle. The fixed-width (?<!vice[\\s-]) lookbehinds were defeated by dirty input ('Vice  President' w/ double-space, tab), re-mislabeling VPs as president/c_suite — exactly the bug class the guards fix. .replace(/\\s+/g,' ') normalizes before any pattern runs, fixing both rules + all [\\s-] separators. Verified double/triple-space + tab VPs now classify correctly, clean titles unregressed
---
 src/pr/lib/taxonomy.js | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/pr/lib/taxonomy.js b/src/pr/lib/taxonomy.js
index a60123c1..57873f88 100644
--- a/src/pr/lib/taxonomy.js
+++ b/src/pr/lib/taxonomy.js
@@ -175,7 +175,10 @@ const SENIORITY_RULES = [
 
 /** Map an exact public title → { normalized_role, department, seniority }. Keeps the exact title separately. */
 function classifyTitle(exactTitle) {
-  const t = String(exactTitle || '').trim();
+  // Collapse whitespace BEFORE any pattern runs: the fixed-width `(?<!vice[\s-])president`
+  // lookbehinds (and the `[\s-]` separators throughout ROLE_RULES) are defeated by dirty input
+  // like "Vice  President" from LinkedIn/CSV imports, which would re-mislabel a VP as president.
+  const t = String(exactTitle || '').trim().replace(/\s+/g, ' ');
   if (!t) return { normalized_role: null, department: null, seniority: null };
   let normalized_role = 'other', department = 'other';
   for (const [re, role, dept] of ROLE_RULES) {

← 1bdfc17d pr/taxonomy: fix two title-classification bugs (proven by ex  ·  back to Rentv 2026  ·  auto-save: 2026-08-05T20:15:24 (7 files) — data/deals-regist 270d4b18 →