feat(server): RETRY-spec conformance in FDv1 streaming and polling (SDK-2789) - #200
Draft
tanderson-ld wants to merge 1 commit into
Draft
feat(server): RETRY-spec conformance in FDv1 streaming and polling (SDK-2789)#200tanderson-ld wants to merge 1 commit into
tanderson-ld wants to merge 1 commit into
Conversation
…polling data sources (SDK-2789) Per epic SDK-2775 and the server-sdk-guide.md at individual/tanderson/tickets/SDK-2775/implementation/ in sdk-scratchpad. Analogous to the Go reference implementation SDK-2788. The behavioral change: HTTP responses that today cause a data source to permanently stop (notably 401, 403, other 4xx) and TLS/certificate validation failures are no longer terminal. Streaming enters an extended backoff regime (5 min -> 1 hour, doubling); polling continues at its configured cadence with extended-regime waits between failing polls. Recovery from either regime uses RETRY spec §1.8's healthy-operation reset (60 s of continuous connectivity). Scope: FDv1 streaming and polling data sources under `lib/sdk/server/src/main/java/com/launchdarkly/sdk/server/`. FDv2 is out of scope for this epic (SDK-2775 explicitly defers FDv2 to a future epic); nothing in `datasourcev2/` or the DataSystem-related code paths is touched. Highlights: - FailureClass enum + local classifier: HTTP status per §1.6, transport exception per §1.7 (TLS/cert => UNEXPECTED). Classifier stays local to java-server-sdk; no changes to launchdarkly-java-sdk-internal. - PollingStrategy: new state machine encapsulation with onFailure(class) / onSuccess() / nextWait() methods, per server-sdk-guide §Polling. State: n (formula input), initialDelay, maxDelay, priorPollWasSuccessful. Wait floor: max(pollInterval, T - J) per §1.4.4 override. Two-consecutive-successes reset per §1.8.1. - PollingProcessor: rewired from scheduleAtFixedRate to a self-driven loop using strategy.nextWait(). Removed the State.OFF permanent-stop path entirely; state stays INITIALIZING/INTERRUPTED with a lastError. - StreamProcessor: consumes okhttp-eventsource's new setInitialRetryDelayMillis / setMaxRetryDelayMillis (see launchdarkly/okhttp-eventsource#109). On UNEXPECTED classification, transitions the retry timing into the extended regime; on activeSince elapsed >= retryResetInterval, transitions back to normal. Library's built-in healthy-op reset (retryDelayResetThresholdMillis) is disabled so the SDK owns regime state. - Builder plumbing: new package-private setters on StreamingDataSourceBuilderImpl / PollingDataSourceBuilderImpl for extendedInitialReconnectDelay, retryResetInterval, and extendedInitialDelay -- follows the existing pollIntervalWithNoMinimum precedent. - Internal bridge: com.launchdarkly.sdk.server.internal.DataSourceInternalHelpers gives cross-module callers (contract test service) access to the package-private test-only knobs. Public methods; package name signals internal-only surface. - Contract test service: declares retry-conformance-fdv1-streaming and retry-conformance-fdv1-polling capabilities. New ExtendedInitialDelayMs and ResetThresholdMs fields on SdkConfigStreamParams; extendedInitialDelayMs on SdkConfigPollingParams. SdkClientEntity wires them via the internal bridge. Tests: - Unit tests: full test suite green (BUILD SUCCESSFUL in 2m 36s). New tests: FailureClassTest (22 cases), PollingStrategyTest (9 cases). Updated: 401/403 tests renamed and rewritten to assert extended-regime retry instead of permanent stop. - Contract tests via sdk-test-harness#404 (v2 branch, RETRY-conformance tests): all 4889 tests pass end-to-end, including the specific extended-regime paired-bound assertions per server-sdk-guide §Testing considerations. CI: intentionally red on this PR until launchdarkly/okhttp-eventsource#109 is released to Maven Central. The setInitialRetryDelayMillis / setMaxRetryDelayMillis methods this SDK relies on are only in that PR's branch. Once released, bump okhttp-eventsource version in lib/sdk/server/build.gradle.
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.
Summary
Implements RETRY-spec conformance in the Java server SDK's FDv1 streaming and polling data sources. Per epic SDK-2775 and analogous to Go's reference implementation SDK-2788.
Behavioral change: HTTP responses that today cause a data source to permanently stop (notably 401, 403, other 4xx) and TLS/certificate validation failures are no longer terminal. Streaming enters an extended backoff regime (5 min → 1 hr, doubling); polling continues at its configured cadence with extended-regime waits between failing polls. Recovery from either regime uses RETRY §1.8's healthy-operation reset (60 s of continuous connectivity).
Scope: FDv1 streaming and polling data sources under `lib/sdk/server/`. FDv2 is deliberately out of scope for this epic (SDK-2775 defers FDv2 to a future epic); nothing in `datasourcev2/` or the DataSystem-related code paths is touched.
Highlights
Testing
Test plan for reviewers
Dependency
CI will be red on this PR until launchdarkly/okhttp-eventsource#109 is released to Maven Central. The `setInitialRetryDelayMillis` / `setMaxRetryDelayMillis` methods this SDK relies on are only in that PR's branch. Once released, bump `okhttp-eventsource` version in `lib/sdk/server/build.gradle`.