Skip to content

JS SDK: fix percentage rollouts including one extra hash bucket - #7425

Open
andywhite37 wants to merge 1 commit into
mainfrom
aw/rollout-coverage-off-by-one
Open

andywhite37 wants to merge 1 commit into
mainfrom
aw/rollout-coverage-off-by-one

Conversation

@andywhite37

Copy link
Copy Markdown
Contributor

Features and Changes

A percentage rollout included one more hash bucket than its coverage said. isIncludedInRollout checked n <= coverage, and hash v2 returns one of 10,000 values from 0 to 0.9999, so a coverage of k/10000 included k+1 buckets. A 0.01% rollout turned on for 0.02% of ids, and 99.99% included everyone. With hash v1 (1,000 buckets) a 0.1% rollout included 0.2%.

  • isIncludedInRollout now checks n < coverage, matching the half-open inRange used for experiments and range.
  • SDK spec (build-your-own.mdx) updated and bumped to v0.10.2.
  • New feature cases in cases.json where the hash equals the coverage exactly (excluded) and is just below it (included). Before this, the shared tests passed with either operator.

Existing partial rollouts whose coverage is exactly a bucket value lose one bucket (for example, 0.02% → 0.01%).

The Python, Go and Rust SDKs have the same <= and need the same change once they pick up the new cases.json.

Dependencies

None

Testing

  • pnpm --filter @growthbook/growthbook test: all 1,221 tests pass.
  • With the old <=, the new "coverage equal to hash excluded" case fails.

isIncludedInRollout compared n <= coverage, so a coverage of k/10000
included k+1 buckets (a 0.01% rollout turned on for 0.02% of ids).
It now uses n < coverage, matching the half-open inRange check.

Bump the SDK spec to v0.10.2 and add feature test cases where the
hash equals the coverage exactly.
@mintlify

mintlify Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated
growthbook-ea15456d 🟢 Ready View Preview Oct 22, 2026, 10:53 PM

@greptile-apps

greptile-apps Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge.

Reviews (2) · Last reviewed commit: "JS SDK: fix percentage rollouts includin..." · Reviewed by Greptile

@andywhite37
andywhite37 marked this pull request as draft October 23, 2026 15:48
@andywhite37

Copy link
Copy Markdown
Contributor Author

Going to hold on this one until we get some other SDK changes through first.

@andywhite37
andywhite37 marked this pull request as ready for review October 23, 2026 19:01
@andywhite37

Copy link
Copy Markdown
Contributor Author

Now we're looking to roll this in with some other SDK changes

@gazzdingo gazzdingo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

This branch was successfully deployed

2 active deployments
staging - docs — 84652f1a Deployed Oct 22, 2026 by mintlify[bot]
preview — 84652f1a Deployed Oct 22, 2026 by andywhite37 via preview #30533
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants