Skip to content

feat(flagpole): Bucket rollouts by feature name for new flags - #125364

Closed
jaydgoss wants to merge 8 commits into
masterfrom
jaygoss/vdy-161-feature-specific-bucketing
Closed

jaydgoss wants to merge 8 commits into
masterfrom
jaygoss/vdy-161-feature-specific-bucketing

Conversation

@jaydgoss

@jaydgoss jaydgoss commented Sep 23, 2026 •

Copy link
Copy Markdown
Member

Percentage rollouts currently select the same organizations for different features when the rollout percentage and conditions match. This change adds the feature name to the rollout hash, so new features can select different groups.

The cutoff is October 5, 2026, at 00:00:00 UTC:

  • Features created after the cutoff use the feature name and the existing identity fields.
  • Features created at or before the cutoff keep the existing calculation.
  • Features with a missing or invalid created_at also keep the existing calculation.

Existing partial rollouts therefore keep the same organizations.

This PR updates Python's flagpole package to match getsentry/sentry-options#184. Production uses the sentry-options evaluator (getsentry/getsentry#21872). Matching its behavior keeps flagpole_eval.py results consistent with production. The Python and Rust tests check the same expected bucket values.

Deployment requirement: Both packages must use the same cutoff. Deploy the changes before that time. If deployment is delayed, move both cutoff constants to the same later date.

Refs VDY-161

Features with a created_at after 2026-10-15 UTC hash their name into the rollout id, so two flags at the same rollout reach different organizations. Older flags, and flags whose created_at is missing or does not parse, keep the identity-only id so in-flight partial rollouts do not move. This mirrors the sentry-options evaluator, which is what production uses, so flagpole_eval.py reports the same bucket.

Refs VDY-161
@linear-code

linear-code Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

VDY-161

DI-2478

@github-actions github-actions Bot added the Scope: Backend Automatically applied to PRs that change backend components label Sep 23, 2026
jaydgoss and others added 7 commits September 23, 2026 15:38
Python's datetime drops digits past microseconds, so 2026-10-15T00:00:00.000000001
keeps identity-only bucketing. sentry-options now truncates the same way; add
the case to both parity tables so they stay in step.

Refs VDY-161
test_bucket_id now pins organization_id 123 under two real feature names
instead of foo:bar under placeholder names, and the two rollout bucketing
tests use the same context and assert their own bucket numbers in place.
The sentry-options rust client pins the same input and numbers.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Keep the original ID generator and add an optional feature-name prefix.
Remove the extra identity-string cache and hashing helper.
Preserve existing IDs and rollout buckets.

Refs VDY-161
Write the feature name and its separator to the hasher in a single call. The digest is unchanged.
@jaydgoss
jaydgoss marked this pull request as ready for review September 24, 2026 20:37
@jaydgoss
jaydgoss requested review from a team as code owners September 24, 2026 20:37

@kenzoengineer kenzoengineer left a comment

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.

I've finished cutting over flagpole functionality to the new system already 🎉 ! You can close this PR, there isn't any need to edit anything in getsentry or sentry.

From now on, bucketing, conditions, etc. flagpole changes only live in sentry-options. Anything that should be sentry/getsentry specific after evaluation can still live in getsentry/sentry.

in summary, we only need getsentry/sentry-options#184, can close this.

@jaydgoss

jaydgoss commented Sep 24, 2026 •

Copy link
Copy Markdown
Member Author

I've finished cutting over flagpole functionality to the new system already 🎉 ! You can close this PR, there isn't any need to edit anything in getsentry or sentry.

From now on, bucketing, conditions, etc. flagpole changes only live in sentry-options. Anything that should be sentry/getsentry specific after evaluation can still live in getsentry/sentry.

in summary, we only need getsentry/sentry-options#184, can close this.

@kenzoengineer Thanks, looks like there is a debug tool that still uses the old python evaluator in this repo, so without an update, its results can differ from production for new flags after the cutoff.

Should we change that script to use sentry-options, or remove it?

@kenzoengineer

Copy link
Copy Markdown
Member

I've finished cutting over flagpole functionality to the new system already 🎉 ! You can close this PR, there isn't any need to edit anything in getsentry or sentry.
From now on, bucketing, conditions, etc. flagpole changes only live in sentry-options. Anything that should be sentry/getsentry specific after evaluation can still live in getsentry/sentry.
in summary, we only need getsentry/sentry-options#184, can close this.

@kenzoengineer Thanks, looks like there is a debug tool that still uses the old python evaluator in this repo, so without an update, its results can differ from production for new flags after the cutoff.

Should we change that script to use sentry-options, or remove it?

good catch, i'd remove it because it doesn't seem to be called by anything (except it's own tests) and i was eventually going to delete it anyways as part of migration cleanup. The tool does seem useful tho, I would be happy to add that to the sentry-options-cli natively

@jaydgoss jaydgoss closed this Sep 24, 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.

2 participants