Skip to content

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

Merged
kinyoklion merged 1 commit into
mainfrom
rlamb/sdk-3662/explicit-null-properties
Nov 19, 2026
Merged

kinyoklion merged 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

@kinyoklion
kinyoklion merged commit 3af465d into main Nov 19, 2026
33 checks passed
@kinyoklion
kinyoklion deleted the rlamb/sdk-3662/explicit-null-properties branch November 19, 2026 18:42
kinyoklion pushed a commit that referenced this pull request Nov 20, 2026
🤖 I have created a release *beep* *boop*
---


##
[7.18.2](launchdarkly-java-server-sdk-7.18.1...launchdarkly-java-server-sdk-7.18.2)
(2026-11-20)


### Bug Fixes

* Clear empty FDv2 selectors in shared protocol handling
([#261](#261))
([576b081](576b081))
* Prevent flags in a persistent store from becoming available to mobile
keys ([#275](#275))
([32c8676](32c8676))
* Treat a null optional property in flag data as omitted
([#268](#268))
([3af465d](3af465d))
* Update launchdarkly-java-sdk-internal to 1.13.0
([#272](#272))
([9cc5885](9cc5885))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> This **release PR** bumps the LaunchDarkly Java server SDK from
**7.18.1** to **7.18.2** across Release Please metadata
(`gradle.properties`, `Version.SDK_VERSION`, and
`.release-please-manifest.json`).
> 
> The new **CHANGELOG** section records the fixes shipped in this patch:
clearing empty FDv2 selectors in shared protocol handling, blocking
persistent-store flags from being exposed to mobile keys, treating null
optional flag properties as omitted, and updating
`launchdarkly-java-sdk-internal` to 1.13.0. Those behavioral changes are
not part of this diff—only the version and release notes are updated
here.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
9087581. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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