fix: parseVerdict matches leniently + earliest phrase wins
Build & push image / build-and-push (push) Successful in 8s
Build & push image / build-and-push (push) Successful in 8s
A section that led with '**Blocking issues**' (no 'found') fell through to unknown, so the consolidated header wrongly read 'No material issues found' (seen live on gpt-oss). Now matches 'blocking issue'/'minor issue'/'no material issue' and picks the earliest-appearing phrase (the lead verdict). + tests. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -32,16 +32,25 @@ func (v verdict) label() string {
|
|||||||
// The base prompt tells each lens to lead with one of the three phrases.
|
// The base prompt tells each lens to lead with one of the three phrases.
|
||||||
func parseVerdict(out string) verdict {
|
func parseVerdict(out string) verdict {
|
||||||
l := strings.ToLower(out)
|
l := strings.ToLower(out)
|
||||||
switch {
|
// Match the EARLIEST-appearing verdict phrase (the lead verdict), and match
|
||||||
case strings.Contains(l, "blocking issues found"):
|
// leniently — models write "Blocking issues found", "**Blocking issues**",
|
||||||
return verdictBlocking
|
// "blocking issue", etc. (A strict "blocking issues found" check let a
|
||||||
case strings.Contains(l, "no material issues"):
|
// gpt-oss section that said "**Blocking issues**" fall through to unknown,
|
||||||
return verdictClean
|
// so the overall header wrongly read "No material issues found".)
|
||||||
case strings.Contains(l, "minor issues"):
|
best, bestIdx := verdictUnknown, -1
|
||||||
return verdictMinor
|
for _, c := range []struct {
|
||||||
default:
|
phrase string
|
||||||
return verdictUnknown
|
v verdict
|
||||||
|
}{
|
||||||
|
{"blocking issue", verdictBlocking},
|
||||||
|
{"minor issue", verdictMinor},
|
||||||
|
{"no material issue", verdictClean},
|
||||||
|
} {
|
||||||
|
if i := strings.Index(l, c.phrase); i >= 0 && (bestIdx == -1 || i < bestIdx) {
|
||||||
|
best, bestIdx = c.v, i
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return best
|
||||||
}
|
}
|
||||||
|
|
||||||
// specialistResult pairs a specialist with its rendered review and verdict.
|
// specialistResult pairs a specialist with its rendered review and verdict.
|
||||||
|
|||||||
@@ -114,6 +114,9 @@ func TestParseVerdictAndWorst(t *testing.T) {
|
|||||||
"VERDICT: No material issues found.": verdictClean,
|
"VERDICT: No material issues found.": verdictClean,
|
||||||
"Minor issues\n- nit": verdictMinor,
|
"Minor issues\n- nit": verdictMinor,
|
||||||
"**Blocking issues found**": verdictBlocking,
|
"**Blocking issues found**": verdictBlocking,
|
||||||
|
"**Blocking issues**\n- bug": verdictBlocking, // no "found" suffix
|
||||||
|
"VERDICT: Blocking issue\n- one": verdictBlocking, // singular
|
||||||
|
"No material issues found. There are no blocking issues.": verdictClean, // earliest phrase wins
|
||||||
"something unparseable": verdictUnknown,
|
"something unparseable": verdictUnknown,
|
||||||
}
|
}
|
||||||
for in, want := range cases {
|
for in, want := range cases {
|
||||||
|
|||||||
Reference in New Issue
Block a user