Skip to content

fix: coverage threshold handling and status display#357

Merged
arodage merged 4 commits intomainfrom
fix/coverage-threshold-fallback
Jan 22, 2026
Merged

fix: coverage threshold handling and status display#357
arodage merged 4 commits intomainfrom
fix/coverage-threshold-fallback

Conversation

@arodage
Copy link
Copy Markdown
Contributor

@arodage arodage commented Jan 22, 2026

Merge Checklist

All boxes should be checked before merging the PR

  • The changes in the PR have been built and tested
  • Ready to merge

Description

Fixes several issues with the coverage threshold mechanism:

  1. Fix empty threshold file handling - Properly reads and validates .coverage-threshold file, handling whitespace/newlines with tr -d '[:space:]'
  2. Fix STATUS parsing - The sed pattern was incorrectly extracting 'S' from 'Status:' instead of 'PASSED'/'FAILED'. Now uses awk '{print $NF}'

Problem: Coverage showed FAILED even when above threshold (64.3% > 64.2%)

Root causes:

  • Empty/whitespace in threshold file caused fallback to 65.0%
  • sed pattern captured wrong text from the Status line

Any Newly Introduced Dependencies

None

How Has This Been Tested?

  • CI workflow run validates the changes

Before:

image

After:

image

- 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.
Copilot AI review requested due to automatic review settings January 22, 2026 00:11
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread .github/workflows/unit-test-and-coverage-gate.yml
Comment thread .github/workflows/unit-test-and-coverage-gate.yml
@arodage arodage merged commit fd70d1b into main Jan 22, 2026
16 of 17 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.

4 participants