fix: support fractional rollout percentages in local evaluation - #699
Merged
Conversation
Member
Author
|
follow up PostHog/posthog-dotnet#291 |
Contributor
posthog-android Compliance ReportDate: 2026-08-17 07:25:07 UTC ✅ All Tests Passed!46/46 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
marandaneto
marked this pull request as ready for review
August 17, 2026 08:00
Contributor
|
Reviews (1): Last reviewed commit: "fix: use a double for rollout percentage..." | Re-trigger Greptile |
arnohillen
approved these changes
Aug 17, 2026
arnohillen
left a comment
Contributor
There was a problem hiding this comment.
(created by claude code)
Verified the only consumer (FlagEvaluator.isConditionMatch) already divides by 100.0 so whole-number behavior is unchanged, Gson reads lossless doubles into Int fields so mixed-version shared-cache fleets stay safe for integral values, and the new test covers the exact fractional failure path; the ABI change is on a @PostHogInternal class with the api dump updated.
dustinbyrne
approved these changes
Aug 17, 2026
1 task
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.
💡 Motivation and Context
Local feature flag definitions can contain fractional condition rollout percentages such as
0.1or0.5. The condition model stored this field as an integer, so Gson rejected fractional definitions before they could be evaluated locally.This changes the internal condition model to store
rolloutPercentageas aDouble, allowing Gson and the local evaluator to preserve fractional values.💚 How did you test it?
./gradlew :posthog:test :posthog-server:testusing JDK 17make checkFormatmake apipnpm changeset status0.1,0.5,100.0,0.0, andnull📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Pi was used to inspect the local-evaluation path, implement the fix, run the test and formatting checks, and perform an isolated autoreview. Autoreview flagged the changed JVM signature, but
FlagConditionGroupis annotated@PostHogInternaland is public only for the SDK's multi-module architecture. The human DRI chose the directDoubletype instead of adding a compatibility-only integer property to this internal model.