fix(confidence): pass multi_lens_observed kwarg to merge_confidence
This commit is contained in:
@@ -1855,8 +1855,25 @@ def test_merge_confidence_critical_drops_to_one():
|
||||
|
||||
|
||||
def test_merge_confidence_multi_lens_drops_extra():
|
||||
f = {"severity": "low", "_multi_lens": True}
|
||||
assert merge_confidence([f]) == 4
|
||||
# The flag has moved to a kwarg; passing `_multi_lens` on the dict is no
|
||||
# longer enough — the kwarg is the only path that drops the score.
|
||||
f = {"severity": "low"}
|
||||
assert merge_confidence([f], multi_lens_observed=True) == 4
|
||||
|
||||
|
||||
def test_merge_confidence_multi_lens_survives_normalization():
|
||||
"""Real flow: `_multi_lens` is set on the raw finding, but stripped by
|
||||
`_normalize_finding`. `merge_confidence(...)` with only the kwarg sees a
|
||||
normalized finding; the dedup must be triggered by `multi_lens_observed=`
|
||||
being true, not by reading `_multi_lens` off the dict."""
|
||||
raw = {"_multi_lens": True, "severity": "low", "path": "x", "line": 1,
|
||||
"problem": "p", "fix": "", "suggestion": "", "reference": ""}
|
||||
normalized = _normalize_finding(raw)
|
||||
assert "_multi_lens" not in normalized # confirms the strip
|
||||
# Now call merge_confidence the way review_pr will:
|
||||
assert merge_confidence([normalized], multi_lens_observed=True) == 4
|
||||
# And without the kwarg, the flag-on-dict path is gone:
|
||||
assert merge_confidence([normalized]) == 5
|
||||
|
||||
|
||||
def test_merge_confidence_clamped():
|
||||
|
||||
Reference in New Issue
Block a user