Skip to content

Commit 9e2320e

Browse files
wesmclaude
andauthored
Strip markdown formatting in verdict parsing (#72)
## Summary - Add `stripMarkdown()` function to remove bold (`**`), underscore bold (`__`), and header markers (`##`, `###`, etc.) before checking for pass indicators - Fixes false negatives when AI outputs `**No issues found.**` with markdown bold formatting Fixes #70 ## Test plan - [x] Added test cases for bold, underscore bold, and header formatted "No issues found" - [x] All existing verdict parsing tests pass 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 57a1f6a commit 9e2320e

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

internal/storage/jobs.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ func ParseVerdict(output string) string {
1515
// Normalize curly apostrophes to straight apostrophes (LLMs sometimes use these)
1616
trimmed = strings.ReplaceAll(trimmed, "\u2018", "'") // left single quote
1717
trimmed = strings.ReplaceAll(trimmed, "\u2019", "'") // right single quote
18+
// Strip markdown formatting (bold, italic, headers)
19+
trimmed = stripMarkdown(trimmed)
1820
// Strip leading list markers (bullets, numbers, etc.)
1921
trimmed = stripListMarker(trimmed)
2022

@@ -36,6 +38,23 @@ func ParseVerdict(output string) string {
3638
return "F"
3739
}
3840

41+
// stripMarkdown removes common markdown formatting from a line
42+
func stripMarkdown(s string) string {
43+
// Strip leading markdown headers (##, ###, etc.)
44+
for strings.HasPrefix(s, "#") {
45+
s = strings.TrimPrefix(s, "#")
46+
}
47+
s = strings.TrimSpace(s)
48+
49+
// Strip bold/italic markers (**, __, *, _)
50+
// Handle ** and __ first (bold), then * and _ (italic)
51+
s = strings.ReplaceAll(s, "**", "")
52+
s = strings.ReplaceAll(s, "__", "")
53+
// Don't strip single * or _ as they might be intentional (e.g., bullet points handled separately)
54+
55+
return strings.TrimSpace(s)
56+
}
57+
3958
// stripListMarker removes leading bullet/number markers from a line
4059
func stripListMarker(s string) string {
4160
// Handle: "- ", "* ", "1. ", "99) ", "100. ", etc.

internal/storage/verdict_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,32 @@ func TestParseVerdict(t *testing.T) {
8484
output: "100. No issues found.",
8585
want: "P",
8686
},
87+
// Markdown formatting
88+
{
89+
name: "bold no issues found",
90+
output: "**No issues found.**",
91+
want: "P",
92+
},
93+
{
94+
name: "bold no issues in sentence",
95+
output: "**No issues found.** The code looks good.",
96+
want: "P",
97+
},
98+
{
99+
name: "markdown header no issues",
100+
output: "## No issues found",
101+
want: "P",
102+
},
103+
{
104+
name: "markdown h3 no issues",
105+
output: "### No issues found.",
106+
want: "P",
107+
},
108+
{
109+
name: "underscore bold no issues",
110+
output: "__No issues found.__",
111+
want: "P",
112+
},
87113
{
88114
name: "no tests failed is pass",
89115
output: "No issues found; no tests failed.",

0 commit comments

Comments
 (0)