dedup-tracker: roleMatch ignores the posting URL, so two live postings can be deleted as one
Problem
dedup-tracker.mjs decides that two rows are duplicates from company + role alone. merge-tracker.mjs has a third input that dedup-tracker.mjs ignores: the canonical posting URL. So when a tracker carries a URL column, two rows naming the same company and the same role but pointing at two different live postings are clustered, and dedup deletes the loser.
parseTrackerRow() already exposes the cell (row.url, set only when the header carries a URL column — colmap.url != null), so the data is there; roleMatch() just never reads it.
Why this is unrecoverable when it fires
dedup-tracker.mjs writes a backup before replacing the tracker, but a semantically wrong deletion is not an interrupted write — it is a clean, successful run that removed a real application. applications.md is user-layer and gitignored, so there is nothing to diff against.
Blast radius
Two rows must agree on company AND role:
- Before #4487 the company gate was an exact
normalizeCompany()match, which already admitted such pairs. - #4487 adds a second way in (a corporate-form tail: "Acme Widgets, APC" / "Acme Widgets"), so exposure is somewhat wider.
Neither PR creates the hole, and neither closes it. It is pre-existing and independent of both.
The case is not hypothetical: it is what a re-scan of the same role at a company that re-posts under two req IDs produces, and what #1524/#2009 already established for merge-tracker.mjs — a confirmed URL mismatch is proof the rows are not duplicates.
Suggested fix
Reuse the decision merge-tracker.mjs already makes rather than a private one — it is the same question, and #2445 exists because a second copy of an identity rule is how these drift:
// url-key.mjs, already imported by merge-tracker.mjs:32
import { normalizeUrl } from './url-key.mjs';
function roleMatch(a, b) {
const urlA = normalizeUrl(a.url);
const urlB = normalizeUrl(b.url);
if (urlA && urlB && urlA !== urlB) return false;
// ... existing tiers
}normalizeUrl() yields no key for a blank/placeholder cell, so rows without a URL keep today's behavior and only a positive conflict blocks a merge. That is the direction to want: blocking on a conflict leaves a duplicate the user can see, while merging on a conflict deletes a real application.
Test
One end-to-end fixture, in the shape of tests/dedup-tracker-corporate-form.test.mjs:
- two
Evaluatedrows, same company, roles that normalize equal, different posting URLs → both survive. - a control row pair with the same URL → still merges, so the guard is not just disabling the corporate-form path.
Scope note
Surfaced by CodeRabbit on #4487 (comment). Left out of that PR deliberately: roleMatch() is untouched there and the project ships one behavior change per PR (#3652/#3653). #4421 defect 4 is the corporate-form twin bug; this is a different gate.
Refs #4421 (separate defect).
Source: santifer/career-ops