{"record":{"id":"fbbbff2d37e21019","repo":"santifer/career-ops","slug":"cross-channel-duplicate-key-replace","errorCode":null,"errorMessage":"Cross-channel duplicate — ${key.replace('::', ' / ')} reached via ${list.map(v => v.raw).join(' AND ')} (rows ${list.map(v => `#${v.num}`).join(', ')}) — double-submission risk, resolve by hand","messagePattern":"Cross-channel duplicate — (.+?) reached via (.+?) \\(rows (.+?)`\\)\\.join\\(', '\\)\\}\\) — double-submission risk, resolve by hand","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"verify-pipeline.mjs","lineNumber":412,"sourceCode":"// and dedup-tracker key agencies with (#2397), so \"Hays\" and \"HAYS \" read as one\n// channel while リクルート and パーソル stay two; the raw spelling is kept for\n// the message. Before this, both non-Latin agencies normalized to '' and fell\n// back to 'direct', hiding exactly the double-submission this check exists for.\nconst normalizeChannel = (v) => normalizeVia(v ?? '') || 'direct';\nconst channelsByRole = new Map();\nfor (const e of entries) {\n  const company = String(e.company || '').trim();\n  if (!company || company === '?') continue;\n  const key = `${company.toLowerCase()}::${String(e.role || '').trim().toLowerCase()}`;\n  if (!channelsByRole.has(key)) channelsByRole.set(key, new Map());\n  const channels = channelsByRole.get(key);\n  const norm = normalizeChannel(e.via);\n  if (!channels.has(norm)) channels.set(norm, { raw: String(e.via || '').trim() || '—', num: e.num });\n}\nfor (const [key, vias] of channelsByRole) {\n  if (vias.size > 1) {\n    const list = [...vias.values()];\n    warn(`Cross-channel duplicate — ${key.replace('::', ' / ')} reached via ${list.map(v => v.raw).join(' AND ')} (rows ${list.map(v => `#${v.num}`).join(', ')}) — double-submission risk, resolve by hand`);\n    viaIssues++;\n  }\n}\nif (viaIssues === 0) ok('Via channels consistent');\n// --- Check 12: Duplicate tracker numbers (#1704) ---\n// The # column is a row id and must be unique. Unlike Check 2 (company+role\n// dedup, which can false-positive on a legitimate re-application), the SAME\n// number appearing on 2+ rows is never legitimate: it means set-status.mjs\n// can't tell the rows apart, and any external reference to \"application #N\"\n// (interview-prep notes, memory, cross-links) becomes ambiguous. Pure\n// addition, no existing check covers this — see #1704 for the 124-row sweep\n// that found this in the wild (merge-tracker.mjs trusted a stale TSV number\n// as-is whenever it exceeded that run's max, without checking it wasn't\n// already used by an unrelated row merged in a separate, earlier invocation).\nconst numGroups = new Map();\nfor (const e of entries) {\n  if (!numGroups.has(e.num)) numGroups.set(e.num, []);\n  numGroups.get(e.num).push(e);","sourceCodeStart":394,"sourceCodeEnd":430,"githubUrl":"https://github.com/santifer/career-ops/blob/e7abd431fce9348a95261acac9e0c14779c35df8/verify-pipeline.mjs#L394-L430","documentation":"verify-pipeline.mjs Check 11 groups tracker rows by normalized company+role key and, when the same opening appears under more than one Via channel, warns that the candidate may have applied twice through different routes. Both submissions are real, so it is deliberately a warning to the human — the tool never auto-merges them.","triggerScenarios":"Running `node verify-pipeline.mjs` when two tracker rows share the same company+role (normalized) but carry different Via values (e.g. direct application and one through an agency), or one row has no Via and another does.","commonSituations":"Applying directly after a recruiter already submitted you; duplicate rows created by re-evaluating the same posting via scan then auto-pipeline; agency and direct postings of the same req both tracked.","solutions":["Inspect the listed rows and decide which submission to keep; delete or mark the duplicate Discarded","Merge the surviving channel info into the kept row's Via column","Use set-status.mjs to mark the discarded channel rather than hand-deleting rows","Add the req/posting ID to notes on both rows (REQ_NUMBER_RE) so future merges treat real distinct reqs correctly"],"exampleFix":"// before: two rows\n| 42 | ... | Acme | Backend | ... | via=Hays |\n| 57 | ... | Acme | Backend | ... | via=— |\n// after: keep one, mark the other\n| 42 | ... | Acme | Backend | ... | via=Hays | (active)\n| 57 | ... | Acme | Backend | ... | Discarded, duplicate of #42 |","handlingStrategy":"validation","validationCode":"const seen = new Map();\nfor (const r of rows) {\n  const k = `${r.company.toLowerCase()}::${r.role.toLowerCase()}`;\n  if (seen.has(k) && seen.get(k).via !== r.via) console.warn(`cross-channel duplicate: ${k}`);\n  seen.set(k, r);\n}","typeGuard":"const sameRoleDiffChannel = (a, b) => a.company === b.company && a.role === b.role && normalizeChannel(a.via) !== normalizeChannel(b.via);","tryCatchPattern":null,"preventionTips":["Search the tracker for the company before applying again","Put the req/posting ID in notes to distinguish real distinct reqs","Record every agency submission via= in its row","Resolve duplicates promptly — never auto-merge by hand tools"],"tags":["duplicate-detection","tracker","validation"],"backgroundTag":"conflicting-config-options","analyzedSha":"e7abd431fce9348a95261acac9e0c14779c35df8","analyzedAt":"2026-09-16T06:35:29.214Z","contentChangedAt":"2026-09-16T06:35:29.214Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}