Skip to content

fix: Record no variation in events when a typed evaluation has the wrong type - #432

Merged
keelerm84 merged 1 commit into
mainfrom
mk/SDK-3635/wrong-type-events
Nov 17, 2026
Merged

keelerm84 merged 1 commit into
mainfrom
mk/SDK-3635/wrong-type-events

Conversation

@keelerm84

@keelerm84 keelerm84 commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Summary

When a typed variation method (boolVariation, intVariation, doubleVariation, stringVariation and their detail forms) got a flag value of the wrong type, the SDK returned the default value with a WRONG_TYPE reason, 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.

LDClient now passes result.getVariationIndex() into recordEvaluationEvent rather than the flag’s variation. On WRONG_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, and WRONG_TYPE reason.

Adds instrumented test wrongTypeEvaluationEventHasDefaultValueAndNoVariation in LDClientEventTest (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.

@keelerm84
keelerm84 requested a review from a team as a code owner November 17, 2026 16:01
@cursor cursor Bot added the risk:low label Nov 17, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

Open in Web View Automation 

Sent by Cursor Approval Agent: Dry-Run PR Approver

@keelerm84
keelerm84 merged commit 0298fb0 into main Nov 17, 2026
9 checks passed
@keelerm84
keelerm84 deleted the mk/SDK-3635/wrong-type-events branch November 17, 2026 17:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants