Skip to content

fix: Treat a null optional property in flag data as omitted - #268

Open
kinyoklion wants to merge 1 commit into
mainfrom
rlamb/sdk-3662/explicit-null-properties
Open

kinyoklion wants to merge 1 commit into
mainfrom
rlamb/sdk-3662/explicit-null-properties

Conversation

@kinyoklion

@kinyoklion kinyoklion commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

An explicit null for an optional string or boolean property of a clause (contextKind, negate), a rollout (contextKind, bucketBy, kind) or a segment rule (rolloutContextKind, bucketBy) made the parser throw. The SDK then rejected the whole flag data set and never initialized. These properties are now read the same way as when they are omitted, which the flag data model requires. The other optional properties already accepted null.

Testing: a new unit test fails without the fix and passes with it; the explicit-null contract tests go from FAIL to PASS, and the full v2 and v3 contract suites have no result changes.

SDK-3662

Opened from termag


Note

Overview
Fixes flag/segment JSON deserialization when optional fields are explicitly null. Several custom Gson type adapters in DataModelSerialization used nextString() / nextBoolean() on properties that the data model treats as optional, which caused the parser to throw and could prevent the SDK from loading the full dataset.

Clause, Rollout, and SegmentRule adapters now read contextKind, bucketBy, kind, and negate through new helpers (readNullableString, readNullableContextKind, readBooleanOrFalse) so explicit JSON null matches an omitted field—e.g. null negate → false, null contextKind → literal attribute paths. A unit test asserts this contract for nested flag and segment payloads.

Reviewed by Cursor Bugbot for commit 7b9e54a. Bugbot is set up for automated code reviews on this repo. Configure here.

An explicit null for an optional string or boolean property of a clause, rollout or segment rule made the parser throw, so the whole flag data set was rejected. These properties are now read as when they are omitted.

Generated-by: termag
@kinyoklion
kinyoklion marked this pull request as ready for review November 17, 2026 23:37
@kinyoklion
kinyoklion requested a review from a team as a code owner November 17, 2026 23:37
@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: Narrow parser fix in DataModelSerialization.java treating explicit nulls on optional clause, rollout, and segment-rule properties as omitted, with a dedicated unit test covering that contract. Bugbot completed with no findings.

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

This branch has not been deployed

No deployments
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.

1 participant