Skip to content

fix: Clear empty FDv2 selectors in shared protocol handling - #261

Merged
kinyoklion merged 2 commits into
mainfrom
devin/1794591805-fdv2-selectorless
Nov 18, 2026
Merged

kinyoklion merged 2 commits into
mainfrom
devin/1794591805-fdv2-selectorless

Conversation

@kinyoklion

@kinyoklion kinyoklion commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Requirements

  • I have added test coverage for new or changed functionality
  • I have followed the repository's pull request submission guidelines
  • I have validated my changes against all supported platform versions

Related issues

launchdarkly/ld-relay#979 sends FDv2 full transfers with no selector (payload-transferred {"state":"","version":0}). The shared FDv2ProtocolHandler built Selector.make(0, "") from it, and that selector is not empty. As a result, the server SDK and Android sent an empty basis= on later polls and stream reconnects. The contract test for this is launchdarkly/sdk-test-harness#600.

Describe the solution you've provided

  • FDv2ProtocolHandler (shared internal): an empty transferred state now becomes Selector.EMPTY. The existing store assignment then clears the held selector. The server polling and streaming requests already check isEmpty(), so they leave out basis.
  • Tests: the shared handler moving from a selector-bearing transfer to a selectorless one, with both populated and empty payloads, plus a non-empty state at version 0. Server tests confirm that polling and streaming leave out basis once the selector is empty.
  • Selector-bearing behavior and initialization are unchanged.

Android uses this shared handler. It needs an internal dependency bump after release (it currently pins 1.9.0). The Java server SDK pins 1.12.2.

Describe alternatives you've considered

Guarding each request builder against an empty state. Normalizing once in the shared handler fixes server and Android in one place.

Additional context

I couldn't verify this locally. Maven Central returned HTTP 429 during Gradle dependency resolution, so tests, Checkstyle, and the selectorless contract group did not run. CI is the first real check.

Link to Devin session: https://app.devin.ai/sessions/f3b22e19bdde48f1b39f77808077390b
Open in Devin Desktop: https://app.devin.ai/desktop/session/f3b22e19bdde48f1b39f77808077390b?variant=devin
Requested by: @kinyoklion


Note

Overview
Fixes FDv2 clients sending an invalid basis= query after a selectorless full transfer (payload-transferred with empty state).

Shared protocol: FDv2ProtocolHandler now maps an empty transferred state to Selector.EMPTY instead of Selector.make(version, ""), which was still treated as non-empty and caused later polls/stream connects to include basis=.

Tests: Shared handler cases for selectorless full transfers and version-0 state with a non-empty id; server tests assert polling and streaming omit basis when the held selector is empty. Normal selector-bearing transfers are unchanged.

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

Co-Authored-By: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

Co-Authored-By: Ryan Lamb <4955475+kinyoklion@users.noreply.github.com>
@kinyoklion
kinyoklion marked this pull request as ready for review November 18, 2026 19:08
@kinyoklion
kinyoklion requested a review from a team as a code owner November 18, 2026 19:08
@cursor cursor Bot added the risk:low label Nov 18, 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: A one-line change in FDv2ProtocolHandler maps empty FDv2 payload state to Selector.EMPTY, with new tests in the shared handler and server poll/stream paths. Bugbot completed with no findings, and this is not infra, auth, or policy configuration.

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 576b081 into main Nov 18, 2026
33 checks passed
@kinyoklion
kinyoklion deleted the devin/1794591805-fdv2-selectorless branch November 18, 2026 20:04
kinyoklion pushed a commit that referenced this pull request Nov 18, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.13.0](launchdarkly-java-sdk-internal-1.12.2...launchdarkly-java-sdk-internal-1.13.0)
(2026-11-18)


### Features

