feat: normalize deterministic analysis findings #13
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
nimmo/forgejo-auto-pr-review!13
Loading…
Reference in a new issue
No description provided.
Delete branch "issue-4-normalize-analysis"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Implements #4.
Validation:
python3 -W error::ResourceWarning -m unittest discover -s tests(26 passing).Automated code review
Reviewed commit:
899f6f955ed9334b65ac57aae967db5a52a46f15Verdict: Requires further work
Resolve the blocking or important findings and investigate failed deterministic checks before merging.
Overall assessment
The pull request introduces structured parsing and deduplication of deterministic diagnostics from check outputs. Key changes include new Diagnostic/CheckResult dataclasses, parse_diagnostics() function with regex-based line parsing, render_checks() for improved output rendering, and deduplicate_findings() to suppress model findings matching known diagnostics.
Blocking findings
DIAGNOSTIC_LINE = re.compile(
r"^(?P(?:[A-Za-z]:)?[^:\n]+):(?P\d+)(?::\d+)?:\s*(?:(?Perror|warning|info|fatal):\s*)?(?P.+)$",
re.I,
)
Impact: Paths containing colons (e.g., 'C:\repo:dir\file.py') will be misparsed because the regex uses '[^:\n]+' for path, causing incorrect splitting at the first colon after drive letter or within directory names.
Suggested fix: Refactor DIAGNOSTIC_LINE to require line number before optional column and use non-greedy matching: r'^(?P(?:[A-Za-z]:)?[^:\n]+?):(?P\d+)(?::(?P\d+))?:(?:\s*(?Perror|warning|info|fatal):\s*)?(?P.+)$'
Important findings
duplicate_check = any(
finding.get("path") == path and (not finding.get("line") or not line or finding["line"] == line)
and evidence and diagnostic and evidence == diagnostic
for path, line, diagnostic in known
)
Impact: Model findings may incorrectly be retained when they match deterministic diagnostics only partially (e.g., same file/line but different wording), leading to redundant or misleading output.
Suggested fix: Normalize both the model finding's evidence and the diagnostic message before comparison, e.g., using normalized_text() on both sides of 'evidence == diagnostic'.
Suggestions
None.
Tests and validation
Questions
Review limitations
Review metadata