Commit 6426d26
authored
Fix reviewer suggestion confidence for sole experts (#4905)
## Why
The `suggest-reviewers` GitHub Action had two issues:
1. When a single person was the sole contributor to all changed files,
confidence was reported as "low" instead of "high". This happened
because `compute_confidence` treated `len(ss) < 2` as insufficient data,
when it actually means there's one clear expert.
2. Output files (`out.*`, `output.txt`) were scored `0.0` and completely
excluded from analysis. Reviewers should still verify output changes
make sense, so these files deserve a small (but non-zero) contribution
to scoring.
## Changes
**Before:** Sole-author PRs always got "low" confidence. Output files
were invisible to the scoring algorithm. PRs with exactly 2 contributors
also always got "low" confidence (the `>= 3` guards prevented any
comparison).
**Now:**
- `len(ss) == 1` (sole contributor) returns "high" confidence
- `len(ss) == 2` compares top vs second using the same 2x/1.5x
thresholds
- Output files get weight `0.01 / total_files` instead of `0.0`,
contributing signal without dominating scores
- Removed dead `if weight == 0.0` guard that could never trigger after
the weight change
## Test plan
- Verified against PR #4857 (4 files, 2 output, pietern sole author):
would now produce "high" instead of "low"
- Logic review of all `compute_confidence` branches for correctness
This pull request was AI-assisted by Isaac.1 parent 6a0ddd8 commit 6426d26
1 file changed
+17
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| 116 | + | |
116 | 117 | | |
117 | | - | |
118 | | - | |
119 | | - | |
| 118 | + | |
120 | 119 | | |
121 | 120 | | |
122 | 121 | | |
| |||
165 | 164 | | |
166 | 165 | | |
167 | 166 | | |
168 | | - | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
169 | 178 | | |
170 | | - | |
| 179 | + | |
171 | 180 | | |
172 | | - | |
| 181 | + | |
173 | 182 | | |
174 | 183 | | |
175 | 184 | | |
| |||
0 commit comments