-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
fix(seer onboarding): make on_command_phrase CR trigger always on #105364
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
Conversation
|
This PR has a migration; here is the generated SQL for for --
-- Raw Python operation
--
-- THIS OPERATION CANNOT BE WRITTEN AS SQL |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #105364 +/- ##
========================================
Coverage 80.56% 80.57%
========================================
Files 9432 9432
Lines 404548 404557 +9
Branches 25675 25675
========================================
+ Hits 325944 325954 +10
+ Misses 78135 78134 -1
Partials 469 469 |
|
This PR has a migration; here is the generated SQL for for --
-- Raw Python operation
--
-- THIS OPERATION CANNOT BE WRITTEN AS SQL |
src/sentry/migrations/1015_backfill_on_command_phrase_trigger.py
Outdated
Show resolved
Hide resolved
src/sentry/integrations/api/endpoints/organization_repository_settings.py
Show resolved
Hide resolved
src/sentry/integrations/api/endpoints/organization_repository_settings.py
Show resolved
Hide resolved
src/sentry/integrations/api/endpoints/organization_repository_settings.py
Show resolved
Hide resolved
suejung-sentry
left a comment
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.
This logic makes sense to me. # TIL about django signals on save() not working on the bulk_create, good to know. Thanks for even thinking of doing the migration for our sparse test org data.
If this ends up a source of any difficulties or if hiding it as "hidden triggers" on frontend ends up hard, we can revisit removing it as a concept from this list and having all downstream consumers understand it is implicitly there
src/sentry/migrations/1015_backfill_on_command_phrase_trigger.py
Outdated
Show resolved
Hide resolved
| triggers = list(self.code_review_triggers or []) | ||
| if CodeReviewTrigger.ON_COMMAND_PHRASE.value not in triggers: | ||
| triggers.append(CodeReviewTrigger.ON_COMMAND_PHRASE.value) | ||
| self.code_review_triggers = triggers | ||
|
|
||
| super().save(*args, **kwargs) |
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.
How frequent are writes to this table? There will be a small time window (a few minutes) between your backfill running and this code being deployed to all servers. Any rows created in that time window will not have on_command_phrase stored. If you have a low volume of writes you could get lucky. If you want to completely avoid missed writes you'd need to make the migration a post_deploy instead.
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.
Ok, I expect write freq to be low but if there's no downside to doing it post-deploy, I'll just do so for peace of mind!
|
This PR has a migration; here is the generated SQL for for --
-- Raw Python operation
--
-- THIS OPERATION CANNOT BE WRITTEN AS SQL |
| raise serializers.ValidationError("Empty values are not allowed.") | ||
| return validate_pii_selectors(value) | ||
|
|
||
| def validate_defaultCodeReviewTriggers(self, value): |
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.
Are we planning to remove this at some point? With this logic as written you're no longer able to turn off the ON_COMMAND_PHRASE trigger right? So presumably we're going to remove this trigger completely (make it no longer configurable), at which point this validation can go away
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 a more broad note in this regard as a whole PR review comment.
evanpurkhiser
left a comment
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.
If the goal here is to make it such that the on_command_trigger is always enabled for users, we should instead just be removing whatever conditional is checking that defaultCodeReviewTriggers contains on_command_phrase, and then running a migration to remove all on_command_phrase's from the defaultCodeReviewTriggers from the database.
Removing conditional checks for features should result in less code not more.
Short answer is yes, we'll target removing The constraint right now is that we have a separate repo in play: overwatch, and it would need to be updated in sync with this PR. That's not the end of the world on it's own, but we're actually pulling the functional parts of overwatch directly into sentry itself. So after a few weeks there won't be that separate repo to coordinate with. For that reason we decided to go with this approach now for now. This PR is also a template for what we'd want to do to clean things up: another migration, along with removing the API validation stuff; so we won't have to think to hard about it. |
relates to ENG-6194
Backend counterpart to #105696
Since we are not charging by review, let's make sure the
on_command_phrasetrigger is always turned on inRepositorySettingsand organizationdefaultCodeReviewTriggers.RepositorySettings.save()to add theon_command_phrasetrigger if it's not presentOrganizationRepositorySettingsEndpoint--bulk_create()doesn't hit the modifiedsave(), so we just add it to all new settings, and to all existing settings if it's not presentOrganizationDetailsPutSerializerto add theon_command_phrasetrigger todefaultCodeReviewTriggersif it's not presentRepositorySettingstriggers and organizationdefaultCodeReviewTriggersto includeon_command_phrase