fix(pr-review): test-detection + risk calibration — v0.19.1#8
Merged
Conversation
codegraph_pr_context classified a caller as a test only when its name matched test_*/*_test* or its path contained /tests/. Idiomatic Rust unit tests live in `#[cfg(test)] mod tests` with descriptive names (e.g. `weighted_mean_l2_math`, `loads_potion_f32_no_weights`), so they were invisible and every function they cover was reported as "0 coverage". The indexer already records `is_test` on each function node (from the language's #[test]/@test marker; helpers.rs:112). Read it via a new node_props::is_test accessor and prefer it over the name/path heuristics, which remain as a fallback for languages that don't populate the marker. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ir_to_graph wrote is_async/is_static/is_abstract but not is_test, so the graph never carried the marker the visitor already computes. Add it, plus a regression test that a #[test] fn with a descriptive name inside `#[cfg(test)] mod tests` sets is_test. NOTE: insufficient on its own — end-to-end pr_context still misreports coverage; is_test is not reaching the queried nodes in the real indexing pipeline (cause not yet isolated; not a cache artifact). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…overage Two calibration fixes to codegraph_pr_context: - Risk was `total_direct > 20 || untested > 5 → high`, so any sizeable PR tripped "high" purely on caller count — even when every change was body-only and broke nothing. Base risk instead on `breaking_callers` (callers of signature-changed functions) and the untested *ratio* (untested / functions_touched). Surface `breaking_callers` in JSON, the message, and the blast-radius line. - Callers under `examples/` and `benches/` exercise a function at runtime but were counted as breakable production callers, inflating blast radius and leaving example-driven code flagged as untested. Count them as coverage instead. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
🔍 CodeGraph PR Review9 files changed (+100/−24, 4 functions) · Risk: 🟡 medium Blast radius6 direct callers affected across
|
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
Calibration fixes to the
codegraph_pr_contextPR-review tool (the bot that comments on every PR), plus a partial parser fix. Prompted by the bot's own review of #7 misreporting coverage and risk.codegraph_pr_contexttest_*,/tests/), missing idiomatic Rust unit tests with descriptive names inside#[cfg(test)] mod tests. Now prefers theis_testnode property (falling back to the heuristics).direct_callers > 20 || untested > 5 → high, so any sizeable PR tripped "high" on raw caller count even for body-only changes that break nothing. Risk is now driven bybreaking_callers(callers of signature-changed functions) and the untested ratio.breaking_callersis surfaced in the JSON, message, and blast-radius line.examples/andbenches/exercise a function at runtime but were counted as breakable production callers (inflating blast radius, flagging eval-driven code as untested). They now count as coverage.Parser (partial)
ir_to_graphwroteis_async/is_static/is_abstractbut notis_test, so the graph never carried the marker the visitor computes. Added it, with a regression test for a descriptively-named#[test]inside#[cfg(test)] mod tests.is_teststill isn't reaching the queried nodes in the full indexing pipeline (root cause not yet isolated; not a cache artifact). Tracked as follow-up.Version bumped to 0.19.1.
🤖 Generated with Claude Code