fix(code review): create repo settings even if org's default code review toggle is false#106641
Merged
fix(code review): create repo settings even if org's default code review toggle is false#106641
Conversation
ryan953
approved these changes
Jan 21, 2026
a021e9e to
9995a88
Compare
ryan953
reviewed
Jan 21, 2026
| self.pk = settings.pk | ||
| self.save() | ||
|
|
||
| return (self.pk, ImportKind.Inserted if created else ImportKind.Overwrite) |
Member
There was a problem hiding this comment.
Looks like when we're creating a Repository record we'll also create a RepositorySetting.
Then during a database import we'll import the Repository first, which will create some rows inside RepositorySetting with default values. We need to override those rows with this method, setting the correct imported values.
which is the long was of re-phrasing the comment in the method. This method impl matches too: https://github.com/getsentry/sentry/blob/master/src/sentry/users/models/email.py#L51-L63
Member
Author
There was a problem hiding this comment.
Added some tests for this function in tests/sentry/models/test_repositorysettings.py L83
ryan953
approved these changes
Jan 21, 2026
f6c3dfe to
2844fb4
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Let's always create a RepositorySettings row even if the toggle for the org default is set to False.
Tests need to be updated to use the factory helper as we otherwise will get duplicate key errors trying to insert a row that already exists for that repo.