Repository navigation
fix: use force rule fallbackAttribute only with sticky bucketing - #163
Merged
Merged
Conversation
Force-rule rollouts passed rule.fallbackAttribute to _isIncludedInRollout unconditionally, so a user without the hash attribute could be included through the fallback even when sticky bucketing was off. The JS SDK (core.ts, verified against @growthbook/growthbook 2.0.0) uses the fallback for rollouts only when sticky bucketing is enabled and the rule does not set disableStickyBucketing, the same rule 4.0.0 already applies to experiments. Reuse _experiment_fallback_attribute for force rules. Users relying on fallbackAttribute for rollouts without a sticky bucket service are no longer included when the hash attribute is missing.
[Medium impact] The PR appears safe to merge; no actionable defects were found. Reviews (2) · Last reviewed commit: "fix: use force rule fallbackAttribute on..." · Reviewed by Greptile |
Collaborator
Author
|
@greptile review |
madhuchavva
approved these changes
Dec 3, 2026
Contributor
|
Confirming this is a regression from #153, not an intentional divergence.
Merging for 4.1.1. Nit: row 3 of the table (sticky + Follow-up: nothing in |
4 tasks
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.
What changed and why
Force-rule rollouts passed
rule.fallbackAttributeto_isIncludedInRolloutunconditionally. So a user without the hash attribute could be included through the fallback even with sticky bucketing off. The JS SDK passes the fallback for rollouts only when sticky bucketing is enabled and the rule does not setdisableStickyBucketing. That is the same rule #153 already applied to experiments._experiment_fallback_attributenow accepts aFeatureRuleas well as anExperiment, and force rules use it.Checked against
@growthbook/growthbook2.0.0. The test rule is{"force": "on", "coverage": 1, "hashAttribute": "id", "fallbackAttribute": "deviceId"}, with attributes{"deviceId": "dev-1"}:off/defaultValueon/forceoff/defaultValueon/forceon/forceon/forcedisableStickyBucketingoff/defaultValueon/forceoff/defaultValueBehaviour change
If you rely on
fallbackAttributefor percentage rollouts without a sticky bucket service, users who lack the hash attribute are no longer included. This is not marked breaking because it is a parity fix, but it should be called out in the changelog.test_unhashable_ids_use_the_fallback_attributeasserted the old behaviour ("Rollouts always use the rule's fallback attribute"). It now asserts the JS behaviour, with and without a sticky bucket service. Please confirm this was not an intentional divergence in #153.How to test
pytest tests/test_force_rule_fallback_attribute.py: 4 tests, covering the three cases above plus a rule where the hash attribute is present.pytest tests/test_growthbook.py -k unhashable_idstests/test_typing.pymypy cases that also fail onmain.Limitations / follow-ups