Conversation
… fix Re-applies 36ce446 (reverted in a630f3f) which requires `repo` and `integration` to be passed when creating a GitHub ticketing action. The revert was triggered by a CI failure in test_rule.py that selective testing had missed: GithubEnterpriseActionHandler is loaded via Django startup side-effects (@registry.register decorator), so the static import scanner had no edge from the handler file to the test file. Fix: add explicit imports of the github and github_enterprise handler packages at the top of test_rule.py so the scanner can detect the dependency going forward. Separately fix: remove `integration` from `required` inside `additional_fields` in the data_schema — the translator stores it as Action.integration_id, not inside additional_fields.
The IssueAlertMigrator translator moves `integration` from rule action data into Action.integration_id (a dedicated model field), so it never appears in additional_fields. Requiring it in the schema caused a ValidationError on action.save() when migrating existing GitHub/GithubEnterprise rules.
saponifi3d
approved these changes
Apr 30, 2026
| # Explicit imports so selective testing can detect when these handlers change. | ||
| # They register via @action_handler_registry.register at import time (startup | ||
| # side-effect), so without these the static scanner has no edge from handler | ||
| # files to this test file. |
- test_action_type_in_migration: add `repo` to GitHub/GithubEnterprise test cases — the schema now requires repo in additional_fields - test_rule.py: fix import order (ruff)
9692aa1 to
b239c2b
Compare
3 tasks
cleptric
pushed a commit
that referenced
this pull request
May 5, 2026
…ma and selective test fix (#114500) ## Summary Re-applies #114095 (reverted in a630f3f due to a CI failure that selective testing had missed) **Original change (re-landed):** - Adds a `data_schema` to `GithubActionHandler` requiring `repo` in `additional_fields`, so the API rejects GitHub ticketing actions created without a repo. - Makes `GithubEnterpriseActionHandler` inherit from `GithubActionHandler` to pick up the same validation. **Schema fix:** - Removes `integration` from `required` in `additional_fields`. The `IssueAlertMigrator` translator moves `integration` into `Action.integration_id` (a dedicated model field), so it never lands in `additional_fields`. Requiring it in the schema caused `action.save()` to raise a `ValidationError` when serializing existing GitHub/GithubEnterprise rules via `WorkflowEngineRuleSerializer`. --- edit: this doesn't really work so i'm prioritizing getting this PR back in and overriding selective testing for now **Selective testing fix:** - Adds explicit `import sentry.integrations.github.handlers` and `import sentry.integrations.github_enterprise.handlers` at the top of `test_rule.py`. Both handlers self-register via `@action_handler_registry.register` at import time (a Django startup side-effect), which means the static import scanner had no edge from the handler files to `test_rule.py`. The explicit imports make the dependency traceable, so future handler changes will select this test. --------- Co-authored-by: getsantry[bot] <66042841+getsantry[bot]@users.noreply.github.com>
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Re-applies #114095 (reverted in a630f3f due to a CI failure that selective testing had missed)
Original change (re-landed):
data_schematoGithubActionHandlerrequiringrepoinadditional_fields, so the API rejects GitHub ticketing actions created without a repo.GithubEnterpriseActionHandlerinherit fromGithubActionHandlerto pick up the same validation.Schema fix:
integrationfromrequiredinadditional_fields. TheIssueAlertMigratortranslator movesintegrationintoAction.integration_id(a dedicated model field), so it never lands inadditional_fields. Requiring it in the schema causedaction.save()to raise aValidationErrorwhen serializing existing GitHub/GithubEnterprise rules viaWorkflowEngineRuleSerializer.edit: this doesn't really work so i'm prioritizing getting this PR back in and overriding selective testing for now
Selective testing fix:
import sentry.integrations.github.handlersandimport sentry.integrations.github_enterprise.handlersat the top oftest_rule.py. Both handlers self-register via@action_handler_registry.registerat import time (a Django startup side-effect), which means the static import scanner had no edge from the handler files totest_rule.py. The explicit imports make the dependency traceable, so future handler changes will select this test.