fix: reduce false positives in SARIF review - #510
Merged
Conversation
- Add context line filter: drop Minor/Info findings on unchanged diff lines (pre-existing code flagged as new issue) - Enhanced system prompt: in-place mutation awareness (Vec::retain etc.) and error path vs happy path distinction - Import Severity type for filter comparison
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What
Three improvements to reduce false positives in cora's review output:
Context line filter — Drops
MinorandInfofindings on unchanged (context/removed) diff lines. These are pre-existing code that appeared in the diff due to surrounding changes, not new code introduced by the PR.Enhanced system prompt — Added
LANGUAGE-SPECIFIC FALSE POSITIVE AWARENESSsection to the review system prompt:Vec::retain,Vec::append,Vec::sort, etc.) should not be flagged as "result ignored"Err => return) should not be flagged for missing happy-path post-conditionsSARIF non-blocking — Fixed
cora-review-action(separate PR) soCheck for blocking issuesstep respectsupload-sarif: 'false'input.Why
Issue #507 identified recurring false positive patterns:
These false positives erode developer trust in automated review and create noise that masks real issues.
How
apply_context_line_filter()inreview.rs: builds(file, line) -> DiffLineTypelookup from parsed diff chunks, then retains only findings onAddlines (orCritical/Majoron any line)llm.rs: explicit Rust mutation method list + error path guidancecora-review-action/action.yml: gate blocking check behindupload-sarif == 'true'Testing
cargo build— cleancargo test— 22/22 pass (16 unit + 6 config)cargo clippy— 0 warningscargo fmt --check— cleanRelated Issues
Fixes #507
Checklist
cargo fmt)