Skip to content

fix: Use the server's FDv1 fallback TTL from the header and goodbye - #278

Draft
beekld wants to merge 2 commits into
mainfrom
devin/1795126798-server-fallback-ttl
Draft

beekld wants to merge 2 commits into
mainfrom
devin/1795126798-server-fallback-ttl

Conversation

@beekld

@beekld beekld commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

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

Closes SDK-2987. Follows #265 and #273, the goodbye TTL parsing in java-sdk-internal 1.13.1. Spec: DATASYSTEM 1.6 (sdk-specs#251).

Describe the solution you've provided

Previously the server SDK always used the jittered 1h default as the FDv1 fallback TTL. It now uses the TTL the server sends.

  • Reads X-LD-FD-Fallback-TTL from the response that carries X-LD-FD-Fallback, for both polling and streaming.
  • A goodbye that has protocolFallbackTTL is now itself a fallback directive, and its TTL takes precedence over the header's.
  • A server TTL in (0, 1h] is used as-is, with no jitter. A missing, malformed, zero, negative, or >1h TTL uses the jittered 1h default.
  • This applies to the initializer path, to the synchronizer path, and to a directive received during FDv1 fallback, which replaces the TTL.
  • FDv2SourceResult (experimental package) now carries a nullable FDv1Fallback directive, with a nullable getTtl(), in place of the boolean fdv1Fallback.
Implementation details
  • Bumps launchdarklyJavaSdkInternal from 1.13.0 to 1.13.1, which provides FDv2ActionGoodbye.getProtocolFallbackTTLMillis().
  • The header is parsed as whole seconds in HeaderConstants. A non-integer value gives a directive with a null TTL, which means the default.
  • The (0, 1h] check and the jitter live in one place, FDv2DataSource.fallbackTTL(Duration). InitializerOutcome now carries the directive.
  • Callers that passed false (file data source, TestDataV2, DataSourceSynchronizerAdapter) now pass null.
  • Tests: header parsing (valid and malformed), goodbye with and without a TTL in polling and streaming, directive preserved by the result copies, valid TTL used unjittered, invalid TTLs falling back to the default, and initializer and synchronizer fallback. ./gradlew test checkstyleMain checkstyleTest passes in lib/sdk/server.

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

Co-Authored-By: Bee Klimt <bklimt@launchdarkly.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

return interrupted(errorInfo, fdv1Fallback, null, completionCallback);
}

public static FDv2SourceResult interrupted(DataSourceStatusProvider.ErrorInfo errorInfo, boolean fdv1Fallback, Duration fdv1FallbackTTL, Function<Void, Void> completionCallback) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think a more future-proof design might be to replace boolean fdv1Fallback, Duration fdv1FallbackTT with a new nullable FDv1Fallback object that contains a Duration ttl. That way, if the format changes in the future, we don't have to change all the interfaces.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in 71beeaa. There's a new datasources.FDv1Fallback, holding a nullable Duration ttl. The FDv2SourceResult factories now take a nullable FDv1Fallback in place of the boolean, where null means no directive, so the extra TTL overloads are gone. getFdv1Fallback() returns the directive, and isFdv1Fallback() remains as a != null shorthand.

Co-Authored-By: Bee Klimt <bklimt@launchdarkly.com>

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant