Skip to content

feat(webhooks): Add live-run flag to override circuit breaker dry-run#114820

Draft
Christinarlong wants to merge 1 commit intomasterfrom
Christinarlong/rollout-circuit-breaker-non-dry-run
Draft

feat(webhooks): Add live-run flag to override circuit breaker dry-run#114820
Christinarlong wants to merge 1 commit intomasterfrom
Christinarlong/rollout-circuit-breaker-non-dry-run

Conversation

@Christinarlong
Copy link
Copy Markdown
Contributor

Summary

Adds a new organizations:sentry-app-webhook-circuit-breaker-live-run FlagPole flag that, when enabled for an app owner's org, overrides the global dry-run option to enable real webhook blocking and email notifications. This allows gradual rollout of circuit breaker enforcement per app-owner org while keeping dry-run observability for the rest of the population.

  • Registered the new flag in temporary.py (FLAGPOLE, api_expose=False)
  • _circuit_breaker_allows_request now checks the live-run flag via owner_context — if dry-run is on but live-run is enabled for the owner org, it blocks instead of emitting would_block
  • _notify_webhook_disabled does the same check — if live-run is enabled, it sends the real email instead of logging would_email
  • Dedup key ordering in _notify_webhook_disabled is split so dry-run and live-run paths each guard their own dedup independently, preventing a dry-run dedup from suppressing the first real email after a flip to live-run

No FlagPole config change ships with this PR — rollout happens via sentry-options-automator after merge.

Refs ISWF-2549

Test plan

  • Added WebhookCircuitBreakerLiveRunTest test class with 5 new tests:
    • test_live_run_flag_overrides_dry_run_and_blocks — dry-run=True + live-run flag → blocks
    • test_live_run_flag_off_with_dry_run_still_emits_metric — regression guard for dry-run path
    • test_live_run_flag_sends_email_even_when_dry_run_option_true — live-run flag → real email
    • test_live_run_flag_off_with_dry_run_still_logs_would_email — regression guard for email path
    • test_dedup_does_not_suppress_first_email_after_flip_to_live_run — dedup ordering fix
  • Existing circuit breaker tests still pass
  • prek run -q passes locally

…r dry-run

Adds a new `organizations:sentry-app-webhook-circuit-breaker-live-run` feature
flag that, when enabled for an app owner's org, overrides the global dry-run
option to enable real webhook blocking and email notifications. This allows
gradual rollout of circuit breaker enforcement per app-owner org while keeping
dry-run observability for the rest of the population.

The live-run state is computed once in `send_and_save_webhook_request` and
threaded into both `_circuit_breaker_allows_request` (block path) and
`_notify_webhook_disabled` (email path) to keep behavior consistent.

Refs ISWF-2549

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
@linear-code
Copy link
Copy Markdown

linear-code Bot commented May 4, 2026

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label May 4, 2026
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.

1 participant