-
Notifications
You must be signed in to change notification settings - Fork 0
fix: empty ISSUES_FOUND verdict treated as LGTM #5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| import { describe, it, expect } from "vitest"; | ||
| import { parseVerdict, cleanReviewText, isLgtmResult } from "./reviewer"; | ||
|
|
||
| describe("reviewer verdict parsing", () => { | ||
| it("parseVerdict extracts LGTM", () => { | ||
| expect(parseVerdict("some text <verdict>LGTM</verdict> more")).toBe("lgtm"); | ||
| }); | ||
|
|
||
| it("parseVerdict extracts ISSUES_FOUND", () => { | ||
| expect(parseVerdict("<verdict>ISSUES_FOUND</verdict>")).toBe("issues"); | ||
| }); | ||
|
|
||
| it("parseVerdict returns null when no tag", () => { | ||
| expect(parseVerdict("no verdict here")).toBeNull(); | ||
| }); | ||
|
|
||
| it("isLgtmResult returns true for empty text", () => { | ||
| expect(isLgtmResult("")).toBe(true); | ||
| expect(isLgtmResult(" ")).toBe(true); | ||
| }); | ||
|
|
||
| it("isLgtmResult returns false when severity markers present", () => { | ||
| expect(isLgtmResult("- **High:** something bad")).toBe(false); | ||
| expect(isLgtmResult("- **Medium:** fix this")).toBe(false); | ||
| }); | ||
|
|
||
| it("isLgtmResult returns true for explicit LGTM text", () => { | ||
| expect(isLgtmResult("LGTM — looks good")).toBe(true); | ||
| }); | ||
|
|
||
| it("cleanReviewText strips verdict tags", () => { | ||
| const raw = "Some findings\n<verdict>ISSUES_FOUND</verdict>"; | ||
| expect(cleanReviewText(raw)).toBe("Some findings"); | ||
| }); | ||
|
|
||
| it("empty cleanedText with ISSUES_FOUND verdict should be treated as LGTM", () => { | ||
| // This tests the bug where model returns <verdict>ISSUES_FOUND</verdict> | ||
| // with no actual findings text — resulting in confusing "found potential issues:" + nothing | ||
| const raw = "<verdict>ISSUES_FOUND</verdict>"; | ||
| const cleaned = cleanReviewText(raw); | ||
| expect(cleaned).toBe(""); | ||
| // The fix: verdict=issues + empty cleaned = treat as LGTM | ||
| // (tested at integration level in reviewer.ts line ~395) | ||
| expect(isLgtmResult(cleaned)).toBe(true); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not convert an explicit
ISSUES_FOUNDverdict into LGTM based oncleanedTextbeing empty. InrunReviewSession, if the reviewer outputs only<verdict>ISSUES_FOUND</verdict>(which can happen with truncated/minimal responses), this branch now marks the result as LGTM and the orchestrator will skip the remediation loop, silently dropping a reported failure. This change weakens the explicit machine-readable contract fromparseVerdict; keepverdict === "issues"as non-LGTM and handle empty-body UX separately in message formatting.Useful? React with 👍 / 👎.