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

Fix notifications with an empty HEAD report #816

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

Swatinem
Copy link
Contributor

There were a couple of errors spread around the notification code assuming that a head.report always exists, which is not necessarily the case.

In particular that would be the case when using empty-upload or manual_trigger.


Fixes WORKER-P6A

@Swatinem Swatinem requested a review from a team October 24, 2024 11:44
@Swatinem Swatinem self-assigned this Oct 24, 2024
Copy link

codecov bot commented Oct 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.01%. Comparing base (02c2e2b) to head (48ae32b).
Report is 3 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #816   +/-   ##
=======================================
  Coverage   98.01%   98.01%           
=======================================
  Files         446      446           
  Lines       36619    36649   +30     
=======================================
+ Hits        35892    35923   +31     
+ Misses        727      726    -1     
Flag Coverage Δ
integration 98.01% <100.00%> (+<0.01%) ⬆️
unit 98.01% <100.00%> (+<0.01%) ⬆️

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

Components Coverage Δ
NonTestCode 95.90% <100.00%> (+<0.01%) ⬆️
OutsideTasks 98.00% <100.00%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
...rvices/notification/notifiers/codecov_slack_app.py 100.00% <100.00%> (ø)
services/notification/notifiers/mixins/status.py 98.17% <100.00%> (-0.02%) ⬇️
tasks/notify.py 95.92% <100.00%> (ø)
tasks/tests/integration/test_notify_task.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

@codecov-staging
Copy link

codecov-staging bot commented Oct 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #816   +/-   ##
=======================================
  Coverage   98.01%   98.01%           
=======================================
  Files         446      446           
  Lines       36619    36649   +30     
=======================================
+ Hits        35892    35923   +31     
+ Misses        727      726    -1     
Flag Coverage Δ
integration 98.01% <100.00%> (+<0.01%) ⬆️
unit 98.01% <100.00%> (+<0.01%) ⬆️

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

Components Coverage Δ
NonTestCode 95.90% <100.00%> (+<0.01%) ⬆️
OutsideTasks 98.00% <100.00%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
...rvices/notification/notifiers/codecov_slack_app.py 100.00% <100.00%> (ø)
services/notification/notifiers/mixins/status.py 98.17% <100.00%> (-0.02%) ⬇️
tasks/notify.py 95.92% <100.00%> (ø)
tasks/tests/integration/test_notify_task.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

@codecov-qa
Copy link

codecov-qa bot commented Oct 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.01%. Comparing base (02c2e2b) to head (48ae32b).
Report is 3 commits behind head on main.

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #816   +/-   ##
=======================================
  Coverage   98.01%   98.01%           
=======================================
  Files         446      446           
  Lines       36619    36649   +30     
=======================================
+ Hits        35892    35923   +31     
+ Misses        727      726    -1     
Flag Coverage Δ
integration 98.01% <100.00%> (+<0.01%) ⬆️
unit 98.01% <100.00%> (+<0.01%) ⬆️

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

Components Coverage Δ
NonTestCode 95.90% <100.00%> (+<0.01%) ⬆️
OutsideTasks 98.00% <100.00%> (+<0.01%) ⬆️
Files with missing lines Coverage Δ
...rvices/notification/notifiers/codecov_slack_app.py 100.00% <100.00%> (ø)
services/notification/notifiers/mixins/status.py 98.17% <100.00%> (-0.02%) ⬇️
tasks/notify.py 95.92% <100.00%> (ø)
tasks/tests/integration/test_notify_task.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

Copy link

codecov-public-qa bot commented Oct 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.01%. Comparing base (02c2e2b) to head (48ae32b).

✅ All tests successful. No failed tests found.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #816   +/-   ##
=======================================
  Coverage   98.01%   98.01%           
=======================================
  Files         446      446           
  Lines       36619    36649   +30     
=======================================
+ Hits        35892    35923   +31     
+ Misses        727      726    -1     
Flag Coverage Δ
integration 98.01% <100.00%> (+<0.01%) ⬆️
unit 98.01% <100.00%> (+<0.01%) ⬆️

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

Components Coverage Δ
NonTestCode 95.90% <100.00%> (+<0.01%) ⬆️
OutsideTasks 98.00% <100.00%> (+<0.01%) ⬆️
Files Coverage Δ
...rvices/notification/notifiers/codecov_slack_app.py 100.00% <100.00%> (ø)
services/notification/notifiers/mixins/status.py 98.17% <100.00%> (-0.02%) ⬇️
tasks/notify.py 95.92% <100.00%> (ø)
tasks/tests/integration/test_notify_task.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

@Swatinem Swatinem force-pushed the swatinem/fix-notify-no-report branch from c68f8fc to d1d8d3a Compare October 24, 2024 11:52
Copy link
Contributor

@spalmurray-codecov spalmurray-codecov left a comment

Choose a reason for hiding this comment

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

lgtm, but you may want a platform review as well - your call 🙂

There were a couple of errors spread around the notification code assuming that a `head.report` always exists, which is not necessarily the case.

In particular that would be the case when using `empty-upload` or `manual_trigger`.
@Swatinem Swatinem force-pushed the swatinem/fix-notify-no-report branch from d1d8d3a to 48ae32b Compare October 24, 2024 13:02
@@ -84,6 +84,7 @@ def build_payload(self, comparison: ComparisonProxy) -> dict:
message = "unknown"
notation = ""
comparison_url = None
head_report = comparison.head.report
Copy link
Contributor

Choose a reason for hiding this comment

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

Is comparison.head typed as a FullCommit in the code? Maybe it would be a good idea to update the type to account for that. I've seen examples where the commit might also be None and have a half-done PR to update it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I’m unsure about that one. I had the problem that comparison might be wrongly typed, as some tests were failing because it was actually a FilteredComparison, though I’m not sure if that only happened because of tests, or if that can also happen in real world code. In other parts of the notification infra, I have updated the types to take that into account.

@Swatinem Swatinem added this pull request to the merge queue Oct 24, 2024
Merged via the queue into main with commit c9bb50c Oct 24, 2024
26 of 27 checks passed
@Swatinem Swatinem deleted the swatinem/fix-notify-no-report branch October 24, 2024 14:54
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.

3 participants