From 98177cf8b62bd07ddabf7191393307b91eaa91df Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Thu, 17 Sep 2026 23:12:18 +0000 Subject: [PATCH 1/2] fix(jira-server): bound issue search results Co-Authored-By: Christina Long <60594860+Christinarlong@users.noreply.github.com> --- src/sentry/integrations/jira_server/client.py | 5 ++- .../integrations/jira_server/test_client.py | 22 ++++++++++- .../integrations/jira_server/test_search.py | 37 +++++++++++++++++-- 3 files changed, 58 insertions(+), 6 deletions(-) diff --git a/src/sentry/integrations/jira_server/client.py b/src/sentry/integrations/jira_server/client.py index 951a020f51c1..31bac1a135ae 100644 --- a/src/sentry/integrations/jira_server/client.py +++ b/src/sentry/integrations/jira_server/client.py @@ -114,7 +114,10 @@ def search_issues(self, query): else: q = query.replace('"', '\\"') jql = f'text ~ "{q}"' - return self.get(self.SEARCH_URL, params={"jql": jql}) + return self.get( + self.SEARCH_URL, + params={"jql": jql, "startAt": 0, "maxResults": 50, "fields": "summary"}, + ) def create_comment(self, issue_key, comment): return self.post(self.COMMENTS_URL % issue_key, data={"body": comment}) diff --git a/tests/sentry/integrations/jira_server/test_client.py b/tests/sentry/integrations/jira_server/test_client.py index b240778b6ab2..00c5e3e88a54 100644 --- a/tests/sentry/integrations/jira_server/test_client.py +++ b/tests/sentry/integrations/jira_server/test_client.py @@ -69,7 +69,16 @@ def test_search_issues_with_pasted_issue_url(self) -> None: responses.add( method=responses.GET, url="https://jira.example.com/rest/api/2/search/", - match=[query_param_matcher({"jql": 'id="ABC-123"'})], + match=[ + query_param_matcher( + { + "jql": 'id="ABC-123"', + "startAt": 0, + "maxResults": 50, + "fields": "summary", + } + ) + ], body=json.dumps(body), status=200, content_type="application/json", @@ -83,7 +92,16 @@ def test_search_issues_with_free_text(self) -> None: responses.add( method=responses.GET, url="https://jira.example.com/rest/api/2/search/", - match=[query_param_matcher({"jql": 'text ~ "login crash"'})], + match=[ + query_param_matcher( + { + "jql": 'text ~ "login crash"', + "startAt": 0, + "maxResults": 50, + "fields": "summary", + } + ) + ], body=json.dumps(body), status=200, content_type="application/json", diff --git a/tests/sentry/integrations/jira_server/test_search.py b/tests/sentry/integrations/jira_server/test_search.py index f5b13841f6b1..064dac666e56 100644 --- a/tests/sentry/integrations/jira_server/test_search.py +++ b/tests/sentry/integrations/jira_server/test_search.py @@ -3,6 +3,7 @@ import responses from django.urls import reverse +from responses.matchers import query_param_matcher from sentry.testutils.cases import APITestCase from sentry.testutils.silo import control_silo_test @@ -22,7 +23,17 @@ def test_get_success_text_search(self) -> None: integration = self.integration responses.add( responses.GET, - 'https://jira.example.org/rest/api/2/search/?jql=text ~ "test"', + "https://jira.example.org/rest/api/2/search/", + match=[ + query_param_matcher( + { + "jql": 'text ~ "test"', + "startAt": 0, + "maxResults": 50, + "fields": "summary", + } + ) + ], body=EXAMPLE_ISSUE_SEARCH, content_type="json", ) @@ -40,7 +51,17 @@ def test_get_success_id_search(self) -> None: integration = self.integration responses.add( responses.GET, - 'https://jira.example.org/rest/api/2/search/?jql=id="HSP-1"', + "https://jira.example.org/rest/api/2/search/", + match=[ + query_param_matcher( + { + "jql": 'id="HSP-1"', + "startAt": 0, + "maxResults": 50, + "fields": "summary", + } + ) + ], body=EXAMPLE_ISSUE_SEARCH, content_type="json", ) @@ -58,7 +79,17 @@ def test_get_network_error(self) -> None: integration = self.integration responses.add( responses.GET, - 'https://jira.example.org/rest/api/2/search/?jql=id="HSP-1"', + "https://jira.example.org/rest/api/2/search/", + match=[ + query_param_matcher( + { + "jql": 'id="HSP-1"', + "startAt": 0, + "maxResults": 50, + "fields": "summary", + } + ) + ], status=502, body="

We are down

", ) From 53aa3965ed9b9531a17fca47536513b43af26db6 Mon Sep 17 00:00:00 2001 From: "sentry-junior[bot]" <264270552+sentry-junior[bot]@users.noreply.github.com> Date: Fri, 18 Sep 2026 17:05:19 +0000 Subject: [PATCH 2/2] ref(jira-server): lower issue search limit --- src/sentry/integrations/jira_server/client.py | 2 +- tests/sentry/integrations/jira_server/test_client.py | 4 ++-- tests/sentry/integrations/jira_server/test_search.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sentry/integrations/jira_server/client.py b/src/sentry/integrations/jira_server/client.py index 31bac1a135ae..0befa0a4b3a7 100644 --- a/src/sentry/integrations/jira_server/client.py +++ b/src/sentry/integrations/jira_server/client.py @@ -116,7 +116,7 @@ def search_issues(self, query): jql = f'text ~ "{q}"' return self.get( self.SEARCH_URL, - params={"jql": jql, "startAt": 0, "maxResults": 50, "fields": "summary"}, + params={"jql": jql, "startAt": 0, "maxResults": 20, "fields": "summary"}, ) def create_comment(self, issue_key, comment): diff --git a/tests/sentry/integrations/jira_server/test_client.py b/tests/sentry/integrations/jira_server/test_client.py index 00c5e3e88a54..80a92ae1add8 100644 --- a/tests/sentry/integrations/jira_server/test_client.py +++ b/tests/sentry/integrations/jira_server/test_client.py @@ -74,7 +74,7 @@ def test_search_issues_with_pasted_issue_url(self) -> None: { "jql": 'id="ABC-123"', "startAt": 0, - "maxResults": 50, + "maxResults": 20, "fields": "summary", } ) @@ -97,7 +97,7 @@ def test_search_issues_with_free_text(self) -> None: { "jql": 'text ~ "login crash"', "startAt": 0, - "maxResults": 50, + "maxResults": 20, "fields": "summary", } ) diff --git a/tests/sentry/integrations/jira_server/test_search.py b/tests/sentry/integrations/jira_server/test_search.py index 064dac666e56..1febc6134af0 100644 --- a/tests/sentry/integrations/jira_server/test_search.py +++ b/tests/sentry/integrations/jira_server/test_search.py @@ -29,7 +29,7 @@ def test_get_success_text_search(self) -> None: { "jql": 'text ~ "test"', "startAt": 0, - "maxResults": 50, + "maxResults": 20, "fields": "summary", } ) @@ -57,7 +57,7 @@ def test_get_success_id_search(self) -> None: { "jql": 'id="HSP-1"', "startAt": 0, - "maxResults": 50, + "maxResults": 20, "fields": "summary", } ) @@ -85,7 +85,7 @@ def test_get_network_error(self) -> None: { "jql": 'id="HSP-1"', "startAt": 0, - "maxResults": 50, + "maxResults": 20, "fields": "summary", } )