Repository navigation
feat: Parse protocolFallbackTTL from FDv2 goodbye - #265
Merged
Merged
Conversation
Co-Authored-By: Bee Klimt <bklimt@launchdarkly.com>
Co-Authored-By: Bee Klimt <bklimt@launchdarkly.com>
This reverts commit 8801336.
Co-Authored-By: Bee Klimt <bklimt@launchdarkly.com>
Contributor
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
There was a problem hiding this comment.
Risk: low.
Automated risk review (dry run): Low
This PR would be automatically approved.
Why: It adds optional protocolFallbackTTL parsing on FDv2 Goodbye and pass-through in FDv2ProtocolHandler, with tests for absent, numeric, and malformed values. There are no infrastructure, auth, or approval-policy changes.
If you disagree with this review, share this PR in #feedback-agent-approvals or submit a changes-requested review explaining why.
Sent by Cursor Approval Agent: Dry-Run PR Approver
beekld
commented
Nov 17, 2026
Co-Authored-By: Bee Klimt <bklimt@launchdarkly.com>
tanderson-ld
approved these changes
Nov 17, 2026
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>
2 of 3 tasks
kinyoklion
added a commit
that referenced
this pull request
Nov 19, 2026
**Requirements** - [x] 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** 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 <!-- CURSOR_SUMMARY --> --- > [!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`). > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 1f5fe34. 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>
2 of 3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Parses the optional
protocolFallbackTTLfield of the FDv2goodbyepayload inlaunchdarkly-java-sdk-internal, so the server SDK can treat it as an FDv1 fallback directive.Part of SDK-2987.
Goodbye.getProtocolFallbackTTL()andFDv2ActionGoodbye.getProtocolFallbackTTL()return a nullableDuration:nullwhen the field is absent or JSONnull, the value in seconds when it is a number, andDuration.ZEROwhen it is present but not a number.Duration.ZEROworks as "use the default TTL", because the spec already treats 0 that way (DATASYSTEM 1.6.1.3–1.6.1.5). A malformed TTL still counts as a directive.Implementation details
TypeAdapteronGoodbye.protocolFallbackTTLis needed because existing tests round-tripGoodbyethrough Gson, and Gson can't reflect intojava.time.Durationon JDK 17.parse()reuses the adapter's read logic.ZERO) and JSONnull(→ absent), plus pass-through inFDv2ProtocolHandler../gradlew test checkstyleMain checkstyleTestinlib/shared/internal.Link to Devin session: https://app.devin.ai/sessions/cce64c67519f4babaa75176c06961c5e
Open in Devin Desktop: https://app.devin.ai/desktop/session/cce64c67519f4babaa75176c06961c5e?variant=devin
Requested by: @beekld
Note
Overview
Adds optional
protocolFallbackTTLto the FDv2Goodbyepayload and threads it throughFDv2ProtocolHandler.FDv2ActionGoodbye, so callers can read a server-directed FDv1 fallback delay on disconnect.Parsing treats absent or JSON
nullas null, numeric values as seconds (fractional supported), and non-numbers asDuration.ZERO(spec: use default TTL). A custom GsonFallbackTTLAdapterhandles round-trip serialization forDurationon JDK 17. One-arg constructors remain for backward compatibility.Tests cover TTL edge cases in
Goodbye.parseand pass-through fromhandleEvent.Reviewed by Cursor Bugbot for commit b7d1577. Bugbot is set up for automated code reviews on this repo. Configure here.