#1676

fix(report): keep a dedupe confidence inside its documented range

Openlxcxjxhxwants to merge intofrom

Fixes #1675

_parse_dedupe_response validated is_duplicate and duplicate_id, but passed confidence through untouched: "nan" became nan, "inf" became inf, -3 and 99 stayed out of range. The prompt documents "confidence is a number between 0 and 1" (dedupe.py:133) and the value reaches callers and %.2f logging, where NaN defeats every comparison it meets.

A non-finite or out-of-range answer now lands in the documented range: NaN (unordered, so nothing can be decided from it) becomes 0.0, and a finite value is clamped to [0, 1].

Validation: pytest tests/test_dedupe_decisions.py -q -> 25 passed, with the new parametrised cases covering nan, inf, -inf, -3, 99, "0.5" and 0.42.

inputbeforeafter
"nan"nan0.0
"inf"inf1.0
-3-3.00.0
9999.01.0
"0.5", 0.42unchangedunchanged

ruff check + format clean. The model's answer is untrusted input at a parser boundary, which is why this is a validation fix rather than a prompt tweak.

Activity

2
greptile-apps[bot]1d ago

Confidence Score: 5/5

[Medium impact] This PR appears safe to merge.

Summary

_parse_dedupe_response now keeps confidence within its documented range.

  • Deduplication confidence stays within its documented 0–1 range.

No actionable issues found. Tests were reviewed but not run.

Reviews (1) · Last reviewed commit: "fix(report): keep a dedupe confidence in..." · Reviewed by Greptile