Repository navigation
fix(experimentation): suspend rollout split while an experiment is paused - #9215
Open
zaidrain06 wants to merge 2 commits into
Open
zaidrain06 wants to merge 2 commits into
zaidrain06 wants to merge 2 commits into
Conversation
…used Set the rollout segment percentage split condition to 0 while paused so identities fall back to the environment default, and restore the configured percentage from segment.rules_data on resume. Closes Flagsmith#9186 Signed-off-by: Ömer <[email protected]>
zaidrain06
requested review from
Holmus and
khvn26
and removed request for
a team
December 2, 2026 11:08
|
@zaidrain06 is attempting to deploy a commit to the Flagsmith Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
All reported issues were addressed across 3 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
…sfy test lint Signed-off-by: Ömer <[email protected]>
There was a problem hiding this comment.
0 issues found across 2 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Requires human review: Auto-approval skipped because this PR is from an external contributor.
Re-trigger cubic
This branch has not been deployed
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.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
Closes #9186
When an experiment transitions to
ExperimentStatus.PAUSED,transition_experiment_statuspreviously updated onlyexperiment.status, leaving its rollout segment'sPERCENTAGE_SPLITcondition active so identities kept being split across control and treatment variants.Note that setting
FeatureState.enabled = Falseon a segment override would evaluate matched identities with the flag disabled (enabled: false) rather than falling back to the environment default (control). Instead, this PR suspends and restores the rollout segment's liveCondition(operator=PERCENTAGE_SPLIT)value while preserving the configured rollout percentage onsegment.rules_data:RUNNING -> PAUSED(and ifapply_experiment_rolloutis called whilePAUSED), set the rollout segment'sPERCENTAGE_SPLITcondition to"0.0"and invalidate the project's environment segments cache (clear_environments_cache()) so identities fall back cleanly to the environment default (control).PAUSED -> RUNNING, restore thePERCENTAGE_SPLITcondition fromsegment.rules_dataand invalidate the segments cache so the configured rollout split resumes seamlessly.rollout_percentagefromsegment.rules_datainget_experiment_rollout(with fallback to theConditionrow) so the API/UI continues displaying the configured rollout percentage while paused.docs/docs/experimentation/analyse-an-experiment.mdunder Pausing the experiment to document the pause/resume behaviour.How did you test this code?
api/tests/unit/experimentation/test_services.pycoveringRUNNING -> PAUSED -> RUNNINGtransitions across both legacy and v2 feature versioning environments, rollout updates while paused, and edge cases without a rollout or with legacy emptyrules_data.uv run ruff check,uv run ruff format --check,uv run mypy,python manage.py makemigrations --dry-run --check,pytest(46 passed), anddiff-cover(100%across all 32 changed lines).