Skip to content

Commit 474d646

Browse files
skwowetclaude
andcommitted
fix: guard against NaN in confidenceScore and fix Query 8 comment (CM-1137)
- Replace `??` with explicit isFinite check so NaN from edit-distance calc (identityLength=0, smallestEditDistance=null) does not propagate as confidenceScore — falls back to HIGH_CONFIDENCE_SCORE instead - Correct Query 8 comment: noreplyEmailUsernameMatches is populated only inside the verified-identity branch, not for unverified identities Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 76769fe commit 474d646

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

services/apps/merge_suggestions_worker/src/activities/memberMergeSuggestions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ export async function getMemberMergeSuggestions(
217217
}),
218218
},
219219
{
220-
// Query 8: Noreply/private email -> username (verified or unverified)
220+
// Query 8: Noreply email -> platform username (verified identities only)
221221
matches: uniqBy(noreplyEmailUsernameMatches, (m) => `${m.platform}:${m.value}`),
222222
builder: ({ value, platform }) => ({
223223
bool: {

services/apps/merge_suggestions_worker/src/memberSimilarityCalculator.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -467,7 +467,10 @@ class MemberSimilarityCalculator {
467467
// displayName equality (startingScore omitted) is itself a high-confidence signal — don't
468468
// gate on metadata. Edit-distance callers pass a score and must have at least one signal.
469469
let isHighConfidence = startingScore === undefined
470-
let confidenceScore = startingScore ?? this.HIGH_CONFIDENCE_SCORE
470+
let confidenceScore =
471+
startingScore != null && Number.isFinite(startingScore)
472+
? startingScore
473+
: this.HIGH_CONFIDENCE_SCORE
471474

472475
const bumpFactor = (1 - confidenceScore) / 5
473476

0 commit comments

Comments
 (0)