[coverage-improver] Cover empty cache index and reconciler raw_content branches#280
Merged
github-actions[bot] merged 2 commits intomainfrom Apr 7, 2026
Conversation
Add two unit tests to improve branch coverage: 1. cache::tests::get_with_empty_index_file_returns_none Covers the `content.is_empty()` True branch in `read_index()` (cache.rs:383). Previously the index file always had content when present; this test writes an empty file to exercise the early-return default-index path. 2. migrate::reconciler::tests::find_associated_artifact_raw_content_contains_path Covers the `content.contains(path_str.as_ref())` True branch in `find_associated_artifact()` (reconciler.rs:112). Previously no direct call to the function exercised the path where raw_content mentions the file path; this test adds that direct call. Branch coverage: 90.26% -> 90.31% (188 missed, down from 189). 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 #280 +/- ##
==========================================
+ Coverage 95.34% 95.35% +0.01%
==========================================
Files 91 91
Lines 26467 26482 +15
Branches 805 805
==========================================
+ Hits 25234 25251 +17
+ Misses 1100 1099 -1
+ Partials 133 132 -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 branches were uncovered
1.
libaipm/src/cache.rs—read_index(), line 383The
Truebranch (file exists but is empty) was never exercised. All existing tests that callread_index()do so after aput()which always writes a non-empty JSON index.2.
libaipm/src/migrate/reconciler.rs—find_associated_artifact(), line 112The
Truebranch (raw_content contains the file path, returning an association) was not covered by any direct call tofind_associated_artifact. While the through-reconcile()path was covered, one LLVM inlining context hadTrue: 0.What scenario the new tests cover
Test 1 —
cache::tests::get_with_empty_index_file_returns_none:Creates a cache, manually writes an empty
cache_index.jsonfile (simulating a truncated/reset cache), then callscache.get(). Theread_index()function finds the file, reads empty content, and returnsCacheIndex::default()via the previously-uncovered early-return.Test 2 —
migrate::reconciler::tests::find_associated_artifact_raw_content_contains_path:Calls
find_associated_artifactdirectly with an artifact that has noreferenced_scriptsbut whoseraw_contentcontains the queried path string. This ensures theTruebranch ofcontent.contains()is hit in the direct-call inlining context.Before / after branch coverage
Tests added