Skip to content

feat(jira): control endpoint for fetching issue summaries#98324

Merged
cathteng merged 8 commits intomasterfrom
cathy/jira/issue-details-control-api
Sep 8, 2025
Merged

feat(jira): control endpoint for fetching issue summaries#98324
cathteng merged 8 commits intomasterfrom
cathy/jira/issue-details-control-api

Conversation

@cathteng
Copy link
Copy Markdown
Contributor

@cathteng cathteng commented Aug 26, 2025

For RTC-43

Implement a new Control-Silo endpoint for Jira to use which will perform region fanouts for issue data.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Aug 26, 2025
@codecov
Copy link
Copy Markdown

codecov bot commented Aug 26, 2025

Codecov Report

❌ Patch coverage is 91.11111% with 4 lines in your changes missing coverage. Please review.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...ry/integrations/jira/views/sentry_issue_details.py 90.69% 4 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master   #98324    +/-   ##
========================================
  Coverage   81.17%   81.18%            
========================================
  Files        8536     8537     +1     
  Lines      376194   376322   +128     
  Branches    23922    23922            
========================================
+ Hits       305374   305507   +133     
+ Misses      70454    70449     -5     
  Partials      366      366            

@cathteng cathteng force-pushed the cathy/jira/issue-details-control-api branch from 135ead8 to f94bb55 Compare August 27, 2025 20:59
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Aug 27, 2025
@github-actions
Copy link
Copy Markdown
Contributor

🚨 Warning: This pull request contains Frontend and Backend changes!

It's discouraged to make changes to Sentry's Frontend and Backend in a single pull request. The Frontend and Backend are not atomically deployed. If the changes are interdependent of each other, they must be separated into two pull requests and be made forward or backwards compatible, such that the Backend or Frontend can be safely deployed independently.

Have questions? Please ask in the #discuss-dev-infra channel.

Base automatically changed from cathy/jira/issue-summary-rpc to master August 28, 2025 18:30
@cathteng cathteng force-pushed the cathy/jira/issue-details-control-api branch from f94bb55 to 4848d81 Compare August 28, 2025 18:34
@cathteng cathteng marked this pull request as ready for review August 28, 2025 20:04
@cathteng cathteng requested review from a team as code owners August 28, 2025 20:04
cursor[bot]

This comment was marked as outdated.

Comment on lines +236 to +242
for region_name in find_all_region_names():
region_groups = issue_service.get_external_issue_groups(
region_name=region_name, external_issue_key=issue_key, integration_id=integration.id
)
if region_groups is not None:
groups.extend(region_groups)
has_groups = True
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.

Potential bug: The region fanout loop in JiraSentryIssueDetailsControlView lacks error handling for RPC calls, causing the entire request to crash if any single region is unavailable or times out.
  • Description: The JiraSentryIssueDetailsControlView iterates through all regions to fetch linked Sentry issues using the issue_service.get_external_issue_groups() RPC call. This call can raise exceptions like RpcRemoteException, ConnectionError, or Timeout if a region is unavailable or experiences network issues. The loop at src/sentry/integrations/jira/views/sentry_issue_details.py:236~242 does not have a try/except block to handle these potential failures. As a result, an issue in any single region will cause the entire endpoint to fail with an unhandled exception, leading to a 500 error for the user instead of showing partial results from available regions.

  • Suggested fix: Wrap the issue_service.get_external_issue_groups() call inside the for loop with a try/except block. Catch relevant exceptions, such as RpcRemoteException, and log the error while allowing the loop to continue to the next region. This will make the endpoint more resilient to partial region failures.
    severity: 0.81, confidence: 0.95

Did we get this right? 👍 / 👎 to inform future reviews.

cursor[bot]

This comment was marked as outdated.

Copy link
Copy Markdown
Member

@leeandher leeandher left a comment

Choose a reason for hiding this comment

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

Approving since it all looks good! Just the one comment I think should be addressed but its a quick fix, great work 👏

Comment on lines +236 to +239
for region_name in find_all_region_names():
region_groups = issue_service.get_external_issue_groups(
region_name=region_name, external_issue_key=issue_key, integration_id=integration.id
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Rather than fanout to every region, we can filter to regions with an associated installation, this is what the parsers do.

Take a look at find_regions_for_orgs, and you can get the org_ids from something like:

organization_integrations = OrganizationIntegration.objects.filter(
  integration_id=integration.id,
  status=ObjectStatus.ACTIVE,
)
organization_ids = [oi.organization_id for oi in organization_integrations]

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.

Done! Thanks for the suggestion!


for group in [self.us_group, self.de_group]:
assert group.get_absolute_url() in resp_content

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.

Bug: Mock Ineffectiveness in Jira Issue Hook Test

The test_simple_get in JiraIssueHookControlTest mocks ExternalIssue.objects.get, but the JiraSentryIssueDetailsControlView uses issue_service.get_external_issue_groups(). This makes the mock ineffective for testing the control view's behavior. The mock's side effect also assumes a specific region processing order, which could lead to flakiness.

Fix in Cursor Fix in Web

@cathteng cathteng merged commit 01a4abe into master Sep 8, 2025
67 checks passed
@cathteng cathteng deleted the cathy/jira/issue-details-control-api branch September 8, 2025 17:21
@github-actions github-actions bot locked and limited conversation to collaborators Sep 24, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Backend Automatically applied to PRs that change backend components Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants