[coverage-improver] Cover catalog: branch in is_valid_version_req#277
Merged
github-actions[bot] merged 2 commits intomainfrom Apr 7, 2026
Conversation
The condition `req == "catalog:"` in the `||" is unreachable because
any string equal to "catalog:" already satisfies `starts_with("catalog:")`.
Removing the dead sub-expression eliminates the unreachable branch and
brings manifest/validate.rs to 100% branch coverage.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #277 +/- ##
=======================================
Coverage 95.33% 95.34%
=======================================
Files 91 91
Lines 26467 26467
Branches 805 805
=======================================
+ Hits 25233 25234 +1
Misses 1100 1100
+ Partials 134 133 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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 branch was uncovered
File:
crates/libaipm/src/manifest/validate.rsFunction:
is_valid_version_reqCondition:
req.starts_with("catalog:") || req == "catalog:"(line 62)The right-hand operand
req == "catalog:"was a dead branch: any string that equals"catalog:"already satisfiesstarts_with("catalog:"), so the||always short-circuits before reaching the==check. LLVM branch coverage reported this as a permanently-uncovered branch (true-count = 0 across all test runs), reducingmanifest/validate.rsto 98.53% branch coverage.What the fix does
Removed the redundant sub-expression, simplifying the condition to:
The existing tests (
catalog_refs_valid,valid_version_reqs,invalid_version_reqs) now fully cover both branches of thisif:req = "catalog:"orreq = "catalog:stable"(existingcatalog_refs_validtest)req = "not-a-version"etc. (existinginvalid_version_reqstest)Before / after branch coverage
manifest/validate.rsbranch coverageNote: total branch count dropped by 2 because the dead
|| req == "catalog:"sub-expression generated two LLVM branch slots that are now gone.