-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
chore(control_silo): Move User model to new home in users package #75597
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
chore(control_silo): Move User model to new home in users package #75597
Conversation
Moves the User model to new home in sentry/users/models/ and tests to tests/sentry/users/models ref(issue # here)
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.
Added a lot of return & parameter typing for this file, pls double check if the types are wrong. I'll point out some specific ones I'm unsure on
src/sentry/users/models/user.py
Outdated
# sessions and refresh their nonce. | ||
@receiver(user_logged_out, sender=User) | ||
def refresh_user_nonce( | ||
sender: User | RpcUser, request: HttpRequest, user: User | None, **kwargs: Any |
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.
unsure if request can be None
too ?
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.
All of the current callers provide the request, but signals make no promises on providing all of their parameters. Annotating this as HttpRequest | None
seems wise.
Test Failures Detected: Due to failing tests, we cannot provide coverage reports at this time. ❌ Failed Test Results:Completed 21745 tests with View the full list of failed testspytest
|
batch.count shouldn't be able to go negative. This can happen when a batch is complete, and has no additional data so low=`max id` and up=0. This edge case came up in testing as our batch sizes are 1, and other tests created enough rows to cause the sequence state to get high enough that the incorrect batch.count resulted in backfills aborting early. I've also added a `__str__` to make future debugging easier.
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.
Looks good to me. Most of the changes are import updates. I didn't spot any logic differences in the User
model.
src/sentry/users/models/user.py
Outdated
# sessions and refresh their nonce. | ||
@receiver(user_logged_out, sender=User) | ||
def refresh_user_nonce( | ||
sender: User | RpcUser, request: HttpRequest, user: User | None, **kwargs: Any |
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.
All of the current callers provide the request, but signals make no promises on providing all of their parameters. Annotating this as HttpRequest | None
seems wise.
src/sentry/users/models/user.py
Outdated
def refresh_api_user_nonce( | ||
sender: RpcUser, request: HttpRequest, user: User | None, **kwargs: Any |
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.
Same here, I would assume that all parameters could be None
.
Suspect IssuesThis pull request was deployed and Sentry observed the following issues:
Did you find this useful? React with a 👍 or 👎 |
…5597) Part of consolidating (user) control silo resources to be located with other user related models. Leaves behind a shim for any getsentry references. Also includes a fix for backfill_outboxes to ensure batch.count doesn't become negative which caused tests in test_backfill_outboxes to fail. Ref(#73856) --------- Co-authored-by: Mark Story <[email protected]>
Part of consolidating (user) control silo resources to be located with other user related models.
Ref(#73856)