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

feat: Notify that commit is currently processing #179

Merged
merged 12 commits into from
Oct 27, 2023

Conversation

scott-codecov
Copy link
Contributor

Purpose/Motivation

Send an early notification that an upload is being processed.
Depends on codecov/worker#140

Links to relevant tickets

codecov/engineering-team#553

What does this PR do?

Enqueues a notify task as soon as we receive an upload (but before it's processed). This notification will issue a PR comment that says something like "We're processing your upload".

@codecov
Copy link

codecov bot commented Oct 5, 2023

Codecov Report

Merging #179 (3256bba) into main (06a4313) will not change coverage.
The diff coverage is 94.11%.

❗ Current head 3256bba differs from pull request most recent head f9b9b04. Consider uploading reports for the commit f9b9b04 to get more accurate results

Changes have been made to critical files, which contain lines commonly executed in production. Learn more

@@          Coverage Diff          @@
##            main    #179   +/-   ##
=====================================
  Coverage   95.51   95.51           
=====================================
  Files        715     715           
  Lines      15646   15664   +18     
=====================================
+ Hits       14943   14961   +18     
  Misses       703     703           
Flag Coverage Δ
unit 95.60% <94.11%> (+<0.01%) ⬆️
unit-latest-uploader 95.60% <94.11%> (+<0.01%) ⬆️

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

Files Coverage Δ
...s/0037_alter_commitnotification_decoration_type.py 100.00% <100.00%> (ø)
core/models.py 94.55% <100.00%> (+0.02%) ⬆️
core/tests/factories.py 100.00% <100.00%> (ø)
upload/helpers.py Critical 93.72% <100.00%> (+0.30%) ⬆️
services/task/task.py 88.18% <77.77%> (+0.44%) ⬆️

... and 5 files with indirect coverage changes

@codecov-qa
Copy link

codecov-qa bot commented Oct 5, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (06a4313) 95.60% compared to head (f9b9b04) 95.61%.

Files Patch % Lines
services/task/task.py 77.77% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #179   +/-   ##
=======================================
  Coverage   95.60%   95.61%           
=======================================
  Files         601      602    +1     
  Lines       15240    15267   +27     
=======================================
+ Hits        14570    14597   +27     
  Misses        670      670           
Flag Coverage Δ
unit 95.61% <94.11%> (+<0.01%) ⬆️
unit-latest-uploader 95.61% <94.11%> (+<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.

@codecov-public-qa
Copy link

codecov-public-qa bot commented Oct 5, 2023

Codecov Report

Merging #179 (f9b9b04) into main (06a4313) will increase coverage by 0.00%.
The diff coverage is 94.11%.

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #179   +/-   ##
=======================================
  Coverage   95.60%   95.61%           
=======================================
  Files         601      602    +1     
  Lines       15240    15267   +27     
=======================================
+ Hits        14570    14597   +27     
  Misses        670      670           
Flag Coverage Δ
unit 95.61% <94.11%> (+<0.01%) ⬆️
unit-latest-uploader 95.61% <94.11%> (+<0.01%) ⬆️

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

Files Coverage Δ
...s/0037_alter_commitnotification_decoration_type.py 100.00% <100.00%> (ø)
core/models.py 94.55% <100.00%> (+0.02%) ⬆️
core/tests/factories.py 100.00% <100.00%> (ø)
upload/helpers.py 93.72% <100.00%> (+0.30%) ⬆️
services/task/task.py 82.72% <77.77%> (+0.65%) ⬆️

Impacted file tree graph

@scott-codecov
Copy link
Contributor Author

Reworked some of this so requested reviews again

"app.tasks.notify.Notify",
kwargs=dict(
repoid=repoid,
commitid=commitid,
current_yaml=current_yaml,
empty_upload=empty_upload,
),
)

def notify(self, repoid, commitid, current_yaml=None, empty_upload=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

since now we're using different kinds of notifications here, can we rename the empty_upload to be something more descriptive? like notification_type for example?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I think that would make sense. I can update it in the worker too but will have to support both empty_upload and notification_type for a little bit so as to preserve backward compatibility.

Copy link
Contributor

@dana-yaish dana-yaish left a comment

Choose a reason for hiding this comment

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

LGTM, I like the idea that we're checking the existence of previous notifications. Left some minor notes but this is looking good

@@ -34,7 +34,7 @@


class TaskService(object):
def _create_signature(self, name, args=None, kwargs=None):
def _create_signature(self, name, args=None, kwargs=None, immutable=False):
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 for my own understanding, what's the immutable for?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I had to look this up in the Celery docs. When we use Celery's chain or link then the results of the previous task are passed as arguments to the next task in the chain (this is the default and is when immutable=False). I left a small comment about this where I pass immutable=True and the goal was to prevent the results of the notify task from being passed as args to the upload task.

@codecov-staging
Copy link

codecov-staging bot commented Oct 25, 2023

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Files Patch % Lines
services/task/task.py 77.77% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!.

@scott-codecov scott-codecov temporarily deployed to staging October 25, 2023 14:55 — with GitHub Actions Inactive
)

notified = CommitNotification.objects.filter(commit__commitid=commitid).exists()
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 realizing we probably need to store this per-PR since when we make another commit on the same branch we don't necessarily want to show the "processing" comment again. 🤔

@scott-codecov scott-codecov temporarily deployed to staging October 25, 2023 16:44 — with GitHub Actions Inactive
repository_id=commit.repository_id, pullid=commit.pullid
).first()
if pull and pull.commentid:
notified = True
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@dana-yaish What do you think about this approach? I had been checking CommitNotification previously but that resulted in us showing the "processing" comment for a brief period each time a new commit was pushed to a PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't that more accurate though? Every time I push a new commit in a PR I expect the CI to run again and update me of the status of the new commit.

If we had 2 slightly different versions of "we are processing the upload" and "you updated this PR and we are processing the upload" that seems the most accurate to me.
It somehow seems better than the comment with the red banner saying "the head of this PR doesn't match these calculations, please upload new coverage"

@scott-codecov scott-codecov merged commit 5ddb063 into main Oct 27, 2023
13 of 17 checks passed
@scott-codecov scott-codecov deleted the scott/notify-upload-processing branch October 27, 2023 13:22
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.

None yet

4 participants