Skip to content

feat(cells): Support multi-cell jira integration#111696

Merged
lynnagara merged 8 commits intomasterfrom
multicell-jira-support
Mar 30, 2026
Merged

feat(cells): Support multi-cell jira integration#111696
lynnagara merged 8 commits intomasterfrom
multicell-jira-support

Conversation

@lynnagara
Copy link
Copy Markdown
Member

note: this is behind a feature flag for safety, the default is unchanged (no multi-cell) and merging the code should be a no-op

note: this is behind a feature flag for safety, the default
is unchanged (no multi-cell) and merging the code should be a no-op
@lynnagara lynnagara requested a review from a team March 26, 2026 22:59
@lynnagara lynnagara requested review from a team as code owners March 26, 2026 22:59
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 26, 2026
Comment thread src/sentry/middleware/integrations/parsers/jira.py
Comment on lines +245 to +251
@property
def is_cell_restricted(self) -> bool:
"""
Returns True if each integration installation can only be connected on one cell of Sentry at a
time. It will raise an error if any organization from another cell attempts to install it.
"""
return False
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: Changing is_cell_restricted to a read-only @property will cause an AttributeError in tests that attempt to directly assign a value to it, leading to test failures.
Severity: HIGH

Suggested Fix

Update the tests that assign to self.provider.is_cell_restricted. Instead of direct assignment, use a mocking technique to set the property's return value for the test's duration. For example, use mock.patch.object with new_callable=mock.PropertyMock to temporarily override the property's behavior without triggering an AttributeError.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: src/sentry/integrations/base.py#L245-L251

Potential issue: The `is_cell_restricted` attribute in the `IntegrationProvider` class
was converted into a read-only `@property`. However, multiple tests in
`tests/sentry/integrations/test_pipeline.py` still attempt to directly assign a value to
this property, such as `self.provider.is_cell_restricted = True`. Since a read-only
property does not have a setter, these assignment attempts will raise an
`AttributeError` at runtime. This will cause any test that calls the
`_setup_cell_restriction()` helper method or directly sets the property to fail,
blocking the test suite from passing.

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

