fix: expand CI coverage to full malariagen_data package and update codecov action#1302
Conversation
There was a problem hiding this comment.
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-covscope frommalariagen_data/anophtomalariagen_data. - Bump Codecov upload action from
codecov/codecov-action@v3to@v4.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
b13f85a to
986368d
Compare
…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.
986368d to
5bddcd0
Compare
|
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). Happy to address any feedback. Thanks for your time! |
|
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 |
|
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. |
Summary
Fixes #1301
The
coverage.ymlworkflow had two blind spots:Incomplete coverage scope — The
--covflag targeted onlymalariagen_data/anoph, completely excluding coverage measurement for all root-level modules:ag3.py,af1.py,adir1.py,amin1.py,adar1.pypf7.py,pf8.py,pf9.py,pv4.py,plasmodium.pyveff.pyutil.pyplotly_dendrogram.py,anopheles.py,mjn.py,amino_acid_distance.pyOutdated Codecov action — The workflow used
codecov/codecov-action@v3while v4 has been available since early 2024 with security improvements.Changes
--cov malariagen_data/anoph→--cov malariagen_dataso pytest-cov measures coverage across the entire package, not just theanoph/subpackage.codecov/codecov-action@v3→codecov/codecov-action@v4for security fixes and latest features.Why This Matters
plasmodium.pyis the entire Plasmodium data access layer (Pf7, Pf8, Pf9, Pv4) — it had zero coverage tracking despite active development (Pf9 added in Adding Pf9 functionality #1236).veff.pyhas had multiple recent bugs (Bug: TODO Strings Returned as Real Variant Effect Values in veff.py #916, veff.py: SYNONYMOUS_STOP and SYNONYMOUS_START effects not correctly classified #953, veff.py: in-frame complex variants return literal "TODO" string as effect label #1132, Enhance variant effect annotation: classify in-frame complex variants properly inveff.py#1180) — coverage tracking would help catch regressions.util.pycontains shared utilities used by every module; regressions there cascade everywhere.ag3.py/af1.pyentry points contain species-specific configurations that were never coverage-verified.Expected Impact
malariagen_data/package on both pushes to master and pull requests.Test Plan
plasmodium.py,veff.py,util.py)