Skip to content

feat(code-review): Register experiments feature flag#107478

Merged
giovanni-guidini merged 2 commits intomasterfrom
feat/cw-696-port-experiments-flag
Feb 4, 2026
Merged

feat(code-review): Register experiments feature flag#107478
giovanni-guidini merged 2 commits intomasterfrom
feat/cw-696-port-experiments-flag

Conversation

@giovanni-guidini
Copy link
Copy Markdown
Contributor

Summary

Ports only the feature flag from PR #107230 to control org-level eligibility for code review experiments.

This PR implements the simplified architecture decided in CW-696 (see latest comment 2026-02-03):

  • Included: Feature flag organizations:code-review-experiments-enabled for org eligibility control
  • Not included: Option code-review.experiments (moved to Seer)
  • Not included: Hash bucket assignment logic (moved to Seer)

Context

The original PR #107230 included both the feature flag and the assignment logic in the monolith. Based on team feedback, we've simplified the implementation:

  • The monolith will only have the feature flag that controls org-level eligibility
  • The option registration and hash bucket assignment logic will be implemented directly in Seer
  • This allows Seer to test sentry-options integration directly while keeping the monolith minimal

Changes

  • Added organizations:code-review-experiments-enabled feature flag in src/sentry/features/temporary.py
  • Flag uses FLAGPOLE strategy with api_expose=False (internal use only)

Test Plan

  • ✅ Pre-commit checks passed
  • ✅ No new code paths to test (flag registration only)
  • Feature flag can be enabled/disabled via Flagpole for testing org eligibility

References

@linear
Copy link
Copy Markdown

linear bot commented Feb 3, 2026

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Feb 3, 2026
@giovanni-guidini giovanni-guidini force-pushed the feat/cw-696-port-experiments-flag branch from 7256e14 to 853d51f Compare February 3, 2026 10:13
@giovanni-guidini giovanni-guidini requested a review from a team as a code owner February 3, 2026 10:13
return features.has(
"organizations:code-review-experiments-enabled",
organization,
actor=user,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I was told by Claude that this is not used to hash the feature decision (e.g. assignment to experiment or not isn't affected by who opened the PR)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You don't need the user unless you intend to control experiments to specific Sentry users.

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.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Copy link
Copy Markdown
Member

@armenzg armenzg left a comment

Choose a reason for hiding this comment

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

Do we intend to add some information in the event payload sent to Seer?

return features.has(
"organizations:code-review-experiments-enabled",
organization,
actor=user,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

You don't need the user unless you intend to control experiments to specific Sentry users.

@giovanni-guidini
Copy link
Copy Markdown
Contributor Author

Do we intend to add some information in the event payload sent to Seer?

Just that boolean field (#107483)

Ports only the feature flag from PR #107230 to control org-level eligibility for code review experiments.

Per the updated architecture decision in CW-696, the option registration and hash bucket assignment logic will be moved directly to Seer. This allows Seer to test sentry-options integration directly while keeping the monolith implementation minimal.

Refs CW-696
* move flag lookup from `assignemnt.py` to `utils.py`
* moved the tests too
@ryan953
Copy link
Copy Markdown
Member

ryan953 commented Feb 3, 2026

looks like #107483 will need a merge after this lands.

Copy link
Copy Markdown
Member

@armenzg armenzg left a comment

Choose a reason for hiding this comment

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

Thank you for addressing all feedback!

@giovanni-guidini giovanni-guidini merged commit 9fdcbc2 into master Feb 4, 2026
72 checks passed
@giovanni-guidini giovanni-guidini deleted the feat/cw-696-port-experiments-flag branch February 4, 2026 12:59
jaydgoss pushed a commit that referenced this pull request Feb 12, 2026
Adds a new feature flag that will be used by code-review to check eligibility for A/B test experiments.
@github-actions github-actions bot locked and limited conversation to collaborators Feb 19, 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.

3 participants