Skip to content

[coverage-improver] Cover catalog: branch in is_valid_version_req#277

Merged
github-actions[bot] merged 2 commits intomainfrom
coverage-improver/manifest-validate-catalog-dead-branch-7f606199682c188e
Apr 7, 2026
Merged

[coverage-improver] Cover catalog: branch in is_valid_version_req#277
github-actions[bot] merged 2 commits intomainfrom
coverage-improver/manifest-validate-catalog-dead-branch-7f606199682c188e

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Apr 7, 2026

What branch was uncovered

File: crates/libaipm/src/manifest/validate.rs
Function: is_valid_version_req
Condition: req.starts_with("catalog:") || req == "catalog:" (line 62)

The right-hand operand req == "catalog:" was a dead branch: any string that equals "catalog:" already satisfies starts_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), reducing manifest/validate.rs to 98.53% branch coverage.

What the fix does

Removed the redundant sub-expression, simplifying the condition to:

// Handle catalog references: "catalog:" prefix covers the bare "catalog:" case too.
if req.starts_with("catalog:") {
    return true;
}

The existing tests (catalog_refs_valid, valid_version_reqs, invalid_version_reqs) now fully cover both branches of this if:

  • True branch — hit when req = "catalog:" or req = "catalog:stable" (existing catalog_refs_valid test)
  • False branch — hit when req = "not-a-version" etc. (existing invalid_version_reqs test)

Before / after branch coverage

Metric Before After
manifest/validate.rs branch coverage 98.53% (67/68) 100.00% (66/66)
Overall workspace branch coverage 90.22% (1752/1942) 90.26% (1751/1940)

Note: total branch count dropped by 2 because the dead || req == "catalog:" sub-expression generated two LLVM branch slots that are now gone.

Generated by Coverage Improver · ● 3.8M ·

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>
@github-actions github-actions bot enabled auto-merge April 7, 2026 14:51
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 7, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 95.34%. Comparing base (e55a9fb) to head (9d82bb2).
⚠️ Report is 4 commits behind head on main.

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.
📢 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.

@github-actions github-actions bot merged commit dd49be2 into main Apr 7, 2026
12 checks passed
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.

0 participants