Skip to content

fix: Remove java.time.Duration usage from FDv2 goodbye parsing - #273

Merged
kinyoklion merged 1 commit into
mainfrom
devin/1795115639-remove-duration-internal
Nov 19, 2026
Merged

kinyoklion merged 1 commit into
mainfrom
devin/1795115639-remove-duration-internal

Conversation

@kinyoklion

@kinyoklion kinyoklion commented Nov 19, 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

Follow-up to #265. Android consumes this library (android-client-sdk#435); java.time.Duration is only available natively on API 26+, and Android supports API 21 without core-library desugaring.

Describe the solution you've provided

Goodbye and FDv2ProtocolHandler in lib/shared/internal now store protocolFallbackTTL as a nullable Long of milliseconds instead of a Duration. The wire format (seconds) is unchanged.

Internal API changes:

  • Goodbye.getProtocolFallbackTTL() (returned Duration) is replaced by getProtocolFallbackTTLMillis() (returns Long).
  • The two-argument constructors take a Long of milliseconds; the one-argument constructors are unchanged.

Neither the Java server SDK nor the Android SDK calls the old getter. The compiled production classes in the module have no java.time references.

Describe alternatives you've considered

Keeping the Duration getter alongside a millis accessor. That still leaves Duration in the parse path, which is what runs on Android.

Additional context

Ran FDv2PayloadsTest and FDv2ProtocolHandlerTest plus the rest of the module's JUnit tests directly: 324 passing. Local Gradle/Checkstyle was blocked by Maven Central rate limiting, so CI is the check for those.

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


Note

Overview
FDv2 goodbye handling no longer uses java.time.Duration for protocolFallbackTTL. Goodbye and FDv2ProtocolHandler.FDv2ActionGoodbye now hold a nullable Long in milliseconds, with wire JSON still expressed in seconds via the existing FallbackTTLAdapter (malformed values still map to 0).

The public internal API rename is getProtocolFallbackTTL() → getProtocolFallbackTTLMillis(), and constructors that took a Duration take millis instead. Tests in FDv2PayloadsTest and FDv2ProtocolHandlerTest expect millis values and add coverage that Gson serializes TTL back to seconds (e.g. 1250 ms → 1.25).

Reviewed by Cursor Bugbot for commit 1f5fe34. 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

@kinyoklion
kinyoklion marked this pull request as ready for review November 19, 2026 19:23
@kinyoklion
kinyoklion requested a review from a team as a code owner November 19, 2026 19:23
@cursor cursor Bot added the risk:low label Nov 19, 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 change in Goodbye.java and FDv2ProtocolHandler.java replacing java.time.Duration with millisecond Long values, with matching tests in FDv2PayloadsTest and FDv2ProtocolHandlerTest.

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 171be16 into main Nov 19, 2026
34 of 35 checks passed
@kinyoklion
kinyoklion deleted the devin/1795115639-remove-duration-internal branch November 19, 2026 21:22
kinyoklion pushed a commit that referenced this pull request Nov 19, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.13.1](launchdarkly-java-sdk-internal-1.13.0...launchdarkly-java-sdk-internal-1.13.1)
(2026-11-19)


### Bug Fixes

* Remove java.time.Duration usage from FDv2 goodbye parsing
([#273](#273))
([171be16](171be16))

---
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** cut for **`launchdarkly-java-sdk-internal`
1.13.1**. The diff only updates the release manifest,
`gradle.properties`, and **CHANGELOG**—no application code in this PR.
> 
> The published **1.13.1** patch documents a bug fix
([#273](#273)): **FDv2
goodbye** parsing for `protocolFallbackTTL` no longer uses
`java.time.Duration`, storing **milliseconds as `Long`** with a Gson
type adapter instead. That keeps the TTL behavior from 1.13.0 while
avoiding `Duration` where it isn’t viable (e.g. older Android targets).
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
dff5e71. 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 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>
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