Repository navigation
fix(review): keep findings with non-numeric line fields - #3590
Conversation
PR Summary by QodoPreserve review findings with invalid line metadata
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
Code Review by Qodo
1.
|
|
Code review by qodo was updated up to the latest commit 2e40851 |
IsmaelMartinez
left a comment
There was a problem hiding this comment.
Thanks for filing #3589 with a clean reproduction and then fixing it, and for parametrising over both line fields when Qodo asked. Approving, which closes #3589.
Reverting utils.py underneath your tests turns the new cases red and leaves the rest green, so the drop was real and is now covered.
The gate also stops a line link being requested for missing or inverted ranges, which reads right, and nothing in the existing summary tests depended on that.
Fixes #3589
Problem
convert_to_markdown_v2(pr_agent/algo/utils.py:318-319) calledint(str(issue.get("start_line", 0)).strip())inside a per-findingtry/except Exception. When the model emitted a non-integer line field (empty string,N/A, a float,null, or a hyphenated range), theValueErrorwas caught and the entire finding was dropped from the published/reviewsummary with no user-visible error.The two sibling consumers of the same dict are tolerant and keep the finding:
pr_agent/tools/pr_reviewer.py:1263-1266(_build_key_issue_comment), inline comments.pr_agent/tools/pr_reviewer.py:648-651(_review_finding_from_issue), persisted finding state.So a "Possible security issue" could vanish from the summary while inline comments and the persistent state still recorded it, and the bookkeeping for later reviews diverged from what maintainers actually saw.
Fix
In
convert_to_markdown_v2, parsestart_line/end_linetolerantly (defaulting to0on non-numeric input, matching the sibling paths). When the lines are not usable (start_line < 1orend_line < start_line), the finding still renders in the summary with its header and content, but without a line anchor link or excerpt. Callingextract_relevant_lines_strandget_line_linkis gated onvalid_linesso no bogusR0anchor is produced.Tests
Added
test_key_issue_with_non_numeric_lines_keeps_finding_in_summaryintests/unittest/test_convert_to_markdown.py: a finding withstart_line: ""still renders header and content andget_line_linkis not called.Verification:
ruff checkand the pre-commit hooks are clean on the touched files.