test(ci): gate PRs on changed-line coverage (#1418) - #1447
Merged
Conversation
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
Size Report
Startup median (7 runs, lower is better):
Top changed chunks: no changes in the largest emitted chunks. |
Member
|
Readiness review: clean. The gate uses the immutable PR base SHA, correctly joins added executable lines to lcov |
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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
Adds a changed-line coverage gate to the Coverage CI job (umbrella #1412 Track B). The gate joins the lcov report
pnpm test:coveragealready wrote withgit diff --unified=0 <base>...HEADand scores coverage of the contributor's own added lines only, failing when it drops below a single-source threshold. Closes #1418.New
scripts/coverage-changed/(mirrors thescripts/check-affected/split — puremodel.ts+ I/Orun.ts+ adjacent tests; parsing is hand-rolled to keep the repo dependency-free, matchingcheck-affected):< CHANGED_LINE_COVERAGE_THRESHOLD(70, declared once inmodel.ts) fails the job.pnpm check:coverage-changedreusescoverage/lcov.info; it never runs coverage a second time.DA:hits are 0).+lines count.+++ /dev/null(delete) and pure renames contribute nothing; a rename+edit's added lines are attributed to the destination path.allon, so every includablesrc/**/*.tsfile appears in lcov. The coverable universe is therefore read from lcov itself; an includable source file absent from lcov was dropped by an exclude glob. Test files are excluded too.coverage-waiverPR label setsAGENT_DEVICE_COVERAGE_WAIVER, which skips the failure but still prints every number to the job summary.BRDA) and the count of changed executable lines excluded from coverage (excluded paths +v8/c8/istanbul ignoredirectives), so exclusions cannot silently absorb new logic.Kept deliberately small: one markdown renderer feeds both stdout and
GITHUB_STEP_SUMMARY, and the CLI surface is just--base(waiver comes from the env var CI already sets).CI wiring in the Coverage job:
Core join (see
computeChangedCoverage):Testing
pnpm check:coverage-changed:test(17 cases: lcov/diff parsing incl. rename & delete, threshold pass/fail, waiver + job summary, docs-only n/a, excluded-path + ignore tallies, real-git end-to-end inrun.test.ts).pnpm format:check,pnpm lint,pnpm typecheck,pnpm check:fallowgreen on the diff.Link to Devin session: https://app.devin.ai/sessions/c5a4c346eb64422ba381d1d638932f7a
Requested by: @thymikee