From 474394794d85a6025328d3a979a367c75013bd3b Mon Sep 17 00:00:00 2001 From: Gguidini Date: Mon, 3 Jun 2024 17:07:39 +0200 Subject: [PATCH] fix: improve adjusted base comparison ticket: https://github.com/codecov/internal-issues/issues/204 Let me preface this by saying that the latest comment in the ticket doesn't seem an accurate complain cause looking in the logs the adjusted base coverage is 91.30752 and the head covereage is 91.24169. That being said, it's still possible that for a decent sized code base the change is less than what we display as a "change" (that is, the change is smaller than 0.01), but it's still a change (might be 0.0001) Realistically no one would care. So this change protects us by having a little wiggle room. The check would only fail if the difference is more than 0.01 (so the numbers in the comment would look different). --- services/notification/notifiers/mixins/status.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/services/notification/notifiers/mixins/status.py b/services/notification/notifiers/mixins/status.py index f91b24cb6..de80f2268 100644 --- a/services/notification/notifiers/mixins/status.py +++ b/services/notification/notifiers/mixins/status.py @@ -221,7 +221,7 @@ def get_sum_from_lists( quantized_base_adjusted_coverage = base_adjusted_coverage.quantize( Decimal("0.00000") ) - if quantized_base_adjusted_coverage <= head_coverage: + if abs(quantized_base_adjusted_coverage - head_coverage) < Decimal("0.01"): rounded_difference = round_number( self.current_yaml, head_coverage - base_adjusted_coverage )