fix: coverage threshold handling and status display#357
Merged
Conversation
- Add validation to ensure threshold is a valid number - Strip whitespace when reading .coverage-threshold file - Use fallback 65.0 only when file is truly missing/empty/invalid - Add debug output in Earthfile to show which threshold is used Fixes issue where empty file caused fallback to 65.0 instead of using the actual threshold value.
The Status field in coverage_report.txt now reflects only whether coverage met the threshold, not whether tests passed. This fixes the confusing case where coverage was 64.3% (above 64.2% threshold) but Status showed FAILED because some tests had failed.
The sed pattern was capturing 'S' from '**Status:**' instead of
'PASSED' or 'FAILED'. Using awk '{print $NF}' to get the last word.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes critical bugs in the coverage threshold mechanism that caused incorrect coverage status reporting. The changes address issues where coverage was incorrectly shown as FAILED even when above the threshold (e.g., 64.3% > 64.2%).
Changes:
- Fixed threshold file reading to properly handle whitespace/newlines using
tr -d '[:space:]' - Corrected STATUS parsing to extract 'PASSED'/'FAILED' instead of incorrect text
- Separated coverage status tracking from overall test status
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| scripts/run_coverage_tests.sh | Introduced dedicated COVERAGE_PASSED variable to track coverage status independently from test failures |
| Earthfile | Added proper threshold file parsing with whitespace removal and fallback handling for both test and test-debug targets |
| .github/workflows/unit-test-and-coverage-gate.yml | Fixed threshold file reading with whitespace handling, added validation, and corrected STATUS extraction using awk |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
yockgen
approved these changes
Jan 22, 2026
magerstam
approved these changes
Jan 22, 2026
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.
Merge Checklist
All boxes should be checked before merging the PR
Description
Fixes several issues with the coverage threshold mechanism:
.coverage-thresholdfile, handling whitespace/newlines withtr -d '[:space:]'awk '{print $NF}'Problem: Coverage showed FAILED even when above threshold (64.3% > 64.2%)
Root causes:
Any Newly Introduced Dependencies
None
How Has This Been Tested?
Before:
After: