fix(ci): gate C++ coverage on lines only, drop branch coverage - #1028
Conversation
There was a problem hiding this comment.
Code Review
This pull request updates the codecov.yml configuration to disable branch detection for the gcov parser. This change prevents compiler-generated CFG arcs (such as exception-unwind edges, destructor/static-init arcs, and inlined STL branches) in C++ from dominating and skewing the branch coverage metrics. There are no review comments, and I have no feedback to provide.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1028 +/- ##
===========================================
+ Coverage 33.12% 55.42% +22.30%
===========================================
Files 230 230
Lines 33067 33067
Branches 13823 77 -13746
===========================================
+ Hits 10954 18329 +7375
+ Misses 14722 14713 -9
+ Partials 7391 25 -7366
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
|
Yes |
Pass --exclude-branches-by-pattern '.*' to the gcovr invocation that produces coverage-cpp.xml, removing every branch record from the Cobertura XML before it is uploaded under the `cpp` flag. Codecov then scores C++ on line coverage only. gcov branch data on compiled C++ counts compiler-generated CFG arcs (exception-unwind edges, destructor/static-init arcs, inlined STL branches) alongside author-written control flow. Those arcs cannot be exercised by ordinary tests, so they depress the branch percentage no matter how thoroughly the executed lines are tested. Stripping the records at report generation guarantees line-only scoring regardless of how Codecov parses the upload; a codecov.yml-side setting (parsers.gcov.branch_detection) would not work here because it only configures Codecov's parser for raw gcov-format text reports, not the Cobertura XML this workflow uploads. The Python report is generated separately by pytest-cov and keeps --cov-branch: coverage.py branches are real author-written control flow, so they remain part of the `python` flag's gate. Closes #932. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
373adb9 to
42fcb39
Compare
Problem
Codecov's
codecov/patchstatus gates C++ (cppflag) on both line and branch coverage. gcov/gcovr branch coverage for compiled C++ counts compiler-generated CFG arcs — exception-unwind edges, destructor/static-init arcs, inlined STL branches — alongside author-written control flow. Those arcs can't be exercised by ordinary tests, so a PR's branch percentage can stay low even when every patched line is fully executed (see #932 for the measured breakdown on #927).Fix
Option B from #932: strip branch records at the source. The gcovr invocation in
.github/workflows/ci-cmake_tests.ymlnow passes--exclude-branches-by-pattern '.*', so the Cobertura XML uploaded under thecppflag carries no branch data (branches-valid="0", every linebranch="false") and Codecov scores C++ on line coverage only.Option A from #932 (
parsers.gcov.branch_detectionincodecov.yml) was evaluated first on this PR and shown to be ineffective: that setting only configures Codecov's parser for raw gcov-format text reports, while this CI uploads gcovr-generated Cobertura XML, which goes through the Cobertura parser — the setting never takes effect (the initial Codecov report on this PR, with only the Option A change pushed, showed branch/partial counts unchanged at 13823/7391).cppflag): line coverage only.pythonflag): unchanged — pytest-cov still runs with--cov-branchand gates on both line and branch coverage, since coverage.py branches are real author-written control flow.Testing
branches-valid="4"with partials; with--exclude-branches-by-pattern '.*'it reportsbranches-valid="0"and every linebranch="false", while line coverage is identical.yaml.safe_loadpasses on the edited workflow file.cppflag) will be visible in this PR's own Codecov report once CI runs.Closes #932.