Repository navigation
Commit f3e1253
committed
ci(coverage): compare the parse-coverage gate against the merge base (#963)
The gate failed a pull request on the state of the report, not on the
change the pull request made. Check 4 compared parse_partial_count
against a number checked into scripts/ci/parse-partial-baseline.txt, and
checks 1-3 asserted zero findings outright. Any of the four could go red
for something main did.
That is not theoretical. #1972 was this exact thing: main gained
src/daemon/runtime.c, the count went 58 -> 59 on its own, and the number
had to be raised by hand. #1824 will do it again and larger. Blazor
.razor files map to C#, their markup lands in ERROR regions by design,
and the count rises by roughly the repo's .razor count. A coverage
improvement would read as a gate failure on an unrelated branch, and the
person who hit it would have no way to tell that from a real regression.
The gate now resolves the base commit, checks it out into a temporary
worktree, and indexes both trees with the same binary. All four checks
compare the two:
1. a whole-file parse failure fails only when it is new at head
2. a "+N" clipping marker fails only when it is new at head
3. a range over 25% of its file fails only when the file was within
the share at the base
4. the flagged-file count fails only when it is above the base's
parse-partial-baseline.txt stops being a gate. The script still prints
the recorded number so a reader can see the drift, and says plainly that
nothing fails on it. Nobody has to raise that number again.
What this cannot see: both trees are indexed with the same binary, so a
branch that changes the extractor itself moves the base side and the
head side together and this gate will not fail on it. Catching that
needs the base commit's own binary, which means a second full build --
about twelve minutes against the twenty-six seconds the whole gate step
takes. Two things still cover it: the FLOOR asserted in
tests/test_index_resilience.c stops the signal being switched off, and
the absolute counts for both sides now print on every run, so a jump is
visible in the log even when it does not fail. The script header and the
scripts/ci/README.md row both say so.
tests/test_coverage_gate_contract.sh pins the behaviour. It drives the
production script with a fake binary that prints canned JSON, so no seam
is added to the script itself and no indexing happens. Fifteen cases:
each of the four findings present at both sides (pass) and new at head
(fail), the count equal to, below and above the base, the recorded
number not gating, both sides printing, a clipped file list still
stopping the run outright, the allowlist skipping a path, and an
unresolvable base commit stopping the run.
Verified by reverting each of the four comparisons one at a time and
confirming the matching "present at both sides" case goes red, then
restoring. A real run against a built binary passes with both sides
reported, and takes 45s for two indexes.
pr.yml passes COVERAGE_GATE_BASE_SHA so the gate uses the commit GitHub
itself used to build the merge, rather than falling back to the first
parent of HEAD.
Refs #963, #1972
Signed-off-by: Joshua Richter <jrichter5781@gmail.com>1 parent 8ae5eac commit f3e1253
6 files changed
Lines changed: 456 additions & 94 deletions
File tree
- .github/workflows
- scripts
- ci
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| |||
134 | 134 | | |
135 | 135 | | |
136 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
137 | 143 | | |
138 | 144 | | |
139 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
7 | 18 | | |
8 | 19 | | |
9 | 20 | | |
| |||
0 commit comments