Report coverage in CI, and count only what a test can reach - #75
Merged
Conversation
The coverage script has existed since it was written, but nothing ran it, so the number never reached a pull request. The gate's own test run now carries the collector — one test run, not a second one for the number — and an advisory Coverage job judges the lines the change touched and writes the verdict, the project totals and a per-file table to the run's summary page. coverage.runsettings is what the collector is allowed to count, and both CI and scripts/coverage.sh pass it, so a local number and a pipeline number mean the same thing. Out of it: UI and Web by module and .razor / .razor.cs by file, since a component's lines are only reachable by rendering it and tests/ui and visual-check.sh are what do that; the scaffolded migrations and the model snapshot, which were the bulk of what was being counted; and DesignTimeDbContextFactory, which exists for `dotnet ef`. Core reads 95.1% over 2,152 lines instead of 96.4% over 9,960 — the same suite, measured against code somebody wrote. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Szkd8DVfKLiQQXEPuC3wYx
The runsettings excluded CompilerGeneratedAttribute alongside coverlet's actual defaults, on the assumption it only strips lambdas and iterator state machines. It also marks every async method body and every auto-property, so it was taking ServiceOperation.RunAdminAsync — the write guard every service call goes through — and most of DatabaseSafety out of the report along with the scaffolding it was meant to exclude. Core now reads 93.3% over 2,509 lines rather than the 95.1% over 2,152 a prior pass reported; the difference is real hand-written code the collector was silently dropping. coverage.mjs had the same shape of bug: a changed Core file the report doesn't mention at all — because runsettings excluded it by attribute, not because coverage.mjs's own EXCLUDED list knew its name — fell through to the same silent `continue` as a diff hunk that only touched a blank line. It's now named under the table as excluded, same as a migration. Also make a malformed or unexpected Cobertura header fail loudly rather than read as a trivial 100% branch coverage from pct(0, 0). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Szkd8DVfKLiQQXEPuC3wYx
…ci-pipeline-kfe190
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.
The coverage script has existed since it was written, but nothing ran it, so
the number never reached a pull request. The gate's own test run now carries
the collector — one test run, not a second one for the number — and an
advisory Coverage job judges the lines the change touched and writes the
verdict, the project totals and a per-file table to the run's summary page.
coverage.runsettings is what the collector is allowed to count, and both CI
and scripts/coverage.sh pass it, so a local number and a pipeline number mean
the same thing. Out of it: UI and Web by module and .razor / .razor.cs by
file, since a component's lines are only reachable by rendering it and
tests/ui and visual-check.sh are what do that; the scaffolded migrations and
the model snapshot, which were the bulk of what was being counted; and
DesignTimeDbContextFactory, which exists for
dotnet ef. Core reads 95.1%over 2,152 lines instead of 96.4% over 9,960 — the same suite, measured
against code somebody wrote.
Co-Authored-By: Claude Opus 5 noreply@anthropic.com
Claude-Session: https://claude.ai/code/session_01Szkd8DVfKLiQQXEPuC3wYx