"target": {
"type": "web_panel",
"url": "/extensions/jira/issue/{issue.key}/",
"url": "/extensions/jira/issue-details/{issue.key}/",
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.

I don't know if Jira snapshots this into the Jira instances when the extension is added. We might need to keep the old URL around as well.

sentry_sdk.capture_exception(err)
return self.get_response_from_control_silo()
# TODO(cells): Remove once all installs have migrated to JiraSentryIssueDetailsControlView.
return JiraSentryIssueDetailsControlView.as_view()(self.request, **self.match.kwargs)
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.

This looks reasonable to me. This endpoint was added in #98324 with the intention of replacing the region scoped endpoint, but the transition work wasn't completed.

Copy link
Copy Markdown
Contributor

@cursor cursor bot left a comment

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 1 potential issue.

Fix All in Cursor

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

Comment thread tests/sentry/integrations/test_pipeline.py Outdated
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 27, 2026

Backend Test Failures

Failures on 5876536 in this run:

tests/sentry/integrations/test_pipeline.py::ApiFinishPipelineTestCase::test_api_finish_pipeline_cell_restriction_failurelog
tests/sentry/integrations/test_pipeline.py:865: in test_api_finish_pipeline_cell_restriction_failure
    assert result.action == PipelineStepAction.ERROR
E   AssertionError: assert <PipelineStep...E: 'complete'> == <PipelineStep...RROR: 'error'>
E     
E     - error
E     + complete
tests/sentry/integrations/test_pipeline.py::FinishPipelineTestCase::test_is_violating_cell_restriction_failurelog
tests/sentry/integrations/test_pipeline.py:201: in test_is_violating_cell_restriction_failure
    assert error_message in response.content.decode()
E   assert 'This integration has already been installed on another Sentry organization which resides in a different cell. Installation could not be completed.' in '\n\n\n\n\n\n\n<!DOCTYPE html>\n<html lang="en">\n<head>\n  <meta http-equiv="content-type" content="text/html; charse...ntentLoaded\', function() {\n      insertTimezone();\n      signOutListener();\n    });</script>\n\n</body>\n</html>\n'
E    +  where '\n\n\n\n\n\n\n<!DOCTYPE html>\n<html lang="en">\n<head>\n  <meta http-equiv="content-type" content="text/html; charse...ntentLoaded\', function() {\n      insertTimezone();\n      signOutListener();\n    });</script>\n\n</body>\n</html>\n' = <built-in method decode of bytes object at 0x55e1499acb90>()
E    +    where <built-in method decode of bytes object at 0x55e1499acb90> = b'\n\n\n\n\n\n\n<!DOCTYPE html>\n<html lang="en">\n<head>\n  <meta http-equiv="content-type" content="text/html; chars...ntentLoaded\', function() {\n      insertTimezone();\n      signOutListener();\n    });</script>\n\n</body>\n</html>\n'.decode
E    +      where b'\n\n\n\n\n\n\n<!DOCTYPE html>\n<html lang="en">\n<head>\n  <meta http-equiv="content-type" content="text/html; chars...ntentLoaded\', function() {\n      insertTimezone();\n      signOutListener();\n    });</script>\n\n</body>\n</html>\n' = <HttpResponse status_code=200, "text/html">.content
tests/sentry/integrations/test_pipeline.py::FinishPipelineTestCase::test_provider_should_check_cell_violationlog
tests/sentry/integrations/test_pipeline.py:153: in test_provider_should_check_cell_violation
    assert mock_check_violation.called
E   AssertionError: assert False
E    +  where False = <MagicMock name='is_violating_cell_restriction' id='140154799137728'>.called

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 27, 2026

Backend Test Failures

Failures on c5f1519 in this run:

tests/sentry/integrations/test_pipeline.py::FinishPipelineTestCase::test_is_violating_cell_restriction_failurelog
tests/sentry/integrations/test_pipeline.py:180: in test_is_violating_cell_restriction_failure
    assert error_message in response.content.decode()
E   assert 'This integration has already been installed on another Sentry organization which resides in a different cell. Installation could not be completed.' in '\n\n\n\n\n\n\n<!DOCTYPE html>\n<html lang="en">\n<head>\n  <meta http-equiv="content-type" content="text/html; charse...ntentLoaded\', function() {\n      insertTimezone();\n      signOutListener();\n    });</script>\n\n</body>\n</html>\n'
E    +  where '\n\n\n\n\n\n\n<!DOCTYPE html>\n<html lang="en">\n<head>\n  <meta http-equiv="content-type" content="text/html; charse...ntentLoaded\', function() {\n      insertTimezone();\n      signOutListener();\n    });</script>\n\n</body>\n</html>\n' = <built-in method decode of bytes object at 0x562011887f10>()
E    +    where <built-in method decode of bytes object at 0x562011887f10> = b'\n\n\n\n\n\n\n<!DOCTYPE html>\n<html lang="en">\n<head>\n  <meta http-equiv="content-type" content="text/html; chars...ntentLoaded\', function() {\n      insertTimezone();\n      signOutListener();\n    });</script>\n\n</body>\n</html>\n'.decode
E    +      where b'\n\n\n\n\n\n\n<!DOCTYPE html>\n<html lang="en">\n<head>\n  <meta http-equiv="content-type" content="text/html; chars...ntentLoaded\', function() {\n      insertTimezone();\n      signOutListener();\n    });</script>\n\n</body>\n</html>\n' = <HttpResponse status_code=200, "text/html">.content
tests/sentry/integrations/test_pipeline.py::ApiFinishPipelineTestCase::test_api_finish_pipeline_cell_restriction_failurelog
tests/sentry/integrations/test_pipeline.py:844: in test_api_finish_pipeline_cell_restriction_failure
    assert result.action == PipelineStepAction.ERROR
E   AssertionError: assert <PipelineStep...E: 'complete'> == <PipelineStep...RROR: 'error'>
E     
E     - error
E     + complete

@lynnagara lynnagara merged commit aed48e0 into master Mar 30, 2026
89 of 90 checks passed
@lynnagara lynnagara deleted the multicell-jira-support branch March 30, 2026 18:04
@github-actions github-actions bot locked and limited conversation to collaborators Apr 15, 2026
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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants