Add coverage, complexity, and module-size gates - #17
Conversation
Add test-coverage, cyclomatic-complexity, and module-size enforcement in hooks and CI at thresholds just below current baselines. - scripts/coverage-check: scoped to src/github_usage; overall must stay >= 75% (current 76%); per-file baseline lock via coverage-baselines.json (grandfather existing low-coverage files, block them from dropping, require new files >= 82%); COVERAGE_TOLERANCE=1.0pp absorbs flaky runs. - scripts/coverage-baselines: regenerates the baseline lock file. - scripts/check-complexity: worst block CC <= 28 (current max); module size warns >= 575, blocks > 650 (current largest 562). - Wire both into scripts/check, pre-push hooks, and a new coverage CI job. - Add coverage/radon to dev extra; regenerate uv.lock. - Archive plan; drop completed TO_DO items; ignore coverage.json.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…v delta The macOS-generated coverage-baselines.json diverged from CI/Linux (e.g. setup_launchd.py 36.2% local vs 29.5% in CI), causing the per-file regression gate to fail in CI. - Reseed coverage-baselines.json from the CI coverage report (CI is the authoritative gate). - Raise COVERAGE_TOLERANCE default to 7.0pp to absorb the known macOS<->Linux delta for environment-volatile modules. - Document the CI-seeding approach in the archived plan.
The per-file regression lock (coverage-baselines.json) was environment-sensitive: macOS-generated baselines diverged from CI/Linux (e.g. setup_launchd.py 36.2% local vs 29.5% CI), failing CI. Replace it with a single portable gate: - Overall src coverage must stay >= 75% (COVERAGE_TOTAL_MIN). - New src files (not in committed tree) must meet 82% (COVERAGE_FILE_MIN), detected via git ls-tree HEAD. - Remove coverage-baselines.json and scripts/coverage-baselines. - Update CHANGELOG and archived plan.
Delete coverage-baselines.json and scripts/coverage-baselines, superseded by the simplified overall-coverage gate.
|



Summary
Adds test-coverage, cyclomatic-complexity, and module-size enforcement in hooks and CI at thresholds set just below current measured baselines.
src/github_usage; overall must stay ≥ 75% (current 76%). Per-file baseline lock viacoverage-baselines.json— existing low-coverage files are grandfathered at their current value and blocked from dropping, while new files must meet 82%.COVERAGE_TOLERANCE=1.0ppabsorbs flaky (non-deterministic) test runs so only real regressions fail.scripts/check, pre-push hooks, and a newcoverageCI job.coverage/radonadded to thedevextra;uv.lockregenerated.TO_DO.mditems removed;coverage.jsonadded to.gitignore.Verification
scripts/checkpasses (coverage 76% ≥ 75%, no per-file regressions, worst CC 28 ≤ 28, max module 562 ≤ 650).pre-commit validate-configanddocs-checkpass.🤖 Generated with Claude Code