Fix run_correct reporting: show '-' when no tests exist#4
Conversation
Tier 2/3 problems have empty test_cases (vera run cannot pass string/ADT args via CLI). Previously _rate(0, 0) returned 0.0, making these tiers show 0% run_correct in reports -- misleading since no tests were run. Now _rate() returns None when the denominator is 0, and the report/CLI render None as -. This correctly distinguishes no tests exist from all tests failed. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis change makes metric rate fields nullable and propagates that sentinel ( Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes Suggested labels
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4 +/- ##
==========================================
- Coverage 59.97% 59.88% -0.09%
==========================================
Files 9 9
Lines 707 713 +6
==========================================
+ Hits 424 427 +3
- Misses 283 286 +3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@vera_bench/metrics.py`:
- Line 23: The check_rate field is annotated as float but can be None at runtime
(see assignments and _rate() returning float | None), so update its type
annotation to allow None (use float | None) where declared (the class/struct
field and any parameter/attribute declarations currently annotated as
check_rate: float). Also adjust the signatures/usages of _fmt_rate and _pct (or
add local guards in those functions) to accept Optional[float] (or handle None
early) to avoid calling methods on None; ensure _rate(), _fmt_rate(), and _pct()
types are consistent with check_rate being float | None.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 06e236c1-37a3-4bf4-b042-9c9e56a06ad8
📒 Files selected for processing (5)
.gitignoretests/test_runner.pyvera_bench/cli.pyvera_bench/metrics.pyvera_bench/report.py
CodeRabbit correctly identified that check_rate was annotated as float but _rate() can return None (when denominator is 0). Also fix the per-tier display in _print_metrics to use _fmt_rate() for None safety. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
test_cases(vera run can't pass string/ADT args via CLI). Previously_rate(0, 0)returned0.0, making these tiers show0% run_correct— misleading since no tests were run._rate()returnsNonewhen denominator is 0, rendered as-in reports and CLI.results/*.jsonlandresults/summary.mdto.gitignore(generated artifacts).Test plan
Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests
Chores