Skip to content

feat: Remove Legacy Seer toggle BE code and update preflight checks#111049

Merged
ajay-sentry merged 4 commits intomasterfrom
Ajay/legacy-seer-toggle-be-removal-and-preflight-updates
Mar 19, 2026
Merged

feat: Remove Legacy Seer toggle BE code and update preflight checks#111049
ajay-sentry merged 4 commits intomasterfrom
Ajay/legacy-seer-toggle-be-removal-and-preflight-updates

Conversation

@ajay-sentry
Copy link
Copy Markdown
Contributor

@ajay-sentry ajay-sentry commented Mar 18, 2026

This PR does a couple things:

  • Simplifies code review preflight to use RepositorySettings as the source of truth across all eligible cohorts
  • Removes backend exposure and handling of the deprecated org option sentry:enable_pr_review_test_generation
  • Updates related tests.

Higher level task: https://linear.app/getsentry/issue/CW-1005/consolidate-seer-settings-product-experience-across-legacy-and-new

Depends on #111055 (removing FE toggle)
Depends on https://github.com/getsentry/getsentry/pull/19606 (backfill repo settings rows)

Closes https://linear.app/getsentry/issue/CW-1059/change-pointer-for-beta-orgs-to-look-at-repository-settings-rows
Relates to https://linear.app/getsentry/issue/CW-1060/remove-sentryenable-pr-review-test-generation-option-values-from-db

Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.

@ajay-sentry ajay-sentry requested review from a team as code owners March 18, 2026 22:58
@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Mar 18, 2026
Comment thread src/sentry/testutils/helpers/github.py
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Mar 18, 2026

Backend Test Failures

Failures on f227ebf in this run:

tests/sentry/seer/code_review/webhooks/test_pull_request.py::PullRequestEventWebhookTest::test_pull_request_closed_draft_still_sends_to_seerlog
tests/sentry/seer/code_review/webhooks/test_pull_request.py:386: in test_pull_request_closed_draft_still_sends_to_seer
    self.mock_seer.assert_called_once()
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:956: in assert_called_once
    raise AssertionError(msg)
E   AssertionError: Expected 'make_seer_request' to have been called once. Called 0 times.
tests/sentry/seer/code_review/webhooks/test_pull_request.py::PullRequestEventWebhookTest::test_pull_request_synchronize_actionlog
tests/sentry/seer/code_review/webhooks/test_pull_request.py:185: in test_pull_request_synchronize_action
    self.mock_seer.assert_called_once()
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:956: in assert_called_once
    raise AssertionError(msg)
E   AssertionError: Expected 'make_seer_request' to have been called once. Called 0 times.
tests/sentry/seer/code_review/webhooks/test_pull_request.py::PullRequestEventWebhookTest::test_pull_request_ready_for_review_actionlog
tests/sentry/seer/code_review/webhooks/test_pull_request.py:158: in test_pull_request_ready_for_review_action
    self.mock_seer.assert_called_once()
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:956: in assert_called_once
    raise AssertionError(msg)
E   AssertionError: Expected 'make_seer_request' to have been called once. Called 0 times.
tests/sentry/seer/code_review/webhooks/test_pull_request.py::PullRequestEventWebhookTest::test_pull_request_closed_uses_pr_closed_endpointlog
tests/sentry/seer/code_review/webhooks/test_pull_request.py:244: in test_pull_request_closed_uses_pr_closed_endpoint
    self.mock_seer.assert_called_once()
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:956: in assert_called_once
    raise AssertionError(msg)
E   AssertionError: Expected 'make_seer_request' to have been called once. Called 0 times.
tests/sentry/seer/code_review/webhooks/test_check_run.py::CheckRunEventWebhookTest::test_check_run_enqueues_task_for_processinglog
tests/sentry/seer/code_review/webhooks/test_check_run.py:108: in test_check_run_enqueues_task_for_processing
    mock_task.delay.assert_called_once()
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:956: in assert_called_once
    raise AssertionError(msg)
E   AssertionError: Expected 'delay' to have been called once. Called 0 times.
tests/sentry/seer/code_review/webhooks/test_check_run.py::CheckRunEventWebhookTest::test_check_run_fails_when_action_missinglog
tests/sentry/seer/code_review/webhooks/test_check_run.py:56: in test_check_run_fails_when_action_missing
    mock_logger.error.assert_called_once()
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:956: in assert_called_once
    raise AssertionError(msg)
E   AssertionError: Expected 'error' to have been called once. Called 0 times.
tests/sentry/seer/code_review/webhooks/test_issue_comment.py::IssueCommentEventWebhookTest::test_skips_reaction_when_no_comment_idlog
tests/sentry/seer/code_review/webhooks/test_issue_comment.py:134: in test_skips_reaction_when_no_comment_id
    self.mock_seer.assert_called_once()
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:956: in assert_called_once
    raise AssertionError(msg)
