Repository navigation
Apply lifecycle test-gap exemptions to review guidance - #871
1 commit merged into
Conversation
code-review-graph reviewOverall risk: 0.65 (MEDIUM) — 11 changed function(s)/class(es), 0 affected flow(s), 4 test gap(s) Risk-scored changes
Test gaps
Token savings: this graph-backed report used ~17,432 fewer tokens (~88%) than reading every changed file in full (estimated, chars/4 approximation). Powered by code-review-graph — local-first analysis; no code leaves the CI runner. |
|
Changes required: a name-only lifecycle exemption suppresses coverage risk for production code. Run |
|
Checks pass and the code looks right. Missing: tests for the edge cases it introduces.
Every new branch in the code should have a test, including the failure branch. Disagree with any of these? Say so here first. PRs now target |
|
This no longer merges into
Worth knowing before you resolve:
git fetch origin
git merge origin/staging
# resolve, then
uv run pytest tests/ -q
uv run ruff check code_review_graph/
uv run mypy code_review_graph/ --ignore-missing-imports --no-strict-optional
git pushI have not reviewed the change itself yet. That comes once it merges and the checks run against the merged state, since staging has moved a long way and the result is what matters. |
|
Thank you for this PR. I checked the risk scores. I also ran the review tests with staging merged in. Before I can merge it, please fix these:
Please update your branch with the latest staging. There are conflicts in After you push the fix, I will test it again. |
There was a problem hiding this comment.
🟡 Changes recommended
The regression does not cover the separate minimal-context path, leaving the test-gap counting inconsistency able to recur undetected.
1 open issue
What changed in this PR
This PR aligns review-context coverage reporting and risk scoring with the lifecycle-method exemptions already used by change analysis, addressing #865.
Changes:
- Centralizes the lifecycle test-gap predicate for reuse across analysis and review guidance.
- Excludes exempt methods from minimal-context gap counts, guidance, and the coverage-related risk penalty.
- Adds guidance and risk-score regressions and updates existing exemption expectations.
| File | Description |
|---|---|
tests/test_pr865_review_guidance.py |
Adds regression coverage for lifecycle exemptions in guidance. |
tests/test_pr854_edges.py |
Updates lifecycle-only risk expectations. |
tests/test_changes.py |
Tests removal of the lifecycle coverage-risk penalty. |
code_review_graph/tools/review.py |
Applies exemptions to minimal gap counts and guidance. |
code_review_graph/changes.py |
Introduces the shared predicate and applies it to risk scoring and gap analysis. |
Review effort: Balanced
| if f.qualified_name not in tested_qualified | ||
| if ( | ||
| f.qualified_name not in tested_qualified | ||
| and not is_test_gap_exempt(f) |
0160eb0
…aces (review of tirth8205#871) The risk exemption matched on the name alone, so an untested ProductionService.__init__ lost its coverage risk. It now applies only to lifecycle methods in test code. Adds the get_review_context and all-exempt tests asked for in review, and names the module after what it pins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts: # code_review_graph/changes.py

Summary
detect_changesexempts lifecycle and construction methods from test-gap reporting, but the review surfaces still computed their own untested lists. This could reportsetUp,tearDown,__construct, and similar methods as coverage gaps even when change analysis correctly reported zero gaps.This change centralizes the lifecycle predicate and applies it consistently to:
Fixes #865.
Testing
pytest tests/test_changes.py tests/test_pr854_edges.py tests/test_pr865_review_guidance.py -q— 47 passedruff checkon all changed files — passesgit diff --check— passesA full Windows test run was also executed: 2,625 tests passed and 75 failed. The failures are in pre-existing Windows/path/encoding-sensitive areas unrelated to these files; the targeted change-related suites pass.