Skip to content

Commit e87367a

Browse files
committed
add backward compat -- delegate to issue-details if multicell called on old url
1 parent 441ce0f commit e87367a

File tree

2 files changed

+16
-19
lines changed
  • src/sentry/middleware/integrations/parsers
  • tests/sentry/middleware/integrations/parsers

2 files changed

+16
-19
lines changed

src/sentry/middleware/integrations/parsers/jira.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,15 @@ def get_response(self) -> HttpResponseBase:
6767
if len(cells) == 0:
6868
return self.get_default_missing_integration_response()
6969

70-
if self.view_class in self.immediate_response_cell_classes and len(cells) == 1:
71-
try:
72-
return self.get_response_from_cell_silo(cell=cells[0])
73-
except ApiError as err:
74-
sentry_sdk.capture_exception(err)
75-
return self.get_response_from_control_silo()
70+
if self.view_class in self.immediate_response_cell_classes:
71+
if len(cells) == 1:
72+
try:
73+
return self.get_response_from_cell_silo(cell=cells[0])
74+
except ApiError as err:
75+
sentry_sdk.capture_exception(err)
76+
return self.get_response_from_control_silo()
77+
# TODO(cells): Remove once all installs have migrated to JiraSentryIssueDetailsControlView.
78+
return JiraSentryIssueDetailsControlView.as_view()(self.request, **self.match.kwargs)
7679

7780
if self.view_class in self.outbox_response_cell_classes:
7881
return self.get_response_from_webhookpayload(

tests/sentry/middleware/integrations/parsers/test_jira.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -185,26 +185,20 @@ def test_get_response_invalid_path(self) -> None:
185185

186186
@override_cells(region_config)
187187
@override_settings(SILO_MODE=SiloMode.CONTROL)
188-
@responses.activate
189188
def test_get_response_multiple_regions(self) -> None:
190-
responses.add(
191-
responses.POST,
192-
eu_locality.to_url("/extensions/jira/issue/LR-123/"),
193-
body="region response",
194-
status=200,
195-
)
196-
request = self.factory.post(path=f"{self.path_base}/issue/LR-123/")
189+
# Use GET — the view only handles GET, and Jira sends GET for issue hooks.
190+
request = self.factory.get(path=f"{self.path_base}/issue/LR-123/")
197191
parser = JiraRequestParser(request, self.get_response)
198192

199-
# Add a second organization. Jira only supports single regions.
200193
other_org = self.create_organization(owner=self.user, region="eu")
201194
integration = self.get_integration()
202195
integration.add_organization(other_org.id)
203196

204-
with patch.object(parser, "get_integration_from_request") as method:
205-
method.return_value = integration
206-
# Multi-cell installs fall back to control silo rather than raising
197+
with patch.object(parser, "get_integration_from_request") as mock_integration:
198+
mock_integration.return_value = integration
207199
response = parser.get_response()
208-
assert response.status_code == 200
209200

201+
# Must not 404 — multi-cell falls back to JiraSentryIssueDetailsControlView, not
202+
# get_response_from_control_silo() which would 404 via the @cell_silo_view restriction.
203+
assert response.status_code == 200
210204
assert_no_webhook_payloads()

0 commit comments

Comments
 (0)