E   AssertionError: Expected 'make_seer_request' to have been called once. Called 0 times.
tests/sentry/seer/code_review/webhooks/test_check_run.py::CheckRunEventWebhookTest::test_check_run_fails_when_external_id_missinglog
tests/sentry/seer/code_review/webhooks/test_check_run.py:72: in test_check_run_fails_when_external_id_missing
    mock_logger.exception.assert_called_once()
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:956: in assert_called_once
    raise AssertionError(msg)
E   AssertionError: Expected 'exception' to have been called once. Called 0 times.
tests/sentry/seer/code_review/webhooks/test_check_run.py::CheckRunEventWebhookTest::test_check_run_fails_when_external_id_not_numericlog
tests/sentry/seer/code_review/webhooks/test_check_run.py:93: in test_check_run_fails_when_external_id_not_numeric
    mock_logger.exception.assert_called_once()
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:956: in assert_called_once
    raise AssertionError(msg)
E   AssertionError: Expected 'exception' to have been called once. Called 0 times.
tests/sentry/seer/code_review/webhooks/test_pull_request.py::PullRequestEventWebhookTest::test_pull_request_opened_uses_review_request_endpointlog
tests/sentry/seer/code_review/webhooks/test_pull_request.py:72: in test_pull_request_opened_uses_review_request_endpoint
    self.mock_seer.assert_called_once()
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:956: in assert_called_once
    raise AssertionError(msg)
E   AssertionError: Expected 'make_seer_request' to have been called once. Called 0 times.
tests/sentry/seer/code_review/webhooks/test_check_run.py::CheckRunEventWebhookTest::test_base_caselog
tests/sentry/seer/code_review/webhooks/test_check_run.py:25: in test_base_case
    mock_task.delay.assert_called_once()
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:956: in assert_called_once
    raise AssertionError(msg)
E   AssertionError: Expected 'delay' to have been called once. Called 0 times.
tests/sentry/seer/code_review/webhooks/test_issue_comment.py::IssueCommentEventWebhookTest::test_success_case_uses_review_request_endpointlog
tests/sentry/seer/code_review/webhooks/test_issue_comment.py:155: in test_success_case_uses_review_request_endpoint
    self.mock_reaction.assert_called_once_with(
/opt/hostedtoolcache/Python/3.13.1/x64/lib/python3.13/unittest/mock.py:988: in assert_called_once_with
    raise AssertionError(msg)
E   AssertionError: Expected 'create_comment_reaction' to be called once. Called 0 times.

Comment thread src/sentry/seer/code_review/preflight.py
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/seer/code_review/test_preflight.py
Copy link
Copy Markdown
Contributor

@suejungshin suejungshin left a comment

Choose a reason for hiding this comment

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

Nice updates. Reminder to wait until the new RepositorySettings rows are fully written before merging this.

ajay-sentry added a commit that referenced this pull request Mar 19, 2026
Part of
https://linear.app/getsentry/issue/CW-1060/remove-sentryenable-pr-review-test-generation-option-values-from-db
Closes
https://linear.app/getsentry/issue/CW-1063/remove-enable-ai-code-review-toggle-fe
Blocks #111049

In the PR linked above we're swapping over to using the repository
settings as the source of truth for all users: seat based, beta, or
legacy. We no longer need this setting, and will remove that
"legacyseer" conditional to just route to the new settings page very
soon too.


Before
<img width="1643" height="540" alt="Screenshot 2026-03-18 at 4 28 05 PM"
src="https://github.com/user-attachments/assets/7bde033d-1770-4563-9aa3-2679518a615d"
/>

After
<img width="1459" height="601" alt="Screenshot 2026-03-18 at 4 26 25 PM"
src="https://github.com/user-attachments/assets/599c34fc-1ec1-49df-a8d7-928828ed2d4d"
/>


<!--

  Sentry employees and contractors can delete or ignore the following.

-->

### Legal Boilerplate

Look, I get it. The entity doing business as "Sentry" was incorporated
in the State of Delaware in 2015 as Functional Software, Inc. and is
gonna need some rights from me in order to utilize my contributions in
this here PR. So here's the deal: I retain all rights, title and
interest in and to my contributions, and by keeping this boilerplate
intact I confirm that Sentry can use, modify, copy, and redistribute my
contributions, under Sentry's choice of terms.
Comment thread src/sentry/seer/code_review/preflight.py
@ajay-sentry ajay-sentry enabled auto-merge (squash) March 19, 2026 21:31
@ajay-sentry ajay-sentry merged commit 01b3e51 into master Mar 19, 2026
80 of 81 checks passed
@ajay-sentry ajay-sentry deleted the Ajay/legacy-seer-toggle-be-removal-and-preflight-updates branch March 19, 2026 21:36
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 4, 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