-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add activate user task #556
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ ✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #556 +/- ##
=======================================
Coverage 97.51% 97.51%
=======================================
Files 420 422 +2
Lines 35397 35468 +71
=======================================
+ Hits 34517 34588 +71
Misses 880 880
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #556 +/- ##
=======================================
Coverage 97.51% 97.51%
=======================================
Files 420 422 +2
Lines 35397 35468 +71
=======================================
+ Hits 34517 34588 +71
Misses 880 880
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
✅ All tests successful. No failed tests found. @@ Coverage Diff @@
## main #556 +/- ##
=======================================
Coverage 97.51% 97.51%
=======================================
Files 420 422 +2
Lines 35397 35468 +71
=======================================
+ Hits 34517 34588 +71
Misses 880 880
Flags with carried forward coverage won't be shown. Click here to find out more.
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Changes have been made to critical files, which contain lines commonly executed in production. Learn more ✅ All tests successful. No failed tests found. Additional details and impacted files@@ Coverage Diff @@
## main #556 +/- ##
=======================================
Coverage 97.53% 97.54%
=======================================
Files 451 453 +2
Lines 36119 36190 +71
=======================================
+ Hits 35229 35300 +71
Misses 890 890
Flags with carried forward coverage won't be shown. Click here to find out more.
This change has been scanned for critical changes. Learn more |
user_ownerid=user_ownerid, | ||
org_ownerid=org_ownerid, | ||
), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the difference between celery_app.send_task()
and self.app.tasks[activate_account_user_task_name].apply_async()
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the main difference between send_task
and apply_async
is the way to reference the task. apply_async
requires the task to be registered on the existing process, whereas send_task
requires only then name. Otherwise, they do the same thing (starts running a new task). I'm not entirely sure why send_task
was used here. I didn't want to change the existing call, so I left it with send_task
, but I think that it can also be called with apply_async
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
left some questions but I don't think they are blocking ✅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I primarily asking questions here, in order to learn more about the code :-)
|
||
new_user_activation_call = mocked_send_task.call_args_list[0] | ||
account_user_activation_call = mocked_send_task.call_args_list[1] | ||
assert new_user_activation_call == call( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
similar to the difference between send_task
and apply_async
, what is the difference between these two asserts? would it make sense to use the same patterns for both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The asserts deal with the different ways that send_task
and apply_async
the mocked send_task
. Both asserts just check the call args (but the async call adds more stuff, which is why it's more complex).
The main motivation for this task is to have the task use the Django models exclusively. We can migrate some of the other New User Activation code to this in the future maybe.
When a user has auto_activate configuration for their user, we want to also make the trigger to activate_account_user task as well.
1cff61e
to
a976697
Compare
This adds a task that links a user to an account. In particular, we want this to be called in the NotifyTask if the organization has
should_attempt_author_auto_activation
enabled.Why is this a different task? This is mainly to isolate the models to avoid using SQLAlchemy. In the ideal scenario, we would add this association directly in the
activate_user
method. The second best place would be in the New User Activation Task. However, this would mean porting the code to Django, and it is a big lift for now. So, adding this new task to just do the account-user association. In the future, this task could potentially be the one we migrate the New User Activation Task to.ticket ref: codecov/engineering-team#1993
depends on: codecov/shared#284
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. In 2022 this entity acquired Codecov and as result Sentry is going to need some rights from me in order to utilize my contributions in this PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.