Skip to content

feat: add RETRY-conformance contract tests for FDv1 streaming and polling - #404

Merged
tanderson-ld merged 11 commits into
v2from
ta/sdk-2808-retry-conformance-tests-v2
Aug 19, 2026
Merged

tanderson-ld merged 11 commits into
v2from
ta/sdk-2808-retry-conformance-tests-v2

Conversation

@tanderson-ld

@tanderson-ld tanderson-ld commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds contract tests exercising the RETRY specification's non-permanent-stop guarantee for the FDv1 streaming and polling data sources. Introduces two capability gates so SDKs can adopt independently:

  • retry-conformance-fdv1-streaming
  • retry-conformance-fdv1-polling

The new tests exercise the SDK's real production 5-minute extended-regime timing — no test-harness bypass, no compression knobs on the servicedef, no test-only surface in the SDK's public API. They are marked as long-running (t.LongRunning()) and only run when the harness is invoked with -enable-long-running-tests.

Legacy "do not retry after unrecoverable HTTP error" scenarios remain, gated behind the ABSENCE of the streaming capability so SDKs can migrate on their own schedule. Once every SDK reports the new capabilities, both the legacy tests and the gates can be removed.

What's added

Streaming (guarded by retry-conformance-fdv1-streaming + -enable-long-running-tests):

  • retry after unexpected HTTP error on initial connect (401/403/405)
  • retry after unexpected HTTP error on reconnect (401/403/405)
  • enters extended-regime backoff after unexpected HTTP error (paired-bound timing assertion)
  • does not permanently stop under sustained unexpected HTTP errors
  • returns to normal-regime backoff after healthy operation (streaming spec's activeSince reset: 75 s silent stream after an extended-regime reconnect, then next reconnect must be at normal-regime timing)

Polling (guarded by retry-conformance-fdv1-polling + -enable-long-running-tests):

  • retry after unexpected HTTP error on initial poll (401/403/405)
  • returns to normal-regime cadence after two consecutive successful polls (RETRY §1.8.1 count-based reset)

Design: long-running instead of compressed timings

An earlier revision of this PR exposed extended-regime timing knobs on the servicedef (ExtendedInitialDelayMS, ResetThresholdMS) so tests could compress the 5-minute extended-initial delay into a ~30-second observable window. Reviewers pushed back because that shape forced SDKs to expose corresponding test-only knobs on their public API surface just to be testable by the harness.

This revision drops all compression knobs and exercises real production timing instead. That makes each retry-conformance subtest take several minutes of wall clock, which is why the tests are marked t.LongRunning() and gated behind -enable-long-running-tests. Per-SDK CI schedules for the long-running suite are out of scope for this PR (planned follow-up work).

Framework support for t.LongRunning() and the -enable-long-running-tests flag was ported from v3 in #428, a prerequisite that landed before this PR's refactor.

Relationship to PR #401

Supersedes #401, which targeted v3 and exercised FDv2 code paths — out of scope for the initial RETRY-conformance work, which is FDv1-only. This PR targets v2 and drives the FDv1 streaming/polling paths in the SDK testservices. #401 will be closed with a pointer here.

SDK-2808

Test plan

  • Contract tests pass against go-server-sdk PR feat: Verify per-context private attributes are not applied to other contexts #429 (the reference server SDK implementation) at real production 5-minute extended-regime timing (~3-hour run with -enable-long-running-tests)
  • Legacy "do not retry" tests still pass for SDKs without the new capability (verified by SDK capability check)
  • Retry-conformance tests are correctly SKIPPED for SDKs without the capability
  • Retry-conformance tests are correctly SKIPPED when -enable-long-running-tests is not set

…ling

Adds SDK-facing capability gates (retry-conformance-fdv1-streaming,
retry-conformance-fdv1-polling) plus contract tests exercising the RETRY
specification's non-permanent-stop guarantee on 401/403/405 responses.

Streaming tests cover: retry after unexpected HTTP error on initial connect
and on reconnect, extended-regime backoff timing (paired-bound assertion),
and sustained-error survivability. Legacy "do not retry" tests are now
gated behind the ABSENCE of the streaming capability so SDKs can migrate
independently.

Polling tests cover: retry after unexpected HTTP error on initial poll.
Additional polling scenarios (extended-regime shape, two-consecutive-
success reset) are deferred to follow-up tickets.

New timing knobs on SDKConfigStreamingParams (ExtendedInitialDelayMS,
ResetThresholdMS) and SDKConfigPollingParams (ExtendedInitialDelayMS)
let tests compress the extended regime into an observable window.
Comment thread sdktests/server_side_stream_retry.go Resolved
tanderson-ld and others added 2 commits August 12, 2026 14:37
The sustained-retry test used the default 5 s NewSDKClient wait, so any
extended-regime retry attempts made during init were pre-buffered in the
mock endpoint before the assertion loop began. An SDK that retried a few
times and then permanently stopped could still satisfy the 3-iteration
drain, defeating the intent of the test.

- Set StartWaitTimeMS to 1 ms so NewSDKClient returns quickly and each
  RequireConnection observes a live retry attempt rather than draining a
  pre-filled buffer (mirrors the sibling extended-regime-backoff test).
- Add a final RequireConnection after the loop -- the "one more still
  arrives at the end" check the existing comment already described but
  which was missing from the code.
- Bump loop count from 3 to 5 and introduce a per-test timeout of 12 s
  that accommodates the extended-regime doubling backoff (500, 1000,
  2000, 4000, 8000 ms gaps) so a broken SDK cannot slip through with a
  handful of early attempts.

SDK-2808
Comment thread servicedef/service_params.go Resolved

@joker23 joker23 left a comment

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.

Comment thread sdktests/server_side_poll_retry.go Resolved
Comment thread sdktests/server_side_stream_retry.go Resolved
Comment thread sdktests/server_side_stream_retry.go Resolved
Per PR review: the evaluation assertions were reading before the
connection assertions that prove the retry actually happened. Reorder
so the tests read chronologically -- drain the expected connections
first, then evaluate the flag as the payoff.
Per PR review: add sections for "retry-conformance-fdv1-streaming" and
"retry-conformance-fdv1-polling" capabilities, and document the
associated streaming (extendedInitialDelayMs, resetThresholdMs) and
polling (extendedInitialDelayMs) configuration knobs the test harness
uses to compress the extended regime into an observable window.
@tanderson-ld

Copy link
Copy Markdown
Contributor Author

@joker23 Documented in 25df1a0. Added "retry-conformance-fdv1-streaming" and "retry-conformance-fdv1-polling" capability sections in docs/service_spec.md, plus the associated extendedInitialDelayMs / resetThresholdMs streaming knobs and the polling extendedInitialDelayMs knob in the config schema.

Comment thread docs/service_spec.md Resolved
…ormance

The two legacy "do not retry after unrecoverable HTTP error" tests were
gated only by CapabilityClientEventSourceHTTPErrors. Under the RETRY
specification, an SDK that declares retry-conformance-fdv1-streaming
retries after those errors instead of permanently stopping, so the
legacy tests would fail against a compliant client-side SDK.

Adds the same skip-when-capability-present guard the server-side legacy
tests already use, so the client-side suite is ready for future client
SDK adoption of the RETRY capability.
Comment thread sdktests/client_side_stream_retry.go Resolved
tanderson-ld added a commit that referenced this pull request Aug 18, 2026
## Summary

Ports the framework scaffolding portion of
[#314](#314)
(Jason Bailey, "fix: Add support for optional long running tests") from
v3 to v2.

## What ships

- `-enable-long-running-tests` CLI flag (default false). Mirrors the
`-enable-persistence-tests` shape.
- `EnableLongRunningTests bool` on `ldtest.TestConfiguration`.
- `(t *T) LongRunning()` method. Long-running tests call it at the top
of their body; if the flag isn't set, the test skips with reason `"use
-enable-long-running-tests to run"`.
- Threaded through `RunSDKTestSuite` and `main.go`.

## What's deliberately not ported

The original commit
([`01a245c`](01a245c))
also added 237 lines to `sdktests/common_tests_stream_fdv2.go`. That
file exercises v3-only FDv2 shapes and has no place on v2. Skipped.

## Why now

Scaffolding for follow-up work on
[#404](#404).
Review feedback there
([discussion](#404 (comment)),
[discussion](#404 (comment)))
argued against exposing an SDK-side servicedef knob to compress the
extended-regime timing in the RETRY-conformance tests. The consensus was
that those tests should run at real timing gated by the
long-running-tests mechanism — which requires that mechanism to exist on
v2 first.

Once this lands, #404 rebases onto v2 tip and its RETRY-conformance
tests get `t.LongRunning()` calls at the top of their bodies, plus
timing rewritten to production defaults.

## Verification

- `go build ./...` — clean.
- `go run . -h` — new flag visible: `-enable-long-running-tests enable
tests that take a long time to run (10+ seconds)`.
- `go test ./...` — full suite green. No behavior change to existing v2
tests since none of them call `t.LongRunning()`.

## Test plan

- [x] Confirm the port matches the shape of #314's framework portion.
- [ ] Confirm the CLI flag help text is acceptable (verbatim from
Jason's original).
- [ ] Confirm no v3-only content bled through.

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> Adds optional **long-running test** gating on v2, mirroring the
existing `-enable-persistence-tests` pattern.
> 
> The harness accepts `-enable-long-running-tests` (default false). That
value flows through `main` → `RunSDKTestSuite` →
`ldtest.TestConfiguration.EnableLongRunningTests`. Tests can call
`t.LongRunning()` at the start; when the flag is off they skip with
reason `use -enable-long-running-tests to run`.
> 
> No existing v2 tests call `LongRunning()` yet, so default runs behave
the same until follow-up tests adopt the helper.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
536af50. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
…ning gate

Remove the servicedef knobs (ExtendedInitialDelayMS, ResetThresholdMS) that
would require SDK-side test-harness bypasses in the public API. Instead, mark
the retry-conformance streaming and polling tests as long-running so they
exercise the SDK's real 5-minute extended-regime delay directly.

Add regime-recovery tests:
- streaming: verifies the healthy-operation reset per the streaming spec's
  activeSince mechanics (first SSE event sets marker; reset evaluated on
  next reconnection when >= 60 s have elapsed).
- polling: verifies RETRY §1.8.1's count-based reset (two consecutive
  successful polls return the SDK to normal-regime cadence).

@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.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9964faf. Configure here.

Comment thread sdktests/server_side_stream_retry.go Resolved
Comment thread sdktests/server_side_poll_retry.go Resolved
- server_side_stream_retry.go "retry after unexpected HTTP error on initial
  connect": RequireConnection returns before the SDK reads the SSE payload,
  so an immediate EvaluateAllFlags could observe an empty store. Switch to
  pollUntilFlagValueUpdated, matching the sibling reconnect test.

- server_side_poll_retry.go "returns to normal-regime cadence": dropping
  the second 401 that would spuriously fail a spec-conformant SDK. A 401
  after the §1.8.1 reset re-enters extended regime under RETRY, so the
  following poll would take ~5 min, not the ~30 s the assertion expected.
  Prove the reset by observing that a post-reset success arrives at normal
  PollInterval cadence.
@tanderson-ld
tanderson-ld merged commit ee4d85f into v2 Aug 19, 2026
7 checks passed
@tanderson-ld
tanderson-ld deleted the ta/sdk-2808-retry-conformance-tests-v2 branch August 19, 2026 19:04
tanderson-ld pushed a commit that referenced this pull request Aug 19, 2026
🤖 I have created a release *beep* *boop*
---


##
[2.40.0](v2.39.0...v2.40.0)
(2026-08-19)


### Features

* add RETRY-conformance contract tests for FDv1 streaming and polling
([#404](#404))
([ee4d85f](ee4d85f))


### Bug Fixes

* Retry the test harness download and surface curl errors
([#411](#411))
([2a7533b](2a7533b))

---
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 2.40.0** bumps the package version in
`.release-please-manifest.json`, `main.go` (`versionString`), and
documents the release in `CHANGELOG.md`.
> 
> The changelog for this tag records two already-merged changes:
**RETRY-conformance** contract tests for FDv1 **streaming** and
**polling** (capability-gated, including long-running retry-regime
checks), and a **downloader** fix that **retries** harness downloads and
**surfaces curl errors** for easier CI debugging.
> 
> There is no additional functional code in this PR diff beyond the
version and changelog updates.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
b96a76c. 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>
tanderson-ld added a commit to launchdarkly/go-server-sdk that referenced this pull request Aug 25, 2026
## Summary

Brings the FDv1 streaming and polling data sources into conformance with
the [RETRY specification](https://github.com/launchdarkly/sdk-specs).
Previously-terminal HTTP responses (401, 403, other 4xx that aren't
400/408/429) and TLS/certificate validation failures no longer cause a
permanent stop — the data sources engage an extended-regime backoff and
continue retrying indefinitely.

- **Streaming:** unexpected failures activate an extended retry curve on
the underlying `eventsource` stream (base 5 min → cap 1 h, doubling with
jitter). Sixty seconds of continuous healthy operation — measured from
the last received event, not from connection establishment — reverts to
the normal-regime curve.
- **Polling:** new `pollingStrategy` state machine encoding RETRY §1.4
with a wait floor at `PollInterval` per §1.4.4. Unexpected failures
engage the extended regime with `initialDelay = max(configured,
PollInterval)`; two consecutive successful polls reset back to the
normal regime per §1.8.

FDv2 adoption of RETRY is out of scope for this ticket (deferred to a
future epic).

## Public API

Unchanged, and no test-only surface is added.

An earlier revision of this PR exposed extended-regime timing knobs
through `<Builder>.Internal()` escape hatches plus a new
`testhelpers/datasourcetest` package, so the harness could compress the
5-minute extended delay into an observable window. Reviewers pushed back
on forcing test-only knobs into the public API surface just to be
testable, and that approach was reverted. The contract tests exercise
real production timing instead.

## Behavior change to call out in release notes

**A bad or revoked SDK key no longer fails fast.** Previously a 401 was
terminal: the data source stopped, state went to `OFF`, and
`MakeCustomClient` returned `ErrInitializationFailed`. Now it returns
`ErrInitializationTimeout` once the full `waitFor` elapses, state stays
`INITIALIZING` (or `INTERRUPTED` if the client had previously reached
`VALID`), and the SDK keeps retrying on the extended curve. Callers
matching on `ErrInitializationFailed` to detect a bad key will see
different behavior and will block for the whole init timeout rather than
returning immediately.

`DataSourceStateOff` is now reserved for explicit shutdown and
unparseable configuration.

## Testservice / contract tests

- Declares the `retry-conformance-fdv1-streaming` and
`retry-conformance-fdv1-polling` capabilities so the sdk-test-harness
can drive the conformance suite.
- No servicedef additions: the compression knobs from the earlier
revision were removed along with the public API escape hatches.
- Harness-side tests are launchdarkly/sdk-test-harness#404, now merged
to `v2` and shipped in 2.41.0. They are marked long-running and run only
under `-enable-long-running-tests`, which this repo's CI does not
currently pass, so the retry-conformance suite is exercised out of band
for now. Note that declaring the capabilities also deactivates the
legacy "do not retry" tests, which are gated on the capability's
absence.

## Test plan

- [x] Unit tests in `internal/datasource` pass (streaming + polling +
`pollingStrategy`)
- [x] End-to-end tests in `ldclient_end_to_end_test.go` pass
- [x] eventsource dependency is released: v1.14.0 is published, `go.mod`
requires it, and CI builds against the released version with no local
`replace`
- [x] Full contract suite with `-enable-long-running-tests` against
harness `v2` @ 2.41.0: **4931 total, 4922 ran, 9 skipped, 0 failed**
(~51 min). All seven retry-conformance subtests ran; the 9 skips are
unrelated capabilities (`tls:verify-peer`, `user-type`, `wrapper`),
persistence, and the two legacy "do not retry" tests correctly
self-skipping.
- [x] End-to-end 401 validation against a fault-injecting origin, at
real production timings:
- **streaming, entry and reset:** 401 → extended regime engaged, first
retry at 3m37s (vs the 30 s normal ceiling). After 75 s of healthy
operation and a benign close, reconnect in **710 ms** on the normal
curve. A fresh 401 re-engages the extended regime from its base rather
than from a doubled state.
- **streaming, ceiling:** sustained 401s climb 3m01s → 8m12s → 12m37s →
31m25s → 55m49s → **49m44s** — doubling off the 5 min base, then
clamping at the 1 h ceiling. The sixth rung is the decisive one: an
uncapped ladder would have required 80–160 min there. Recovery from the
ceiling reconnects in **554 ms** on the normal curve.
- **polling:** 401 → extended (2m52s, vs the 30 s cadence); still
extended after a single success (3m38s); the normal 30 s cadence returns
only after the second consecutive success, per §1.8.1.
  - `DataSourceStateOff` was never observed in any run.
- [x] Ladder arithmetic also pinned deterministically against released
eventsource v1.14.0 with these exact constants: exact ladder `5m, 10m,
20m, 40m, 1h, 1h, 1h, 1h`; every delay within `[T/2, T]` over 200
jittered trials; reset from the ceiling returns exactly the 1 s normal
base and re-arms the extended profile at 5 min; 59 s of healthy
operation does **not** reset.

### Known follow-ups (not addressed here)

- Per-SDK CI scheduling for the long-running suite.
- Polling recovery is count-based, and the first success does not
shorten the wait. After an outage long enough to reach the 1 h ceiling,
returning to the 30 s cadence can therefore take roughly two hours.
Measured at the 5 min rung; extrapolated at the ceiling. Streaming is
unaffected because its reset is time-based.
<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> FDv1 streaming and polling now **retry indefinitely** instead of
treating 401/403/other 4xx (except 400/408/429) and TLS/cert errors as
terminal. Those failures are classified as **unexpected** and use a
slower backoff (default 5m, cap 1h, jitter); other errors stay on the
normal curve. Status stays `Interrupted` (or `Initializing` if never
`Valid`); `Off` is reserved for explicit shutdown or unparseable config.
Init on a bad key now times out (`ErrInitializationTimeout`) rather than
`ErrInitializationFailed`.
> 
> Streaming uses eventsource **retry profiles** (`eventsource` 1.14) and
cancels via request context. Polling adds a `pollingStrategy` state
machine with a `PollInterval` wait floor and reset after two consecutive
successes.
> 
> Docs for `DataSourceStateOff` and client init errors are updated to
match. Testservice advertises `retry-conformance-fdv1-streaming` /
`retry-conformance-fdv1-polling`.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
576f4d3. 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: Jason Bailey <jbailey@launchdarkly.com>
tanderson-ld added a commit to launchdarkly/java-core that referenced this pull request Aug 31, 2026
…#200)

## Summary

Implements RETRY-spec conformance in the Java server SDK's FDv1
streaming and polling data sources
([SDK-2789](https://launchdarkly.atlassian.net/browse/SDK-2789)). This
PR is scoped to the server SDK only; the classifier helpers it consumes
ship separately in #204.

**Behavioral change.** HTTP responses that today cause an FDv1 data
source to permanently stop (notably 401 / 403 / other 4xx) and TLS /
certificate validation failures are no longer terminal. Streaming enters
an extended-regime backoff (5 min initial → 1 hr max, doubling); polling
continues at its configured cadence but engages the extended-regime wait
after an UNEXPECTED failure. Either regime returns to normal after 60 s
of continuous healthy operation (streaming) or two consecutive
successful polls (polling).

**Scope.** FDv1 streaming and polling under `lib/sdk/server/`. FDv2,
event delivery, and other network callers are unchanged.

## What changed

- **`PollingStrategy`** — New state-machine encapsulation with
`onFailure(class)` / `onSuccess()` / `nextWait()`. State: `n` (formula
input), `initialDelay`, `maxDelay`, `priorPollWasSuccessful`. Wait floor
is `max(pollInterval, T − J)`; two consecutive successes reset from
extended → normal.
- **`PollingProcessor`** — Rewired to a self-driven loop that consults
`strategy.nextWait()` between attempts. The `State.OFF` permanent-stop
path is removed; the state stays `INITIALIZING` or `INTERRUPTED` with a
`lastError`.
- **`StreamProcessor`** — Consumes okhttp-eventsource's new
multi-strategy retry API from
[launchdarkly/okhttp-eventsource#110](launchdarkly/okhttp-eventsource#110).
On `UNEXPECTED` classification it calls `activateRetryDelayStrategy` on
the underlying `EventSource` to switch into the extended-regime
`RetryDelayStrategy`. The library's built-in healthy-op reset returns
the SDK to normal-regime timing after 60 s of continuous connectivity.
- **`DataSourceStatusProvider` docs** — `State.INITIALIZING`,
`State.OFF`, `State.INTERRUPTED`, and `getStateSince` OFF-case Javadocs
updated to reflect the new semantics (no HTTP-error → OFF transition).
Aligned with the Go server SDK's parallel doc adjustments.
- **`LDClient` constructor Javadoc** — Wording tightened so a "wrong SDK
key" scenario is described as ongoing retry in the background, not as an
"unsuccessful initialization" that reads as terminal.
- **Contract-test service** — Declares
`retry-conformance-fdv1-streaming` and `retry-conformance-fdv1-polling`
capabilities.

The classifier this SDK depends on — `FailureClass` and
`HttpErrors.classify*` helpers — ships in #204.

## Testing

- **Unit tests** — Full suite green. New coverage: `PollingStrategyTest`
(strategy state machine), plus extended-regime timing-observation tests
in `StreamProcessorTest`. Existing 401 / 403 tests were rewritten to
assert extended-regime retry rather than permanent stop.
- **Contract tests via
[sdk-test-harness#404](launchdarkly/sdk-test-harness#404
— All 7 RETRY-conformance test cases pass end-to-end at production
timing (5-minute extended-initial delay). Total wall clock ~12 min via
parallel shards.

## Test plan for reviewers

- [x] Verify `PollingStrategy` transition semantics: normal → extended
fires exactly once per `UNEXPECTED` failure; two consecutive successful
polls fully reset (`n = 0`, delay bounds back to normal, `inExtended`
cleared so a subsequent `UNEXPECTED` re-triggers the transition).
- [ ] Verify `StreamProcessor.handleError` ordering: classifier → regime
switch → `updateStatus(INTERRUPTED, …)`, unconditionally returning true
so the eventsource keeps retrying.
- [x] Review the `DataSourceStatusProvider` Javadoc changes for accuracy
vs. the current state machine.
- [x] Code comments deliberately describe *current behavior* only — no
spec section refs, no historical framing ("previously", "no longer"), no
cross-SDK references. Confirm you'd expect a reader to find that
acceptable.

## Dependencies (why CI is red)

Two unreleased upstream artifacts:

- **`launchdarkly-java-sdk-internal ≥ 1.11.0`** — Must be released
before this PR can build against Maven Central. Ships via
#204 + its release-please chore.
- **`okhttp-eventsource ≥ 5.0.0`** — Must be released before this PR can
build against Maven Central. Ships via
[launchdarkly/okhttp-eventsource#110](launchdarkly/okhttp-eventsource#110).

Once both are released, bump their versions in
`lib/sdk/server/build.gradle` and CI will go green. Locally, the branch
builds against `mavenLocal()` snapshots of both.

[SDK-2789]:
https://launchdarkly.atlassian.net/browse/SDK-2789?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> **FDv1 data sources no longer treat HTTP auth and other “unexpected”
failures as terminal.** Streaming and polling keep retrying in the
background with classified backoff instead of moving to `State.OFF`
(e.g. 401/403).
> 
> **Polling** switches from fixed-rate scheduling to a self-driven loop
backed by new **`PollingStrategy`**: normal cadence at `pollInterval`,
extended exponential backoff (default 5 min → 1 hr cap, jitter) after
`FailureClass.UNEXPECTED`, reset after two consecutive successes.
> 
> **Streaming** adopts **okhttp-eventsource 5.x** multi-regime
`RetryDelayStrategy`: normal reconnect caps at 30s; on unexpected
failures the SDK activates an extended strategy (5 min → 1 hr) and
relies on a 60s healthy-connection threshold to return to normal timing.
> 
> **Public docs and tests** align with the new model:
`DataSourceStatusProvider` Javadoc and `LDClient` init wording no longer
describe HTTP errors as permanent shutdown; contract-test service
advertises retry-conformance capabilities; unit/e2e tests assert
continued retry and extended-regime behavior. Dependencies bump
**`launchdarkly-java-sdk-internal`** and **`okhttp-eventsource`** for
`HttpErrors` classification and strategy APIs.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
50513bc. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->

BEGIN_COMMIT_OVERRIDE
feat: conform FDv1 streaming and polling data sources to the RETRY
specification

HTTP responses that previously caused a data source to permanently stop
(notably 401, 403, and other 4xx), and TLS certificate validation
failures no longer terminate it. Streaming enters an extended backoff
regime starting at 5 minutes and doubling to a 1 hour ceiling; polling
continues at its configured interval but engages the extended regime
after an unexpected failure. Streaming returns to normal backoff after
60 seconds of continuous healthy operation; polling returns to its
normal cadence after two consecutive successful polls.

Two consequences are visible to applications.
DataSourceStatusProvider.State.OFF is now reached only by explicit
shutdown, not by an HTTP error, so applications monitoring for OFF to
detect an invalid SDK key will no longer see it. And because an invalid
SDK key no longer short circuits initialization, the LDClient
constructor waits out the full startWait timeout rather than returning
as soon as the 401 arrives.
END_COMMIT_OVERRIDE
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.

4 participants