ci(coverage): gate on patch coverage via Codecov, not global threshold - #763
Conversation
The global 97% vitest threshold was non-compositional: each PR was measured against a moving baseline, so the first PR to merge consumed the buffer above 97% and knocked every other open PR below the gate. Branches and functions were sitting at exactly 97.00% (zero buffer), so a single uncovered branch in any merge failed all in-flight PRs and forced everyone to re-sync and re-test. Move the 97% requirement to Codecov's patch (changed-lines) status, which depends only on a PR's own diff and is unaffected by what else merges: - vitest.config.ts: emit lcov; drop the hard 97% global thresholds to a loose 90% backstop (catastrophe net only, far below actual ~97-99%). - codecov.yml: patch target 97% (the real gate); project informational only. - ci.yml: upload coverage to Codecov (SHA-pinned v5.5.5); reword gate guidance. - CONTRIBUTING.md: document patch coverage; drop the "aim for 98% to absorb CI variance" band-aid. The 97% bar is unchanged for new code and arguably stricter: every PR must now test its own changes, instead of hiding undertested code behind a global buffer.
|
Note Gittensory Gate skippedPR closed before full evaluation. No late first comment was created.
💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers. |
|
Superagent didn't find any vulnerabilities or security issues in this PR. |
|
gittensory · advisory review Reviewed 4 changed file(s) — two independent AI reviewers. Changed files: Suggested action: ✅ Safe to merge — both reviewers found no blocking issues. Reviewer A · Suggestions
Worth double-checking
Reviewer B · Worth double-checking
|
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. Thanks for integrating Codecov - We've got you covered ☂️ |
Two follow-ups from the coverage-gate change (#763) and the duplicate hono advisory PRs (#760 from Renovate, #761 from Dependabot security updates): - prBodyNotes referenced the old "97% global coverage gate" that #763 replaced. Update it to describe the Codecov patch-coverage gate so Renovate stops stamping stale guidance on every dependency PR. - Record that Renovate is the sole dependency/security bot. GitHub Dependabot security updates has been disabled at the repo level (automated-security-fixes) so a single advisory no longer produces two PRs; Renovate's vulnerabilityAlerts continues to cover security advisories.
Two follow-ups from the coverage-gate change (#763) and the duplicate hono advisory PRs (#760 from Renovate, #761 from Dependabot security updates): - prBodyNotes referenced the old "97% global coverage gate" that #763 replaced. Update it to describe the Codecov patch-coverage gate so Renovate stops stamping stale guidance on every dependency PR. - Record that Renovate is the sole dependency/security bot. GitHub Dependabot security updates has been disabled at the repo level (automated-security-fixes) so a single advisory no longer produces two PRs; Renovate's vulnerabilityAlerts continues to cover security advisories.
Problem
The repo's 97% coverage gate was a global/project-total threshold in
vitest.config.ts. A global ratio is non-compositional: each open PR is measured against a moving baseline, so the first PR to merge consumes the buffer above 97% and knocks every other open PR below the gate — even PRs that changed nothing coverage-relevant. The result is constant churn: merge one PR, watch the rest go red, force everyone to re-sync and re-test.The current numbers prove it — branches and functions sit at exactly 97.00% (
13281/13691and3566/3676): zero buffer. A single uncovered branch in any merge failed all in-flight PRs.Fix
Move the 97% requirement to Codecov patch (changed-lines) coverage, which depends only on a PR's own diff and is immune to what else merges. The bar is unchanged for new code — arguably stricter, since every PR must now test its own changes rather than hiding undertested code behind a global buffer.
vitest.config.tslcov; drop hard 97% global thresholds to a loose 90% backstop (catastrophe net only — actual coverage is ~97–99%)codecov.yml(new)patchtarget 97% (the real gate);projectinformational (tracked, non-blocking).github/workflows/ci.ymlcodecov-action@v5.5.5); reword gate guidanceCONTRIBUTING.mdVerified locally
actionlintcleannpm run test:coveragepasses;coverage/lcov.infoemitted (92 files) at the path the upload step readsFollow-up (manual, after merge)
codecov/patchas a required status check in branch protection.main(CI checks out the PR head SHA, so a re-run alone isn't enough) — the same "sync with main" step that previously broke them now fixes them.Codecov app is installed and
CODECOV_TOKENis set.