Skip to content

fix(ci): use cargo-llvm-cov properly for Python SDK coverage in Codecov#2867

Merged
hubcio merged 3 commits intoapache:masterfrom
atharvalade:fix/ci-python-sdk-coverage-llvm-cov
Mar 4, 2026
Merged

fix(ci): use cargo-llvm-cov properly for Python SDK coverage in Codecov#2867
hubcio merged 3 commits intoapache:masterfrom
atharvalade:fix/ci-python-sdk-coverage-llvm-cov

Conversation

@atharvalade
Copy link
Contributor

@atharvalade atharvalade commented Mar 4, 2026

Which issue does this PR close?

Closes #2866

Rationale

The Python SDK is built with maturin/PyO3, so all business logic is compiled Rust. The previous two attempts (PR #2790 with pytest-cov, PR #2817 with manual llvm-cov) both failed: pytest-cov cannot measure Rust code, and the manual llvm-cov approach produced 0% coverage due to missing CARGO_TARGET_DIR centralization and LCOV source paths relative to the crate root instead of the repo root.

What changed?

Coverage reports were empty because raw llvm-profdata/llvm-cov export produced paths like src/client.rs while Codecov expected foreign/python/src/client.rs under the python flag. Dependency code from core/sdk also leaked into the report with no filtering.

The fix rewrites both post-merge and pre-merge coverage pipelines to use cargo-llvm-cov properly (matching the existing Rust coverage job pattern and the cjermain/rust-python-coverage reference). It sources env vars via cargo llvm-cov show-env, centralizes CARGO_TARGET_DIR, drops --release from maturin develop, generates LCOV with cargo llvm-cov report, filters dependencies with --ignore-filename-regex, and fixes paths with sed.

Local Execution

  • Passed
  • Pre-commit hooks ran

AI Usage

  1. Opus 4.6
  2. research, planning
  3. Verified by reviewing against the cjermain/rust-python-coverage reference repo, cross-checking env var safety with the existing Rust coverage job, and confirming Codecov path matching with codecov.yml flag configuration
  4. Yes

@atharvalade atharvalade force-pushed the fix/ci-python-sdk-coverage-llvm-cov branch from e262f64 to cc964ae Compare March 4, 2026 18:45
@codecov
Copy link

codecov bot commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 68.40%. Comparing base (62f7256) to head (252633a).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #2867      +/-   ##
============================================
+ Coverage     67.85%   68.40%   +0.54%     
  Complexity      739      739              
============================================
  Files          1052     1052              
  Lines         84635    84635              
  Branches      61213    61224      +11     
============================================
+ Hits          57432    57892     +460     
+ Misses        24833    24363     -470     
- Partials       2370     2380      +10     
Flag Coverage Δ
csharp 67.43% <ø> (-0.19%) ⬇️
go 6.33% <ø> (ø)
java 54.83% <ø> (ø)
node 92.26% <ø> (-0.15%) ⬇️
python 81.57% <ø> (+81.57%) ⬆️
rust 70.08% <ø> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 24 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@atharvalade atharvalade force-pushed the fix/ci-python-sdk-coverage-llvm-cov branch from cc964ae to c2ff331 Compare March 4, 2026 19:19
@atharvalade
Copy link
Contributor Author

pls check there's 2 flaky tests

@hubcio hubcio merged commit 13ff0f5 into apache:master Mar 4, 2026
74 checks passed
kriti-sc pushed a commit to kriti-sc/iggy that referenced this pull request Mar 6, 2026
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.

fix(ci): use cargo-llvm-cov properly for Python SDK coverage in Codecov

3 participants