Repository navigation
fix: Record no variation in events when a typed evaluation has the wrong type - #432
Merged
Merged
Conversation
…ong type Generated-by: termag
There was a problem hiding this comment.
Risk: low.
Automated risk review (dry run): Low
This PR would be automatically approved.
Why: The change is a one-line event-payload fix in LDClient.java so wrong-type typed evaluations omit variation, plus a focused LDClientEventTest for that path. Bugbot completed with no findings, and this is not infra, auth, policy, or CI.
If you disagree with this review, share this PR in #feedback-agent-approvals or submit a changes-requested review explaining why.
Sent by Cursor Approval Agent: Dry-Run PR Approver
joker23
approved these changes
Nov 17, 2026
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.


Summary
When a typed variation method (
boolVariation,intVariation,doubleVariation,stringVariationand their detail forms) got a flag value of the wrong type, the SDK returned the default value with aWRONG_TYPEreason, and the analytics event recorded the default value and that reason. But the event took its variation from the flag, so the feature event and the summary counter reported the flag's variation for a value the application never received.The evaluation event now takes its variation from the evaluation result. A wrong-type result has no variation, so the event records none, the same way the flag-not-found path does. The flag version, tracking and reason are unchanged, and successful evaluations still record the flag's variation. This matches the evaluation spec.
The new test is
LDClientEventTest.wrongTypeEvaluationEventHasDefaultValueAndNoVariation. It is an instrumented test, like the other event tests, and it was not run locally because no emulator was available.Opened from termag
Note
Overview
Fixes wrong-type typed evaluations so analytics variation matches what the app actually received, instead of the flag’s stored variation.
LDClientnow passesresult.getVariationIndex()intorecordEvaluationEventrather than the flag’s variation. OnWRONG_TYPE, the result already has no variation (same as flag-not-found), so feature events and summary counters record null variation while still sending the default value, flag version, andWRONG_TYPEreason.Adds instrumented test
wrongTypeEvaluationEventHasDefaultValueAndNoVariationinLDClientEventTest(string flag evaluated as boolean) to lock in feature-event and summary-counter behavior.Reviewed by Cursor Bugbot for commit 1dcef5e. Bugbot is set up for automated code reviews on this repo. Configure here.