test(vex): cover apply() counter and effect branches#51
Merged
Conversation
Adds a test module to src/vex/apply.rs exercising every increment site and effect branch in the VEX apply pipeline: - empty-index fast path is a no-op - vulns branch: suppression drops, retain(!is_empty) removes empty keys, affected entries get annotated under cve:<purl>:<id> - typosquats: suppression vs under_investigation annotation paths - version_jumps, maintainer_age, license_violations: suppression counts - vex_suppressed_count uses +=, not =, so prior counts are preserved Closes a gap surfaced by cargo-mutants (#35): 13 survivors in apply.rs covering the 6 'suppressed += 1' sites and the final accumulator. With no tests calling vex::apply() directly, mutating any of the counters (or replacing the whole function with ()) left CI green.
Coverage reportLine coverage: 85.2% (9642 / 11311 lines) Full lcov report available as workflow artifact coverage-lcov: download from this run. v0.9.8 introduces this report; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a test module to
src/vex/apply.rs(which had zero direct tests) exercising every increment site and effect branch in the VEX apply pipeline.Why
Part of #35 (cargo-mutants audit on
src/vex/**). The mutants run flagged 13 survivors clustered inapply.rs— including the "replaceapplywith()" mutant, which means the entire function could be neutered and CI would stay green. That's a real regression risk: silent counter drift means wrongvex_suppressed_countin the summary, and a neuteredapply()means--vexflags get ignored entirely.What's covered
retain(!is_empty)removes empty purl keys,affectedentries get annotated undercve:<purl>:<id>under_investigationannotation pathsvex_suppressed_countuses+=, not=: pre-existing counts from prior passes are preservedMutants killed (expected)
replace apply with ()suppressed += 1(+= -> -=/*=,replace += with =)enrichment.vex_suppressed_count += suppressedline 139Re-running cargo-mutants on
src/vex/apply.rsafter this merges should drop the missed count substantially. A follow-up PR will mop up the remaining survivors inmod.rs,synthetic_id.rs, anddetect_format.Test counts
All green locally with
RUSTFLAGS="-D warnings" cargo build --all-targets --all-features+cargo clippy --all-targets --all-features -- -D warnings+cargo fmt --check.Refs #35.