ref(seer onboarding): remove on_command_phrase CR trigger from repo settings and org options#105978
ref(seer onboarding): remove on_command_phrase CR trigger from repo settings and org options#105978
Conversation
| """Remove 'on_command_phrase' from RepositorySettings.code_review_triggers.""" | ||
| RepositorySettings = apps.get_model("sentry", "RepositorySettings") | ||
|
|
||
| all_settings = list(RepositorySettings.objects.all()) |
There was a problem hiding this comment.
This table is less than 200 rows, so should be safe to skip doing it post-deployment.
|
This PR has a migration; here is the generated SQL for for --
-- Raw Python operation
--
-- THIS OPERATION CANNOT BE WRITTEN AS SQL
--
-- Alter field code_review_triggers on repositorysettings
--
-- (no-op) |
suejung-sentry
left a comment
There was a problem hiding this comment.
Other than removing the orgOptions migration from here, the rest of the changes look good to me
|
|
||
|
|
||
| class CodeReviewTrigger(StrEnum): | ||
| ON_COMMAND_PHRASE = "on_command_phrase" |
There was a problem hiding this comment.
Uncleaned org options can propagate invalid triggers to new repos
Low Severity
The migration removes on_command_phrase from existing RepositorySettings but does not clean up organization options (sentry:default_code_review_triggers). If a new repository is created for an org that still has on_command_phrase in their org options, _maybe_auto_enable_code_review() in repository.py will propagate this value to the new RepositorySettings. When get_code_review_settings() is later called, it will raise a ValueError trying to convert "on_command_phrase" to the now-reduced CodeReviewTrigger enum. The PR discussion mentions manual cleanup of the ~5 affected orgs is planned, but if not completed before deployment, new repos for those orgs could trigger this error.


relates to ENG-6194
depends on https://github.com/codecov/overwatch/pull/622 (deployed)
depends on #105696 (frontend counterpart so we don't fail serializer validation; deployed)
followup: #105980
on_command_phraseis no longer being checked in Overwatch or inissue_comment.pywhen running code review. Let's remove it fromRepositorySettings(migration) and from theCodeReviewTriggerenum.Note: I'm not going to manually add it to
overwatch_rpc.pysince Overwatch isn't checking this trigger anymore and is in the process of being migrated to Sentry.