From 9144ab9624ba1f641267a76ac289516774014e2d Mon Sep 17 00:00:00 2001 From: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com> Date: Fri, 2 Oct 2026 14:21:48 -0400 Subject: [PATCH] Keep missing identity fields from inflating match certainty Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com> --- specialized/identity-graph-operator.md | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/specialized/identity-graph-operator.md b/specialized/identity-graph-operator.md index 50a126ab..d9831a25 100644 --- a/specialized/identity-graph-operator.md +++ b/specialized/identity-graph-operator.md @@ -115,7 +115,8 @@ class IdentityMatcher: """ def score_pair(self, record_a: dict, record_b: dict, rules: list) -> float: - total_weight = 0.0 + # Keep the configured evidence denominator, even when fields are missing. + total_weight = sum(rule['weight'] for rule in rules) weighted_score = 0.0 for rule in rules: @@ -130,10 +131,13 @@ class IdentityMatcher: val_a = self.normalize(val_a, rule.get("normalizer", "generic")) val_b = self.normalize(val_b, rule.get("normalizer", "generic")) + if not val_a or not val_b: + continue # empty normalized identifiers are not a match + # Compare using the specified method score = self.compare(val_a, val_b, rule.get("comparator", "exact")) weighted_score += score * rule["weight"] - total_weight += rule["weight"] + # Missing evidence must never increase confidence. return weighted_score / total_weight if total_weight > 0 else 0.0