Skip to content

fix(jira): use paginated project endpoint in get_organization_config#116264

Closed
sentry-junior[bot] wants to merge 1 commit into
masterfrom
fix/jira-org-config-paginated-projects
Closed

fix(jira): use paginated project endpoint in get_organization_config#116264
sentry-junior[bot] wants to merge 1 commit into
masterfrom
fix/jira-org-config-paginated-projects

Conversation

@sentry-junior
Copy link
Copy Markdown
Contributor

@sentry-junior sentry-junior Bot commented May 26, 2026

Problem

The Jira integration settings page (e.g. /settings/integrations/jira/{id}/) spins forever for large Jira instances. Root cause: get_organization_config() calls get_projects_list(), which hits the deprecated unpaginated GET /rest/api/2/project endpoint. For enterprise instances with hundreds or thousands of projects this request times out before it can return, leaving the page in an infinite loading state.

Reported by Doctolib (enterprise customer). Existing issue: #95257.

Fix

Replace the get_projects_list() call with get_projects_paginated(params={"maxResults": 50}), capping the initial settings-page render to the first 50 projects. The existing typeahead search endpoint (JiraSearchEndpoint) already uses the paginated API with a query filter, so users can find any project not in the initial 50 by typing in the dropdown.

The 50 bound also ensures large instances (> 10 projects) still take the global-status fallback path in _set_status_choices_in_organization_config, preserving existing behavior.

What was verified

  • Added test_get_organization_config_uses_paginated_endpoint to confirm the paginated /project/search endpoint is hit (not the legacy /project) and that addDropdown.items is populated correctly.
  • Existing test_get_config_data / test_get_config_data_issue_keys are unaffected — they test get_config_data() which calls _filter_active_projects()get_projects_list(), a separate code path not changed here.
  • Could not run the full test suite locally; CI will confirm.

Out of scope

get_project_key_for_id() and _filter_active_projects() also call get_projects_list() and have the same underlying issue; those are separate follow-up candidates.

Fixes #95257


View Session in Sentry

Action taken on behalf of Nick Meisenheimer.

The settings page called get_projects_list() which hits the deprecated
unpaginated GET /rest/api/2/project endpoint, returning every Jira
project in a single response. For large enterprise instances this
causes timeouts, leaving the configuration page with an infinite
spinner.

Switch to get_projects_paginated(maxResults=50) so the initial
settings-page render is bounded. Projects beyond the first 50 are
accessible via the existing typeahead search endpoint (JiraSearchEndpoint),
which already uses the paginated API.

Fixes #95257

Co-authored-by: Nick Meisenheimer <nick.meisenheimer@sentry.io>
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 26, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Backend Test Failures

Failures on b71f9fb in this run:

tests/sentry/integrations/jira/test_integration.py::JiraIntegrationTest::test_get_organization_config_uses_paginated_endpointlog
[gw1] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/integrations/jira/test_integration.py:1250: in test_get_organization_config_uses_paginated_endpoint
    assert len(add_dropdown_items) == 2
E   assert 0 == 2
E    +  where 0 = len([])

@hobzcalvin hobzcalvin closed this May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cannot finish configurations for Jira integration install

1 participant