feat(seer): Add dual-write for Seer project preferences to ProjectOptions and SeerProjectRepository#110704
Draft
feat(seer): Add dual-write for Seer project preferences to ProjectOptions and SeerProjectRepository#110704
Conversation
Phase 1 step 4 of the Seer preference migration. After every successful write to Seer's preference endpoints, also write the same data to Sentry's DB (ProjectOption keys + SeerProjectRepository rows) when the organizations:seer-project-settings-dual-write feature flag is enabled. If the Sentry write fails, log and continue — Seer remains the read source. Write sites updated: - set_project_seer_preference (single project) - bulk_set_project_preferences (bulk) - ProjectSeerPreferencesEndpoint.post (direct endpoint) Also registers the feature flag, adds preference default constants to constants.py, and wires them into projectoptions/defaults.py. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
Replace dict access with typed SeerProjectPreference attributes in write_preference_project_options and _dual_write_preference_to_sentry_db. Move inline imports to top-level. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
Remove four single-use constants for seer automation handoff defaults and inline their values directly in the register() calls. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
srest2021
commented
Mar 13, 2026
| SeerProjectRepositoryBranchOverride.objects.bulk_create(overrides_to_create) | ||
|
|
||
|
|
||
| def write_preference_to_sentry_db(project: Project, preference: SeerProjectPreference) -> None: |
Member
Author
There was a problem hiding this comment.
"to_sentry_db" is not the best naming but I think this can get cleaned up after we remove the old write paths. Otherwise it will get too confusing having many seer project preference functions with similar names doing different things.
Contributor
Backend Test FailuresFailures on
|
Contributor
Backend Test FailuresFailures on
|
Separate the dual-write logic from set_project_seer_preference and bulk_set_project_preferences so each callsite controls its own feature-flagged write. This avoids re-fetching projects that callers already have and makes the Seer API helpers single-responsibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
srest2021
commented
Mar 14, 2026
src/sentry/seer/endpoints/organization_autofix_automation_settings.py
Outdated
Show resolved
Hide resolved
Contributor
Backend Test FailuresFailures on
|
srest2021
commented
Mar 14, 2026
| if repo is None: | ||
| return Response({"detail": "Invalid repository"}, status=400) | ||
|
|
||
| repo_data["repository_id"] = repo.id |
Member
Author
There was a problem hiding this comment.
I'm not sure how to handle the edge case where there is more than one repo.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
relates to AIML-2605
Adds dual-write so that all Seer project preference writes also persist to Sentry's DB (ProjectOption keys + SeerProjectRepository rows), gated behind the organizations:seer-project-settings-dual-write feature flag. This is Phase 1 Step 4 of the Seer preferences migration — once reads are cut over in later phases, the Seer API calls get removed and these DB writes become the primary path.
We only write to DB if the Seer call succeeded.