Skip to content

ref(seer): Read project preferences only from Sentry DB, part 1#113835

Merged
srest2021 merged 7 commits intomasterfrom
srest2021/CW-1175-pt1
Apr 24, 2026
Merged

ref(seer): Read project preferences only from Sentry DB, part 1#113835
srest2021 merged 7 commits intomasterfrom
srest2021/CW-1175-pt1

Conversation

@srest2021
Copy link
Copy Markdown
Member

@srest2021 srest2021 commented Apr 23, 2026

Relates to CW-1175

First step in migrating project-preference reads off the Seer API. Flips the following read call sites to read from the Sentry DB and removes the organizations:seer-project-settings-read-from-sentry flag from them. Writes still dual-write via the Seer API. Types tightened where possible.

Modified callsites:

  • ProjectSeerPreferencesEndpoint.get
  • Seer RPCs get_project_preferences / bulk_get_project_preferences
  • has_project_connected_repos and removed the Seer API cache (no longer needed for a local DB hit)
  • Deleted the bulk_read_preferences wrapper and _resolve_project_preference; callers use bulk_read_preferences_from_sentry_db / read_preference_from_sentry_db directly. _call_autofix now derives repos from preference.repositories itself.
  • night shift _get_eligible_projects and context engine index_repos consume typed SeerProjectPreference objects directly instead of dict round-tripping

Affected tests updated to create real SeerProjectRepository rows and project options instead of mocking the Seer API. Removed tests for now-unreachable Seer-API fallback paths. Most of this large PR is just updated tests :)

@linear-code
Copy link
Copy Markdown

linear-code Bot commented Apr 23, 2026

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Apr 23, 2026
@srest2021 srest2021 changed the title ref(seer): Read project preferences only from Sentry DB ref(seer): Read project preferences only from Sentry DB, part 1 Apr 23, 2026
Comment thread src/sentry/seer/autofix/utils.py Outdated
…nce delete

The _resolve_project_preference mocks in these tests targeted a function
that no longer exists, and the tests asserted on a removed `repos` kwarg
to _call_autofix. Replace mocks with real SeerProjectRepository setup
and assert on call_kwargs["preference"].repositories instead.

Refs CW-1175
@github-actions
Copy link
Copy Markdown
Contributor

Backend Test Failures

Failures on 3037f79 in this run:

tests/sentry/tasks/seer/test_context_engine_index.py::TestIndexRepos::test_skips_projects_without_seer_repositorieslog
[gw0] linux -- Python 3.13.1 /home/runner/work/sentry/sentry/.venv/bin/python3
tests/sentry/tasks/seer/test_context_engine_index.py:399: in test_skips_projects_without_seer_repositories
    assert repos[0]["project_ids"] == ["getsentry"]
E   AssertionError: assert [4558019327033360] == ['getsentry']
E     
E     At index 0 diff: 4558019327033360 != 'getsentry'
E     
E     Full diff:
E       [
E     -     'getsentry',
E     +     4558019327033360,
E       ]

@srest2021 srest2021 marked this pull request as ready for review April 23, 2026 21:07
@srest2021 srest2021 requested a review from a team as a code owner April 23, 2026 21:07
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.

Reviewed by Cursor Bugbot for commit 3aa1cc4. Configure here.

Comment thread src/sentry/seer/autofix/utils.py
@srest2021 srest2021 merged commit 2670b19 into master Apr 24, 2026
62 checks passed
@srest2021 srest2021 deleted the srest2021/CW-1175-pt1 branch April 24, 2026 17:26
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