Repository navigation
feat: inject static analysis context into review prompt (#140) - #145
Merged
Merged
Conversation
Add optional clippy output injection to reduce false positives: - New config: review.static_analysis.auto_clippy (run cargo clippy) - New config: review.static_analysis.clippy_output_file (read pre-computed) - New module: engine/static_analysis.rs with clippy runner + 5 tests - Prompt injects context between file paths and diff Zero-config — no behavior change when not configured. 229 tests pass, clippy clean, fmt clean. Closes #140 Co-Authored-By: codecoradev <noreply@github.com>
🔍 Cora AI Code Review❌ Blocked — critical issues found. 🔴 Error (2)
Review powered by cora-cli · BYOK · MIT |
1. UTF-8 safe truncation (is_char_boundary instead of byte slice) 2. block_in_place for async compatibility 3. 30-second timeout via thread + channel 4. Path traversal guard on clippy_output_file Co-Authored-By: codecoradev <noreply@github.com>
- Switch to wait_with_output() inside spawned thread (no stdout/stderr ownership ambiguity) - Apply cargo fmt Co-Authored-By: codecoradev <noreply@github.com>
- Wrap collect_static_context in block_in_place for async safety - Add unused_mut allow (child moved into thread) - Document process lifecycle on timeout Co-Authored-By: codecoradev <noreply@github.com>
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.
Summary
Reduce cora review false positives by injecting static analysis (clippy) context into the LLM prompt.
Problem: LLM flags intentional changes (dead code removal, match arm merges) as errors because it only sees the diff text — it doesn't know clippy/compiler already verified the change.
Solution: Optional static analysis context injection via two modes:
review.static_analysis.auto_clippy: true— automatically runcargo clippyand filter output to changed filesreview.static_analysis.clippy_output_file: path— read pre-computed clippy output from fileConfig example (.cora.yaml):
New files:
src/engine/static_analysis.rs— clippy runner, file reader, Rust file extraction (5 tests)Modified:
src/config/schema.rs—StaticAnalysisConfig,ReviewSection.static_analysissrc/engine/llm.rs—build_review_promptacceptsstatic_contextparamsrc/engine/review.rs— collects static context before LLM callZero-config: No behavior change when not configured.
Verification: 229 tests ✅ | clippy ✅ | fmt ✅
Closes #140
Co-Authored-By: codecoradev noreply@github.com