Skip to content

fix: expand CI coverage to full malariagen_data package and update codecov action#1302

Open
kunal-10-cloud wants to merge 7 commits intomalariagen:masterfrom
kunal-10-cloud:fix/issue-1301-ci-coverage-blind-spots
Open

fix: expand CI coverage to full malariagen_data package and update codecov action#1302
kunal-10-cloud wants to merge 7 commits intomalariagen:masterfrom
kunal-10-cloud:fix/issue-1301-ci-coverage-blind-spots

Conversation

@kunal-10-cloud
Copy link
Copy Markdown
Contributor

Summary

Fixes #1301

The coverage.yml workflow had two blind spots:

  1. Incomplete coverage scope — The --cov flag targeted only malariagen_data/anoph, completely excluding coverage measurement for all root-level modules:

    • Species-specific entry points: ag3.py, af1.py, adir1.py, amin1.py, adar1.py
    • Plasmodium modules: pf7.py, pf8.py, pf9.py, pv4.py, plasmodium.py
    • Variant effect annotation: veff.py
    • Shared utilities: util.py
    • Other modules: plotly_dendrogram.py, anopheles.py, mjn.py, amino_acid_distance.py
  2. Outdated Codecov action — The workflow used codecov/codecov-action@v3 while v4 has been available since early 2024 with security improvements.

Changes

  • Line 24: Changed --cov malariagen_data/anoph--cov malariagen_data so pytest-cov measures coverage across the entire package, not just the anoph/ subpackage.
  • Line 27: Updated codecov/codecov-action@v3codecov/codecov-action@v4 for security fixes and latest features.

Why This Matters

Expected Impact

  • Coverage reports will now reflect the full malariagen_data/ package on both pushes to master and pull requests.
  • Regressions in Plasmodium, variant effect, and utility code will be caught before merge.
  • Codecov action updated to v4 for improved security.

Test Plan

  • YAML syntax validated
  • CI coverage workflow runs successfully on this PR
  • Codecov report shows coverage for previously excluded modules (e.g., plasmodium.py, veff.py, util.py)

Copilot AI review requested due to automatic review settings April 15, 2026 17:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Expands the CI coverage workflow to measure test coverage across the entire malariagen_data package (not just the anoph/ subpackage) and updates the Codecov GitHub Action to the latest major version, addressing the coverage blind spot described in #1301.

Changes:

  • Update pytest-cov scope from malariagen_data/anoph to malariagen_data.
  • Bump Codecov upload action from codecov/codecov-action@v3 to @v4.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 15, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 83.08%. Comparing base (06563cf) to head (a1ff567).
⚠️ Report is 14 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1302      +/-   ##
==========================================
- Coverage   88.88%   83.08%   -5.80%     
==========================================
  Files          56       75      +19     
  Lines        6439     8526    +2087     
==========================================
+ Hits         5723     7084    +1361     
- Misses        716     1442     +726     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kunal-10-cloud kunal-10-cloud force-pushed the fix/issue-1301-ci-coverage-blind-spots branch from b13f85a to 986368d Compare April 15, 2026 20:02
…ov action

- Changed --cov target from malariagen_data/anoph to malariagen_data so
  coverage measurement includes all root-level modules (ag3.py, af1.py,
  plasmodium.py, veff.py, util.py, etc.) that were previously excluded
- Updated codecov/codecov-action from v3 to v4 for security fixes

Closes malariagen#1301
When a randomly selected region has no SNP sites after applying the
site mask, the allele count array is empty and calling .max() on it
raises ValueError. Skip the max assertion for zero-size arrays.

This fixes a pre-existing flaky test failure:
  ValueError: zero-size array to reduction operation maximum which has no identity
The region string format is inclusive on both ends (start and stop),
so region_size should be stop - start + 1, not stop - start.
This caused a flaky assertion failure:
  assert 146 <= np.int64(145)
Expanding coverage from anoph/ only to the full malariagen_data/ package
causes an expected drop in the project coverage percentage because newly
measured modules (plasmodium.py, veff.py, util.py, etc.) have lower test
coverage. This adds a 10% threshold to the project status check so that
the expected one-time drop from the scope expansion does not block the PR.

The patch check remains strict (80% target, 0% threshold) to ensure all
new/modified code is well tested.
@kunal-10-cloud kunal-10-cloud force-pushed the fix/issue-1301-ci-coverage-blind-spots branch from 986368d to 5bddcd0 Compare April 15, 2026 20:03
@kunal-10-cloud
Copy link
Copy Markdown
Contributor Author

kunal-10-cloud commented Apr 17, 2026

Hi @jonbrenas

Just a gentle nudge on this PR — would love your thoughts when you get a moment!

Quick context on why this matters:

The CI coverage workflow was only tracking the anoph/ subpackage, completely missing modules like plasmodium.py, veff.py, and util.py — some of which have had recurring bugs (#916, #953, #1132, #1180).
Without coverage data on these modules, regressions can slip into master unnoticed.
This is a very lightweight change — just +6 / -4 lines across 3 files (a one-line cov scope fix, a Codecov action version bump, and a minor test adjustment). Should be a quick review.

Happy to address any feedback. Thanks for your time!

@jonbrenas
Copy link
Copy Markdown
Collaborator

Thanks @kunal-10-cloud. I don't think it is really needed but it probably doesn't hurt.

@kunal-10-cloud
Copy link
Copy Markdown
Contributor Author

Thanks @kunal-10-cloud. I don't think it is really needed but it probably doesn't hurt.

Thanks for taking a look and for the approval, @jonbrenas — really appreciate it!

Agreed that it’s a low-risk, low-effort change. Since it improves coverage visibility for modules like veff.py and plasmodium.py that have had past issues, I think it’s a reasonable addition.

Let me know if you're happy to proceed with merging — happy either way

@kunal-10-cloud
Copy link
Copy Markdown
Contributor Author

Hi @jonbrenas — just a gentle ping on this one. Since it's already approved and CI is green, would you be able to merge when you get a moment? No rush at all.

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 Workflow Has Two Blind Spots — Excludes Root Modules and Uses Outdated Codecov Action

3 participants