Skip to content

fix(jira): Only load saved project status mappings - #120481

Merged
Christinarlong merged 4 commits into
masterfrom
Christinarlong/jira-lazy-status-config
Jul 24, 2026
Merged

fix(jira): Only load saved project status mappings #120481
Christinarlong merged 4 commits into
masterfrom
Christinarlong/jira-lazy-status-config

Conversation

@Christinarlong

Copy link
Copy Markdown
Contributor

Instead of fetching and loading all of the project status mappings. Load only the ones that are currently configured. We will dynamically fetch other project statuses when they are added (see PR 1 of stack)

Step 2 of lazy loading Jira project statuses

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Jul 23, 2026
@Christinarlong
Christinarlong marked this pull request as ready for review July 23, 2026 18:11
@Christinarlong
Christinarlong requested a review from a team as a code owner July 23, 2026 18:11
@Christinarlong
Christinarlong requested a review from a team July 23, 2026 18:12
Comment thread src/sentry/integrations/jira/integration.py
Base automatically changed from Christinarlong/jira-duplicate-status-sync to master July 23, 2026 22:32
When `organizations:jira-lazy-status-sync` is enabled, pre-load
statuses only for already-configured projects (via
IntegrationExternalProject) and provide a `statusUrl` in the config
for the frontend to lazy-load statuses for new projects. When the flag
is off, existing threshold-based behavior is unchanged.

ISWF-1684
Rename _set_lazy_status_choices_in_organization_config to
_get_lazy_status_config and have it return a dict that the caller
merges, rather than mutating the configuration list in place.
@Christinarlong
Christinarlong force-pushed the Christinarlong/jira-lazy-status-config branch from c609d29 to 0104ea0 Compare July 23, 2026 22:32

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 0104ea0. Configure here.

"values", []
)
except ApiError:
continue

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Status fetch errors leave empty choices

Medium Severity

_get_lazy_status_config catches ApiError per project and continues, so failed status fetches omit that project from mappedSelectors while the form stays enabled. The non-lazy path re-raises and disables the field with an error message. Users can see configured mappings with empty status dropdowns and no indication that Jira communication failed.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0104ea0. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tradeoff is intentional so that we are able to load the other ones

mapped_selectors[project.external_id] = {
"on_resolve": {"choices": statuses},
"on_unresolve": {"choices": statuses},
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unbounded per-project status requests

Medium Severity

_get_lazy_status_config issues one serial get_project_statuses call for every saved IntegrationExternalProject with no cap. The existing path limits per-project queries via MAX_PER_PROJECT_QUERIES specifically to avoid Atlassian rate limits. Orgs with many configured mappings can hit timeouts or rate limits when loading config.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 0104ea0. Configure here.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Realistically i dont think we'll go over like 10 projects

@Christinarlong
Christinarlong merged commit 1ff30cb into master Jul 24, 2026
86 checks passed
@Christinarlong
Christinarlong deleted the Christinarlong/jira-lazy-status-config branch July 24, 2026 21:58
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.

2 participants