* Parse protocolFallbackTTL from FDv2 goodbye
([#265](#265))
([72d0fe1](72d0fe1))


### Bug Fixes

* Clear empty FDv2 selectors in shared protocol handling
([#261](#261))
([576b081](576b081))

---
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**
> **Release Please** cuts **`lib/shared/internal`** from **1.12.2** to
**1.13.0**, updating `.release-please-manifest.json`,
`gradle.properties`, and `CHANGELOG.md` only.
> 
> The published **1.13.0** notes add **FDv2 goodbye** support for
parsing **`protocolFallbackTTL`** (including malformed/null handling via
`Goodbye`) and a fix to **clear empty FDv2 selectors** in shared
protocol handling so empty selector state does not linger incorrectly.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
4ca3c46. 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>
kinyoklion added a commit that referenced this pull request Nov 19, 2026
**Requirements**

- [ ] I have added test coverage for new or changed functionality
- [x] I have followed the repository's [pull request submission
guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests)
- [ ] I have validated my changes against all supported platform
versions

**Related issues**

- #261: the selectorless FDv2 fix in the shared internal module,
released in 1.13.0
- launchdarkly/sdk-test-harness#600: contract tests for FDv2 payloads
without a selector

**Describe the solution you've provided**

Bumps `launchdarklyJavaSdkInternal` in `lib/sdk/server/build.gradle`
from 1.12.2 to 1.13.0. With 1.12.2, a full transfer with an empty
`state` produced a non-empty selector, so the server SDK sent `basis` on
its next request.

**Describe alternatives you've considered**

#257 also bumps to 1.13.0, but its cooldown changes will ship in a later
internal version.

**Additional context**

Local results on Java 8:
- `./gradlew test` in `lib/sdk/server`: 1987 tests, 0 failures.
- sdk-test-harness#600, `streaming/fdv2/payloads without a selector`:
5/5 pass. 3 of the 5 fail on main.
- Full v3 contract suite with the CI suppression file and persistence
tests: 6311 ran, all passed.

Link to Devin session:
https://app.devin.ai/sessions/fa07e76e6e3346c9b26f2eae4ff6694b
Open in Devin Desktop:
https://app.devin.ai/desktop/session/fa07e76e6e3346c9b26f2eae4ff6694b?variant=devin
Requested by: @kinyoklion

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> Bumps **`launchdarklyJavaSdkInternal`** in
`lib/sdk/server/build.gradle` from **1.12.2** to **1.13.0**, pulling in
the shared internal fix for **selectorless FDv2** payloads (issue #261).
> 
> Previously, a full transfer with an empty `state` could still yield a
non-empty selector, so the server SDK incorrectly sent **`basis`** on
the following streaming request. Contract tests for payloads without a
selector are expected to pass after this upgrade.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
703704e. 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: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
kinyoklion added a commit to launchdarkly/android-client-sdk that referenced this pull request Nov 19, 2026
**Requirements**

- [ ] I have added test coverage for new or changed functionality
- [x] I have followed the repository's [pull request submission
guidelines](../blob/main/CONTRIBUTING.md#submitting-pull-requests)
- [ ] I have validated my changes against all supported platform
versions

**Related issues**

- launchdarkly/java-core#261: the selectorless FDv2 fix in the shared
internal module, released in 1.13.0
- launchdarkly/java-core#273: removes `java.time.Duration` from FDv2
goodbye parsing (API 26+ only), released in 1.13.1
- launchdarkly/sdk-test-harness#600: contract tests for FDv2 payloads
without a selector

**Describe the solution you've provided**

Bumps `launchdarklyJavaSdkInternal` from 1.9.0 to 1.13.1 in
`launchdarkly-android-client-sdk/build.gradle` and
`shared-test-code/build.gradle`. With 1.9.0, a full transfer with an
empty `state` produced a non-empty selector, so the SDK sent `basis` on
its next request. 1.13.1 also avoids the 1.13.0 `java.time.Duration`
call when parsing an FDv2 goodbye with `protocolFallbackTTL`, which is
unavailable below API 26 without desugaring. No API changes were needed.

**Describe alternatives you've considered**

Stopping at 1.13.0, which would introduce the `Duration` use on API
21–25.

**Additional context**

Local results on Java 17 with an API 25 emulator, run against 1.13.0:
- `./gradlew build jar`: 752 unit tests in each of debug and release, 0
failures.
- sdk-test-harness#600, `streaming/fdv2/payloads without a selector`:
5/5 pass. 3 of the 5 fail on main.
- Full v3 contract suite with the CI-pinned harness (v3.2.0-alpha.10)
and `testharness-suppressions-fdv2.txt`: 895 ran, all passed.

1.13.1 was released minutes before this update and may not be on Maven
Central yet; rerun CI if dependency resolution fails.

Link to Devin session:
https://app.devin.ai/sessions/2540f086f1ea4dfba1470051465fb0fd
Open in Devin Desktop:
https://app.devin.ai/desktop/session/2540f086f1ea4dfba1470051465fb0fd?variant=devin
Requested by: @kinyoklion

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> Bumps **`launchdarklyJavaSdkInternal`** from **1.9.0** to **1.13.1**
in **`launchdarkly-android-client-sdk/build.gradle`** and
**`shared-test-code/build.gradle`**.
> 
> This pulls in shared-internal fixes for **FDv2 full transfers with
empty `state`**, which previously caused an incorrect non-empty selector
and extra **`basis`** requests, and picks **1.13.1** over 1.13.0 so
**FDv2 goodbye** parsing avoids **`java.time.Duration`** (API 26+) on
**API 21–25** without desugaring.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
7e9b48e. 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: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
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.

3 participants