Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Failed check and status messaging in comment, part I #1014

Merged
merged 2 commits into from
Jan 21, 2025
Merged

Conversation

nora-shap
Copy link
Member

The goal of this epic is to communicate details about check or status failures in the other notifiers, like pr comment.

This is part 1, which is mostly new data structures and variables, and handling of notifications.

Right now we collect all notifications and execute them in any order, they are all independent and they don't know about each other. In this pr, I split notifications into 2 categories (checks/status notifications, or other notifications). Now the check/status notifications go first, because their outcome will impact the messaging in the other types of notifications.

The specific condition I will tackle next: add custom helper text for users that have specified a target in their yaml. If their check/status fails, we will add a message to the pr comment telling them that the check/status failed, with advice that mentions target and links them to the target docs. There are screenshots in the tix linked below.

What are check/status notifications? Check out the best stack overflow answer I've ever seen

codecov/engineering-team#1605
codecov/engineering-team#1626
Epic here: codecov/engineering-team#1133

@nora-shap nora-shap requested a review from a team January 16, 2025 22:25
@codecov-notifications
Copy link

codecov-notifications bot commented Jan 16, 2025

Codecov Report

Attention: Patch coverage is 95.77465% with 3 lines in your changes missing coverage. Please review.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
services/notification/notifiers/status/patch.py 75.00% 2 Missing ⚠️
services/notification/__init__.py 93.33% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

Copy link

codecov bot commented Jan 16, 2025

Codecov Report

Attention: Patch coverage is 95.77465% with 3 lines in your changes missing coverage. Please review.

Project coverage is 97.75%. Comparing base (905d703) to head (9cdbe99).
Report is 10 commits behind head on main.

❌ We are unable to process any of the uploaded JUnit XML files. Please ensure your files are in the right format.

Files with missing lines Patch % Lines
services/notification/notifiers/status/patch.py 75.00% 2 Missing ⚠️
services/notification/__init__.py 93.33% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1014   +/-   ##
=======================================
  Coverage   97.75%   97.75%           
=======================================
  Files         451      451           
  Lines       36812    36862   +50     
=======================================
+ Hits        35986    36035   +49     
- Misses        826      827    +1     
Flag Coverage Δ
integration 42.55% <77.46%> (+0.06%) ⬆️
unit 90.22% <87.32%> (-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

Copy link
Contributor

@Swatinem Swatinem left a comment

Choose a reason for hiding this comment

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

I love the well defined return types now

CUSTOM_TARGET_TEXT_PATCH_KEY = "custom_target_helper_text_patch"
CUSTOM_TARGET_TEXT_PROJECT_KEY = "custom_target_helper_text_project"
CUSTOM_TARGET_TEXT_VALUE = (
"Your {context} {notification_type} has failed because the patch coverage is below the target coverage. "
Copy link
Contributor

Choose a reason for hiding this comment

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

also looking at the mockup for this, is it reasonable to include the numbers in this message as well, like:

… has failed because the patch coverage (X%) is below the target coverage (Y%).

Copy link
Member Author

Choose a reason for hiding this comment

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

That's not in the design, but I think it makes sense - having the %s makes the message better, will add

# context=self.context, notification_type=notification_type
# )
# included_helper_text[CUSTOM_TARGET_TEXT_PATCH_KEY] = helper_text
# message = message + " - " + helper_text
Copy link
Member Author

Choose a reason for hiding this comment

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

also decided I'm not going to add the helper text to this message, so the resulting message for check or status will be unchanged

@nora-shap nora-shap added this pull request to the merge queue Jan 21, 2025
Merged via the queue into main with commit 369a74b Jan 21, 2025
24 of 27 checks passed
@nora-shap nora-shap deleted the nora/1626 branch January 21, 2025 19:21
Copy link

sentry-io bot commented Jan 21, 2025

Suspect Issues

This pull request was deployed and Sentry observed the following issues:

  • ‼️ AttributeError: 'NoneType' object has no attribute 'get' app.tasks.notify.Notify View Issue

Did you find this useful? React with a 👍 or 👎

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants