Skip to content

feat(integrations): Dual-write SCM org-option toggles onto OrganizationIntegration config#113842

Merged
evanpurkhiser merged 1 commit intomasterfrom
evanpurkhiser/feat-integrations-dual-write-scm-org-option-toggles-onto-organizationintegration-config
Apr 23, 2026
Merged

feat(integrations): Dual-write SCM org-option toggles onto OrganizationIntegration config#113842
evanpurkhiser merged 1 commit intomasterfrom
evanpurkhiser/feat-integrations-dual-write-scm-org-option-toggles-onto-organizationintegration-config

Conversation

@evanpurkhiser
Copy link
Copy Markdown
Member

@evanpurkhiser evanpurkhiser commented Apr 23, 2026

Phase 1 of VDY-110. The GitHub and GitLab PR-comment and missing-member
toggles are moving from OrganizationOption onto OrganizationIntegration.config
so each install is independently configurable.

  • OrganizationSerializer.save() now fans out writes to
    sentry:github_pr_bot, sentry:github_nudge_invite, and
    sentry:gitlab_pr_bot onto the corresponding per-integration config
    key (pr_comments / nudge_invite), scoped to active integrations.
  • The fan-out is deferred to transaction.on_commit so the RPC to the
    control silo happens outside the cell-silo write transaction.

Reads still go through OrganizationOption; behavior is unchanged for
users. The next phase flips the read path.

Ref: VDY-111: Phase 1: Dual-write SCM settings to integration config + backfill

Migration phases

  • ● Phase 1 — Backfill existing OIs: #113841 (merged)
  • ○ Phase 1 — Backfill cross-silo fix: #113908
  • ○ Phase 1 — Dual-write SCM toggles: #113842
  • ○ Phase 2 — Read from OI config behind flag: #113864
  • ○ Phase 3 — Expose toggles in per-install UI: #113923
  • ○ Phase 3 — Remove legacy detail-view toggles (frontend): #113924
  • ○ Phase 3 — Drop SCM toggle fields from PUT endpoint: #113925
  • ○ Phase 4 — Remove legacy code paths: upcoming

@evanpurkhiser evanpurkhiser requested review from a team and wedamija April 23, 2026 18:54
@evanpurkhiser evanpurkhiser requested a review from a team as a code owner April 23, 2026 18:54
@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
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-integrations-dual-write-scm-org-option-toggles-onto-organizationintegration-config branch from f36eae8 to 49a8410 Compare April 23, 2026 19:04
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-integrations-dual-write-scm-org-option-toggles-onto-organizationintegration-config branch from 49a8410 to 4520898 Compare April 23, 2026 20:11
Comment thread src/sentry/core/endpoints/organization_details.py Outdated
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-integrations-dual-write-scm-org-option-toggles-onto-organizationintegration-config branch from 4520898 to 369e90c Compare April 23, 2026 20:41
@evanpurkhiser evanpurkhiser requested review from a team as code owners April 23, 2026 20:41
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Apr 23, 2026
@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.

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 369e90c. Configure here.

Comment thread src/sentry/integrations/source_code_management/tasks.py Outdated
Comment thread src/sentry/integrations/source_code_management/sync_repos.py Outdated
@github-actions
Copy link
Copy Markdown
Contributor

This PR has a migration; here is the generated SQL for src/sentry/migrations/1072_backfill_scm_integration_config.py

for 1072_backfill_scm_integration_config in sentry

--
-- Raw Python operation
--
-- THIS OPERATION CANNOT BE WRITTEN AS SQL

…onIntegration config

Phase 1 of VDY-110. The GitHub and GitLab PR-comment and missing-member
toggles are moving from OrganizationOption onto OrganizationIntegration.config
so each install is independently configurable.

- OrganizationSerializer.save() now fans out writes to
  sentry:github_pr_bot, sentry:github_nudge_invite, and
  sentry:gitlab_pr_bot onto the corresponding per-integration config
  key (pr_comments / nudge_invite), scoped to active integrations.
- The fan-out is deferred to transaction.on_commit so the RPC to the
  control silo happens outside the cell-silo write transaction.

Reads still go through OrganizationOption; behavior is unchanged for
users. The next phase flips the read path.

Fixes: [VDY-111](https://linear.app/getsentry/issue/VDY-111/phase-1-dual-write-scm-settings-to-integration-config-backfill)
@evanpurkhiser evanpurkhiser force-pushed the evanpurkhiser/feat-integrations-dual-write-scm-org-option-toggles-onto-organizationintegration-config branch from 369e90c to 9474015 Compare April 23, 2026 20:54
Copy link
Copy Markdown
Member

@wedamija wedamija left a comment

Choose a reason for hiding this comment

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

lgtm. It'd be good to have claude put together an audit sql script that we can run after the backfill has finished to validate that these all synced as expected

@evanpurkhiser
Copy link
Copy Markdown
Member Author

Yeah that sounds good

@evanpurkhiser evanpurkhiser merged commit 1262a4c into master Apr 23, 2026
58 checks passed
@evanpurkhiser evanpurkhiser deleted the evanpurkhiser/feat-integrations-dual-write-scm-org-option-toggles-onto-organizationintegration-config branch April 23, 2026 21:14
@evanpurkhiser evanpurkhiser requested review from a team and wedamija April 23, 2026 21:19
evanpurkhiser added a commit that referenced this pull request Apr 24, 2026
…zationIntegration config (#113841)

Phase 1 of VDY-110. Adds post-deployment migration 1072 that seeds
OrganizationIntegration.config.pr_comments and .nudge_invite from each
org's current sentry:github_pr_bot / sentry:github_nudge_invite /
sentry:gitlab_pr_bot OrganizationOption value, scoped to active GitHub
and GitLab OIs.

The migration is idempotent: it only writes keys that are not already
present on the OI config, so it can be re-run safely and will not
clobber anything seeded by later code. Lands after the dual-write so
new installs are already mirroring before the backfill fills in the
existing population.

Ref:
[VDY-110](https://linear.app/getsentry/issue/VDY-110/move-scm-integration-settings-from-org-options-to-per-integration)

## Migration phases

- ○ Phase 1 — Dual-write SCM toggles:
[#113842](#113842)
- ○ Phase 1 — Backfill existing OIs:
[#113841](#113841) _(This PR)_
- ○ Phase 2 — Read from OI config behind flag:
[#113864](#113864)
- ○ Phase 3 — UI move: upcoming
- ○ Phase 4 — Remove legacy code paths: upcoming
evanpurkhiser added a commit that referenced this pull request Apr 24, 2026
The Phase 1 backfill (migration 1072) is routed to the control silo by
the `sentry_organizationintegration` table hint, but the previous
implementation read `sentry_organizationoptions` directly — that table
lives on the region silo, so the migration blew up with `relation
"sentry_organizationoptions" does not exist` when run against control in
production.

Swap the direct ORM read for `organization_service.get_option`, which is
a cell RPC that dispatches to the region silo. Cache results per
`(org_id, option_key)` since a single org may own multiple OIs and we'd
otherwise issue the same RPC repeatedly.

Ref: [VDY-111: Phase 1: Dual-write SCM settings to integration config +
backfill](https://linear.app/getsentry/issue/VDY-111/phase-1-dual-write-scm-settings-to-integration-config-backfill)

## Migration phases

- ○ Phase 1 — Dual-write SCM toggles:
[#113842](#113842)
- ● Phase 1 — Backfill existing OIs:
[#113841](#113841) (merged; this
PR fixes the cross-silo bug)
- ○ Phase 2 — Read from OI config behind flag:
[#113864](#113864)
- ○ Phase 3 — UI move: upcoming
- ○ Phase 4 — Remove legacy code paths: upcoming
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 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