Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clean up status mixins #1004

Merged
merged 1 commit into from
Jan 13, 2025
Merged

clean up status mixins #1004

merged 1 commit into from
Jan 13, 2025

Conversation

nora-codecov
Copy link
Contributor

I'm working on this ticket and this ticket, which are changing the messaging coming out of this flow around target and threshold.
StatusPatchMixin and StatusProjectMixin are similar, but doing things differently, ie
head_coverage + threshold >= target_coverage vs head_coverage >= (target_coverage - threshold)
No behavior/logic changes, just cleanup to make them more uniform and easier to understand.

@nora-codecov nora-codecov requested a review from a team January 11, 2025 02:01
Copy link

codecov bot commented Jan 11, 2025

Codecov Report

Attention: Patch coverage is 97.01493% with 2 lines in your changes missing coverage. Please review.

Project coverage is 97.79%. Comparing base (6d41e91) to head (856c0e3).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
services/notification/notifiers/mixins/status.py 97.01% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1004      +/-   ##
==========================================
- Coverage   97.79%   97.79%   -0.01%     
==========================================
  Files         447      447              
  Lines       36154    36172      +18     
==========================================
+ Hits        35357    35373      +16     
- Misses        797      799       +2     
Flag Coverage Δ
integration 42.14% <59.70%> (+0.03%) ⬆️
unit 90.47% <97.01%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

⚠️ Impact Analysis from Codecov is deprecated and will be sunset on Jan 31 2025. See more

Copy link

✅ All tests successful. No failed tests were found.

📣 Thoughts on this report? Let Codecov know! | Powered by Codecov

@codecov-notifications
Copy link

codecov-notifications bot commented Jan 11, 2025

Codecov Report

Attention: Patch coverage is 97.01493% with 2 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
services/notification/notifiers/mixins/status.py 97.01% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Contributor

@giovanni-guidini giovanni-guidini left a comment

Choose a reason for hiding this comment

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

Nice change 👍
Great initiative making the code easier to understand.

Left some nit comments here and there. The only one I'd say to definitely fix before merging is the incorrect typehint. The rest is up to you.

@@ -6,25 +6,31 @@

log = logging.getLogger(__name__)

STATE_SUCCESS = "success"
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] I'd use an Enum for this


target_coverage: Decimal | None
totals = comparison.get_patch_totals()
def _get_target(self, comparison) -> Decimal | None:
Copy link
Contributor

Choose a reason for hiding this comment

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

[nit] typehint for comparison

@@ -215,6 +233,7 @@ def _apply_adjust_base_behavior(
quantized_base_adjusted_coverage = base_adjusted_coverage.quantize(
Decimal("0.00000")
)
### shouldn't we use threshold here?
Copy link
Contributor

Choose a reason for hiding this comment

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

This is actually a fair question. I'd ask product if we want to do that.

I don't think we should... the idea of this is that the coverage needs to be better somehow for the check to pass (because it's already failing). The exact "how" is "looking at only adds, are they more covered than before?". Having the threshold can open this up too much.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ooohhh, i see what you mean - I wasn't remembering that at this point in code they have already failed on the target + threshold base vs head measure.

I'll reach out to product because my thought here is - if they have a threshold, shouldn't we always be doing calculations with the threshold? And when we give them a message back, shouldn't we use/include threshold so that they don't sometimes see the number that represents the target, and other times the number that represents adjusted target with threshold?

threshold = Decimal("0.0")
return threshold

def _get_target(self, base_report_totals) -> Decimal:
Copy link
Contributor

Choose a reason for hiding this comment

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

return typehint is incorrect, you are actually returning a tuple

Copy link
Contributor

Choose a reason for hiding this comment

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

and there's no typehint on base_report_totals

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ty for catching! I changed to tuple at the last minute and forgot to update the typing!

@nora-codecov nora-codecov added this pull request to the merge queue Jan 13, 2025
Merged via the queue into main with commit 3584227 Jan 13, 2025
24 of 27 checks passed
@nora-codecov nora-codecov deleted the nora/1626 branch January 13, 2025 21:52
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.

2 participants