The Coverage row is silently missing from every Quality Report
Found while diagnosing an unrelated E2E failure on softwarecatalog
(ConductionNL/softwarecatalog#539). Present in both the push and the
pull_request run of sha 68202d5b, and there is no reason it would be
repo-specific.
In .github/workflows/quality.yml, the report step does roughly:
TOTAL_STMTS=$(grep -oPm1 'statements="\K[0-9]+' coverage/clover.xml || echo "0")
...
[ "$TOTAL_STMTS" -gt 0 ] && ...
-m1 stops after the first matching line, but -o prints every match on
that line. clover.xml carries more than one statements="…" attribute on the
same line, so TOTAL_STMTS is multi-line — 512\n0 in the observed run.
The comparison then errors and the Coverage line is dropped from the report:
/home/runner/work/_temp/….sh: line 186: [: 512
0: integer expression expected
Why this matters more than it looks
The job does not fail. The report renders, every other row is present, and
the only trace is one [: integer expression expected line buried in the log.
A coverage number that is never computed looks exactly like a coverage number
that had nothing to report — this is a measurement that quietly does not happen.
Suggested fix
Take the first match only, and make the guard robust to an empty value:
TOTAL_STMTS=$(grep -oPm1 'statements="\K[0-9]+' coverage/clover.xml | head -n1)
TOTAL_STMTS=${TOTAL_STMTS:-0}
⚠️ Worth checking at the same time whether the first match on that line is
actually the project-level total rather than a per-file figure — if it is not,
head -n1 fixes the crash while still reporting the wrong number, which is the
worse outcome. An xmllint --xpath read of /coverage/project/metrics/@statements
would be unambiguous.
Not verified by me
I did not run this fix; I only read the log and the script. Flagging it so
whoever owns the shared quality pipeline can confirm against a real
clover.xml.
The Coverage row is silently missing from every Quality Report
Found while diagnosing an unrelated E2E failure on softwarecatalog
(ConductionNL/softwarecatalog#539). Present in both the push and the
pull_request run of sha
68202d5b, and there is no reason it would berepo-specific.
In
.github/workflows/quality.yml, the report step does roughly:-m1stops after the first matching line, but-oprints every match onthat line.
clover.xmlcarries more than onestatements="…"attribute on thesame line, so
TOTAL_STMTSis multi-line —512\n0in the observed run.The comparison then errors and the Coverage line is dropped from the report:
Why this matters more than it looks
The job does not fail. The report renders, every other row is present, and
the only trace is one
[: integer expression expectedline buried in the log.A coverage number that is never computed looks exactly like a coverage number
that had nothing to report — this is a measurement that quietly does not happen.
Suggested fix
Take the first match only, and make the guard robust to an empty value:
actually the project-level total rather than a per-file figure — if it is not,
head -n1fixes the crash while still reporting the wrong number, which is theworse outcome. An
xmllint --xpathread of/coverage/project/metrics/@statementswould be unambiguous.
Not verified by me
I did not run this fix; I only read the log and the script. Flagging it so
whoever owns the shared quality pipeline can confirm against a real
clover.xml.