Skip to content

fix(ci): gate C++ coverage on lines only, drop branch coverage - #1028

Merged
ianmccul merged 1 commit into
masterfrom
claude/issue-932-line-coverage-dud75w
Jul 10, 2026
Merged

fix(ci): gate C++ coverage on lines only, drop branch coverage#1028
ianmccul merged 1 commit into
masterfrom
claude/issue-932-line-coverage-dud75w

Conversation

@IvanaGyro

@IvanaGyro IvanaGyro commented Jul 9, 2026

Copy link
Copy Markdown
Member

Problem

Codecov's codecov/patch status gates C++ (cpp flag) 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.yml now passes --exclude-branches-by-pattern '.*', so the Cobertura XML uploaded under the cpp flag carries no branch data (branches-valid="0", every line branch="false") and Codecov scores C++ on line coverage only.

Option A from #932 (parsers.gcov.branch_detection in codecov.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).

  • C++ (cpp flag): line coverage only.
  • Python (python flag): unchanged — pytest-cov still runs with --cov-branch and gates on both line and branch coverage, since coverage.py branches are real author-written control flow.

Testing

  • Verified locally with gcovr 8.6 on a small C++ program with a throwing branch: without the flag the Cobertura XML reports branches-valid="4" with partials; with --exclude-branches-by-pattern '.*' it reports branches-valid="0" and every line branch="false", while line coverage is identical.
  • yaml.safe_load passes on the edited workflow file.
  • End-to-end effect (branch/partial counts dropping to 0 for the cpp flag) will be visible in this PR's own Codecov report once CI runs.

Closes #932.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

codecov Bot commented Jul 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 55.42%. Comparing base (9867285) to head (42fcb39).
✅ All tests successful. No failed tests found.

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     
Flag Coverage Δ
cpp 55.35% <ø> (+22.57%) ⬆️
python 61.84% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
C++ backend 53.20% <ø> (+19.29%) ⬆️
Python bindings 69.67% <ø> (+44.54%) ⬆️
Python package 61.84% <ø> (ø)
see 170 files with indirect coverage changes

Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9867285...42fcb39. Read the comment docs.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ianmccul

ianmccul commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

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>
@IvanaGyro
IvanaGyro force-pushed the claude/issue-932-line-coverage-dud75w branch from 373adb9 to 42fcb39 Compare July 9, 2026 19:13
@IvanaGyro
IvanaGyro marked this pull request as ready for review July 9, 2026 19:30
@ianmccul
ianmccul merged commit 93753bb into master Jul 10, 2026
21 of 22 checks passed
@ianmccul
ianmccul deleted the claude/issue-932-line-coverage-dud75w branch July 10, 2026 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI coverage: gate C++ on line coverage only (drop branch coverage); keep line + branch for Python

2 participants