fix: handle NOT_FOUND coverage status in Java multi-module projects#1229
Merged
Conversation
- Update coverage_critic to skip coverage check when CoverageStatus.NOT_FOUND is returned (e.g., when JaCoCo report doesn't exist in multi-module projects where the test module has no source classes) - Add JaCoCo configuration to include all class files for multi-module support This fixes "threshold for test confidence was not met" errors that occurred even when all tests passed, because JaCoCo couldn't generate coverage reports for test modules without source classes. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.
Summary
coverage_criticto skip coverage check whenCoverageStatus.NOT_FOUNDis returned (e.g., when JaCoCo report doesn't exist in multi-module projects where the test module has no source classes)Problem
In multi-module Maven projects (like aerospike-client-java), the test module often has no source classes of its own - it only contains tests for classes in other modules. When JaCoCo runs in this context, it can't generate a coverage report because there are no classes to instrument in the test module's
target/classesdirectory.Previously,
coverage_criticwould fail with "threshold for test confidence was not met" even when all tests passed (e.g., 32 passed, 0 failed), because:JacocoCoverageUtils.load_from_jacoco_xmlreturned aCoverageDatawithstatus=NOT_FOUNDandcoverage=0.0coverage_criticcheckedif original_code_coverage:which was True (it's a CoverageData object, not None)coverage >= COVERAGE_THRESHOLDwhich was0.0 >= 30.0= FalseSolution
Check for
CoverageStatus.NOT_FOUNDstatus and skip the coverage check in that case, similar to how we handleNonecoverage data.Test plan
🤖 Generated with Claude Code