Repository navigation
feat: Re-enable blocked FDv2 synchronizers when the SDK key changes - #466
Conversation
LDClient.SetSDKKey now tells the data system that the key changed. The FDv2 data system unblocks the synchronizers that failed permanently, because the failure can depend on the key. The FDv1 fallback is now a mode of the synchronizer list, separate from the blocked state. After an FDv1 fallback, the data system stays on FDv1 when the key changes. The FDv2 synchronizers are still unblocked, so they keep their order if the data system returns to FDv2. When no synchronizer is available, the synchronizer loop now waits for a key change instead of exiting. On a key change it starts the first available synchronizer and leaves the off state. A running synchronizer is not interrupted.
| return | ||
| case <-f.sdkKeyChanged: | ||
| f.loggers.Info("SDK key changed, re-enabling synchronizers") | ||
| f.synchronizers.unblock() |
There was a problem hiding this comment.
I think it is worth a comment here that this is valid when all synchronizers depend on the SDK key, but this may become invalid if a future developer adds more types of synchronizers that can be blocked but that do not depend on the sdk key.
It may possibly be a bug waiting to happen if we unblock a synchronizer that has nothing to do with sdk keys but was blocked for good reason.
There was a problem hiding this comment.
This reply is from an AI agent (Claude Code), posted for @kinyoklion.
Changed in 3d3a7a9. I added the comment to the new unblockSynchronizers function. A key change unblocks all synchronizers. I did not try to unblock only the key failures, because a status code is not a reliable signal. For example, a custom synchronizer can send no status code. If a failure does not depend on the key, the synchronizer fails again and is blocked again. This costs one more attempt for each key change. If a key failure stays blocked, the synchronizer cannot run until the application restarts. A server directive is not a block, so a key change does not undo it. A new test covers this.
| // unblock clears the blocked state of every slot, including FDv2 slots in FDv1 mode. The | ||
| // mode does not change, so after an FDv1 fallback only the FDv1 fallback slot is available. | ||
| // The current slot does not change. | ||
| func (l *synchronizerList) unblock() { |
There was a problem hiding this comment.
This reply is from an AI agent (Claude Code), posted for @kinyoklion.
Done in 3d3a7a9. The function name is now unblockAll.
| case <-f.sdkKeyChanged: | ||
| f.loggers.Info("SDK key changed, re-enabling synchronizers") | ||
| f.synchronizers.unblock() | ||
| f.synchronizers.next() |
There was a problem hiding this comment.
unblock didn't reset the index. Is next appropriate without an index reset? Perhaps it figures itself out and this is intentional and fine.
There was a problem hiding this comment.
This reply is from an AI agent (Claude Code), posted for @kinyoklion.
Changed in 3d3a7a9. You are correct. The old code worked only because of a hidden condition: when no synchronizer is available, next() has already set the index to -1. But a key change is a recovery, not a fallback, so the loop must go to the most preferred synchronizer. The code now calls reset() before next(), as the recovery path does. A failure after a key change during a run also goes back to the first synchronizer.
| // The data system is no longer off. It is interrupted if it has data, and | ||
| // initializing otherwise. | ||
| if f.dataApplied.Get() { | ||
| f.UpdateStatus(interfaces.DataSourceStateInterrupted, f.getStatus().LastError) | ||
| } else { | ||
| f.UpdateStatus(interfaces.DataSourceStateInitializing, f.getStatus().LastError) | ||
| } |
There was a problem hiding this comment.
Data source status contract: this transition violates the documented API, and we should decide how deliberately we want to do that.
This block moves the data source state from Off back to Interrupted/Initializing. The public status API currently promises that can't happen:
interfaces/data_source_status_provider.go:165— "DataSourceStateOff indicates that the data source has been permanently shut down."interfaces/data_source_status_provider.go:70—WaitForblocks until the desired state, or "the state has become DataSourceStateOff (since that is a permanent condition)", or timeout.
The WaitFor doc has behavioral teeth: both implementations (the FDv1 sink's waitFor and FDv2's dataStatusProvider.WaitFor) return false the instant they observe Off. So with this PR, an application that calls WaitFor(Valid, …) while every synchronizer is blocked on a 401 is told "permanent condition, give up" at exactly the moment this feature says "don't give up — SetSDKKey may fix it." An app that reasonably tears down or recreates the client on Off defeats the recovery this PR builds. (Related: FDv2's WaitFor only short-circuits on Off at call time, not inside its listen loop — tolerable while Off was unreachable mid-wait, incoherent once it's a state you can pass through.)
It also makes Off ambiguous. After this PR there are two kinds: recoverable Off (synchronizer exhaustion, cures on key change) and genuinely-final Off (fallback directive with no FDv1 fallback configured — "off for good" per the description). Observers get no way to tell them apart.
Fleet precedent — I audited the Java, .NET, Python, and Ruby FDv2 implementations for exactly this question:
| SDK | Off documented permanent? | Exhaustion → public status | Ever leaves Off? |
|---|---|---|---|
| Java | Yes, + waitFor give-up is test-locked |
Off; orchestration thread exits; log: "will not be used again until application restart" | No |
| .NET | Yes; hard latch in the sink (test UpdateStatusIgnoresEverythingAfterOff) |
Interrupted — a sanitizer maps source-level Off → Interrupted; public Off is reserved for truly-final cases | No |
| Python | FDv1: yes, latched, "final for the lifetime"; FDv2 provider: unlatched | OFF | Yes, but it reads as accidental (transient OFF leaks mid-fallback; no test asserts OFF stickiness) |
| Ruby | Deliberately scoped: "Unless the SDK is configured with data_system_config, no other state follows this one." |
OFF | Yes — documented carve-out |
No other SDK has runtime key change, so none has faced deliberate recovery out of Off. But the strict implementations (Java/.NET) and the deliberate exception (Ruby) point at the two coherent ways to resolve this:
- Don't enter
Offwhen recovery is possible (.NET's shape). At exhaustion, reportInterrupted(if data was applied) or stayInitializing(if not) — i.e., run this block'sdataAppliedbranch at the point of exhaustion instead of after the key change, and never reportOffin between.Offstays reserved for the genuinely-final cases. Zero public-doc changes,WaitForstays coherent (a waiter simply keeps waiting through a rotation), and it's arguably more accurate here than it is for .NET: once this PR lands, exhaustion really is "an error that it will attempt to recover from," which isInterrupted's documented meaning. - Keep the transition and do the contract work (Ruby's shape). Amend the
DataSourceStateOff,WaitFor,DataSourceStateInitializing, andStateSincedocs to scope the permanence claim, and decide deliberately whatWaitForshould do whenOffcan recover — either answer changes documented, observable behavior.
Two more data points for the discussion: the DATASYSTEM v2 spec currently agrees with the old reading (the fallback-directive state diagram ends Off --> [*], and the 1.7.10 example log is "…will not be used again until application restart"), and the Initializing branch here is novel fleet-wide — no SDK ever re-enters INITIALIZING after leaving it; Ruby's FDv2 provider actively coerces it away, and in Java it isn't even expressible.
My leaning is option 1 — it's the smaller change, keeps every existing promise intact, and this block is already 90% of the implementation — but either is defensible if we make the choice explicitly rather than as a side effect of the key-change feature.
There was a problem hiding this comment.
Now as I think about this more, we plan to have RETRY conformance in FDv2 at some point, which will make it such that synchronizers never block themselves due to an invalid SDK key, they will just report some sort of long retry interval (max 1 hour) up to the FDv2 data system orchestrator. So exhaustion will just not happen in the invalid SDK key case in the future.
So I think the conclusion of this thread is to pick a stopgap that is well behaved in the interim. As it is right now, the code violates the API documentation. I don't know if that is ok to do temporarily if we think this case is exceedingly rare anyways.
There was a problem hiding this comment.
Concretely, one stopgap shape: report Interrupted at exhaustion (or stay Initializing if no data has ever applied — i.e., run the dataApplied branch from this block at the point of exhaustion), keep the key-change wakeup exactly as implemented, and never emit Off for this condition at all.
Pros
- No API-doc violation, temporary or otherwise.
Offkeeps its documented meaning (explicit shutdown; fallback directive with no FDv1 fallback configured), andWaitForstays truthful: aWaitFor(Valid, …)caller keeps waiting while recovery viaSetSDKKeyis genuinely possible, instead of being told "permanent condition" and giving up. Offstays unambiguous — observers never have to guess whether a givenOffis recoverable.- The interim behavior matches the RETRY end state. Under RETRY conformance a 401'd synchronizer keeps retrying and the system shows
Interruptedthroughout; doing the same at exhaustion now means RETRY adoption later changes nothing an application can observe. No second migration of status semantics. - Precedent: .NET already surfaces synchronizer exhaustion as
Interruptedand reserves publicOfffor truly-final states (its sink hard-latchesOff). - Implementation cost is ~zero — it's the same branch this diff already contains, anchored at a different event.
Cons
Interrupted's doc says the data source "will attempt to recover" — in the interim that's a stretch: nothing retries until a key change arrives, so the system is recovery-capable, not recovery-attempting. (This objection dissolves once RETRY lands and it genuinely is retrying.)- We lose the explicit "the SDK has given up" signal. An operator or alert keying on
Offto detect a fatally misconfigured key can't distinguish "down, will self-heal" from "down until someone rotates the key" —Interrupted-forever is less diagnosable thanOff. This is the standing criticism of .NET's behavior. Mitigation: synthesize a dedicatedErrorInfoat exhaustion (e.g., "all data sources exhausted; waiting for SDK key change") the way Java/.NET do, so the diagnosis lives in the error payload rather than the state enum. - The no-data variant shows
Initializingindefinitely, which may read as understated severity for what is likely a bad key — thoughLastErrorcarries the 401, andcloseWhenReadystill unblocks the constructor path, so nothing hangs. - Diverges from Java (exhaustion →
Off, thread exits) and from Go FDv2's current released behavior — a behavior change for anyone already observing FDv2 statuses, though the FDv2 surface is young and the exhaustion case is rare.
On balance I think the pros win: the cons are diagnosability trade-offs we can largely buy back with a good ErrorInfo, while the pro side avoids shipping a contract violation whose window is bounded by customer upgrade cadence, not by when RETRY merges.
There was a problem hiding this comment.
This reply is from an AI agent (Claude Code), posted for @kinyoklion.
Changed in 3d3a7a9. I used option 1. When no synchronizer is available, the data system does not set Off. A permanent failure already reports Interrupted, also before data arrives (see #461). The status stays Interrupted, and LastError keeps the 401. After a key change, the data system does not change the status. The new synchronizer sets it. This removes the transition from Off to Initializing, and WaitFor(Valid) continues to wait. Off is now only for final conditions, for example a fallback directive with no FDv1 fallback. I did not add a synthesized ErrorInfo, because it would hide the 401. The warning log tells the operator that a key change restarts the synchronizers. This changes released behavior, so I will add it to the PR description.
…hange When no synchronizer is available, the data source status no longer changes to Off. A key change can restart the synchronizers, so the data system is not permanently off. The status stays Interrupted and keeps the error of the permanent failure. WaitFor callers keep waiting instead of giving up. Off stays reserved for final conditions, such as a fallback directive with no FDv1 fallback configured. A key change that arrives while a synchronizer runs is no longer lost. If that synchronizer then fails permanently, the failure can come from a request that carried the old key. The synchronizer is not blocked, and the data system returns to the first available synchronizer. After a key change with no synchronizer running, the data system returns to the first available synchronizer, as on a recovery. A key change unblocks every synchronizer, not only the ones whose failure depended on the key. The data system cannot reliably tell those failures apart, and a missed recovery would last until the application restarts.
This reverts the status change of 3d3a7a9. When no synchronizer is available, the data source status is Off again, as on v7. An application that does not change the SDK key sees no change: Off is permanent, as the interfaces package documents, and WaitFor callers stop waiting at once. Only LDClient.SetSDKKey, which is for the Relay Proxy only, moves the status out of Off. The key change unblocks every synchronizer, returns to the first available one, and sets the status to Interrupted with the last error. The state change restarts StateSince, so the fallback conditions do not count the time spent off. The tests of the existing FDv2 status behavior are the same as on the base branch again.
…nizers SetSDKKey does not compare the new key with the current key. A call with the current key also starts the FDv2 synchronizers that failed permanently again. The Relay Proxy uses this to try a key again after LaunchDarkly rejected it, for example a new key that LaunchDarkly did not know yet. A test now pins this, so a later change that skips an unchanged key fails.
The name says that the method is for the Relay Proxy only, like the LDRelayDataDestination configuration field. "Apply" says that the key takes effect, not only that the client stores it.
go-sdk-events#63 is released in v3.8.0. It adds DiagnosticsManager.SetSDKKey, which LDRelayApplySDKKey uses. The module now requires that release instead of the pseudo-version of the unmerged PR. The testservice module is tidied to the same version.
…o mk/SDK-3277/reenable-synchronizers
… stops (#482) ## Summary The FDv2 polling synchronizer leaks goroutines. This change fixes two leaks in `internal/datasourcev2/polling_data_source.go`. **Ticker leak.** `Sync` starts a goroutine that forwards ticks from a `time.Ticker`. That goroutine reads the ticker channel until the channel closes. `time.Ticker.Stop` does not close the channel, so the goroutine never exits. Each call to `Sync` leaks one goroutine, also after `Close`. The FDv1 fallback synchronizer uses the same processor, so it leaks too. **Result-send leak.** The `Sync` goroutine sends each result on an unbuffered channel. These sends do not check for `Close`. The data system stops reading results before it closes a synchronizer. If a poll is in flight at that time, its send blocks forever. The `Sync` goroutine and its ticker goroutine then never exit. The fix: - `tickerWithInitialTick` has its own `Stop` method. `Stop` stops the ticker and tells the forwarding goroutine to exit. The `Sync` goroutine already calls `Stop` on every exit path. - The `Sync` goroutine sends each result in a `select` with the quit channel. On `Close`, it closes the result channel and exits. Other behavior does not change. The synchronizer polls once at the start and then once per interval. `Close` stops polling and closes the result channel. ## Why now #466 and launchdarkly/ld-relay#899 let the Relay Proxy restart synchronizers that stopped permanently. The Relay Proxy retries once per cleanup interval (default one minute) while a client is off, so each environment would leak about 1,440 goroutines per day. ## Tests - `TestPollingProcessorSynchronizerStopsItsGoroutinesWhenItStops` starts and closes 20 polling synchronizers against an `httptest` server. In one subtest, the server sends valid data. In the other subtest, the server sends a 401, so each synchronizer stops itself before the test closes it. The test counts the goroutines that this package started. It reads a full stack dump with a buffer that grows until the dump fits. The count must go back to its start value. - `TestPollingProcessorSynchronizerClosingDuringPollStopsItsGoroutines` holds a poll open in the handler. The test closes the processor and then releases the poll. The goroutines must exit, and the result channel must close. The synchronizer sends each kind of result from a different place, so the test has a case for each one: valid data, a 401, a 500, malformed data, and an FDv1 fallback request. One more case uses a 1 ms poll interval, so the ticker has a tick waiting to be delivered when the processor closes. Control run: the new tests fail on unmodified `v7` code. | Test | Goroutines before | Goroutines after | |------|-------------------|------------------| | valid data | 0 | 20 | | 401 | 20 | 40 | | close during poll (each of the 6 cases) | 40, 42, ... 50 | 2 more than before | The start values grow because the goroutines from the earlier tests do not exit. With only the ticker fix, every close-during-poll case still fails (2 goroutines left in each). This shows that the result-send leak is real. With both fixes, removing the `Close` check from any one send, or the ticker's stop check while it holds a tick, makes exactly one case fail. With both fixes, the new tests pass 20 times in a row with `-race`. `go test -race ./...` and `make lint` pass. _This PR was opened by an AI agent (Claude Code) for @kinyoklion._ <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > Fixes **goroutine leaks** in the FDv2 `PollingProcessor` synchronizer so `Sync`/`Close` tear down background work instead of leaving goroutines running. > > The polling loop now sends results through a **`send` helper** that `select`s on `resultChan` and `pp.quit`. If the processor is closed while nobody is reading (e.g. poll still in flight), it closes the result channel and exits instead of blocking forever on an unbuffered send. > > **`tickerWithInitialTick`** no longer relies on the embedded ticker channel never closing. It adds a dedicated `Stop` that stops the underlying `time.Ticker` and signals a `stop` channel so the tick-forwarding goroutine can exit; the `Sync` goroutine already calls `Stop` on shutdown. > > Adds tests that start many synchronizers and assert package-scoped goroutine counts return to baseline, including **close during an in-flight poll** across success, error, fallback, and pending-tick cases. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 00e2600. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->
…nchronizers # Conflicts: # ldclient.go # ldclient_sdk_key_test.go
On Windows, time.Now can return the same time for two calls a few microseconds apart. The data system turns off and the key change follows at once, so the restarted StateSince could equal the time of the off state. The test now waits until the clock has moved past that time. Two tests check that a wait for the valid state returns at once while the data system is off. They allowed 30ms, which a slow runner can exceed. They now allow 200ms, which is still well below the 1s timeout of the wait.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ 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 5ecdaa1. Configure here.
| // A server directive is not a block, so unblocking does not undo it. An FDv1 fallback is a | ||
| // mode of the synchronizer list, and unblocking does not change the mode. A fallback directive | ||
| // with no FDv1 fallback configured stops the synchronizer loop or keeps it from starting, so | ||
| // no loop receives the key change. |
There was a problem hiding this comment.
Run-on comment mixes several concerns
Low Severity
The unblockSynchronizers comment packs several separate points into two long paragraphs: which slots are unblocked and why, the extra-attempt cost, that a server directive is not a block, that FDv1 fallback is a mode, and that a fallback with no FDv1 configured leaves no loop. Comments in internal/datasystem stay at two to four lines per paragraph, with a bare // break between distinct concerns.
Triggered by learned rule: Go comments: split paragraphs; no Returns() tuples
Reviewed by Cursor Bugbot for commit 5ecdaa1. Configure here.
🤖 I have created a release *beep* *boop* --- ## [7.21.0](v7.20.0...v7.21.0) (2026-10-22) ### Features * Allow the Relay Proxy to change the SDK key of a running client ([#457](#457)) ([605d1ae](605d1ae)) * Re-enable blocked FDv2 synchronizers when the SDK key changes ([#466](#466)) ([2a3ce4c](2a3ce4c)) ### Bug Fixes * Drop a file path listed more than once instead of treating its entries as duplicate keys ([#477](#477)) ([8b5641e](8b5641e)) * Notify overridden flags when the LaunchDarkly data they depend on changes ([#479](#479)) ([ceff41c](ceff41c)) * Stop the polling synchronizer's goroutines when the synchronizer stops ([#482](#482)) ([592d1d3](592d1d3)) * Update go-sdk-events to v3.8.1 ([#485](#485)) ([151ca66](151ca66)) --- 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 7.21.0** — bumps the packaged SDK version from `7.20.0` to `7.21.0` in `.release-please-manifest.json`, `internal/version.go` (`SDKVersion`), and adds the **7.21.0** section to `CHANGELOG.md`. > > This release tag documents work already merged since 7.20.0: **Relay Proxy** can change a running client’s SDK key, with **FDv2** synchronizers that were blocked re-enabled on key change; file-source handling drops duplicate file paths instead of failing on duplicate keys; overridden flags get notified when underlying LaunchDarkly data changes; the polling synchronizer stops its goroutines on shutdown; and **go-sdk-events** is updated to v3.8.1. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 66b112d. 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>
…failures (#489) A synchronizer that fails in a way that will not resolve on retry, such as an HTTP 401, is now parked for a bounded time instead of being retired for the life of the client. - Synchronizers report `Interrupted` with `UnexpectedFailure` set instead of `Off`. The data system parks the synchronizer, waits a jittered failover delay of 0.5-1s, and starts the next eligible synchronizer after it, wrapping around the list. - The park delay starts at 5 minutes and doubles up to 1 hour, with jitter. The data system keeps the park count for each synchronizer, so it survives a new instance on each start. A synchronizer clears it with `ResetExtendedBackoff` when it meets its reset threshold: 60s of healthy streaming, or 2 consecutive successful polls. - When every synchronizer is parked, the status is `Interrupted` and the data system waits for the earliest unpark time. Fallback and recovery conditions select from the eligible synchronizers only. - A synchronizer that fails to build is parked like any other unexpected failure. - A synchronizer raises the readiness signal only when it delivers a full payload. - An SDK key change from `LDRelayApplySDKKey` unparks every synchronizer. Sorry about the churn in naming ("blocked" -> "parked", "available" -> "eligible", and so on). This work went on in parallel with #466, and while resolving the conflicts I went with the names in the spec. Note: This does not implement `Retry-After` or FDv1 Fallback TTL, which are new features that will be added later. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > FDv2 no longer **permanently retires** synchronizers after errors like HTTP 401. They now report **`Interrupted`** with **`UnexpectedFailure`**, and the data system **parks** them with escalating backoff (5 minutes, doubling to 1 hour, with jitter) instead of removing them from rotation. When every synchronizer is parked, status stays **`Interrupted`** and the loop waits for the earliest unpark time; **`Off`** is reserved for explicit **`Stop()`**. > > Synchronizers can clear park escalation via **`ResetThresholdMet`**: polling after **two consecutive successful polls**, streaming after **~60s of healthy operation** (including a quiet stream). The FDv2 loop applies a **jittered failover delay** after parking, treats **recovery before fallback** when both conditions match, and signals client **readiness only for a full payload** (`IntentTransferFull`). **`LDRelayApplySDKKey`** **unparks** all synchronizers so the Relay can retry rejected keys. > > Polling and streaming processors, file data source, and **`DataSynchronizerResult`** were updated to emit the new flags and default errors to **`Interrupted`** rather than **`Off`**. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit e912c37. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY -->


Summary
Stacked on #457. Retarget to
v7after #457 merges.A permanent synchronizer failure often depends on the SDK key, for example a 401. After
LDClient.LDRelayApplySDKKeyapplies a key, that failure may no longer apply.LDRelayApplySDKKeynow tells the data system, and the FDv2 data system unblocks every synchronizer that failed permanently.Off, as before. The synchronizer loop then waits for a key change instead of exiting. On a key change, the loop returns to the first available synchronizer, as on a recovery, and moves the status fromOfftoInterrupted.LastErrorkeeps the error of the failure. The state change restartsStateSince, so the fallback conditions do not count the time spent off.LDRelayApplySDKKeynever blocks.Status behavior
An application that does not call
LDRelayApplySDKKeysees no change. When every synchronizer fails permanently, the status isOff, the warning log isNo more synchronizers available, andWaitForreturnsfalseat once. For that application,Offstays permanent, as theinterfacespackage documents.Only
LDRelayApplySDKKey, which is for the Relay Proxy only, moves the status out ofOff. Its doc comment says so. The Relay Proxy is designed for that transition: it re-keys its client whatever the status, and it applies the current key again while the client isOff.An earlier revision (3d3a7a9) reported
Interruptedinstead ofOffwhen no synchronizer was available. 6b33ff2 reverts that.Interruptedsays that the SDK tries to recover, but until FDv2 supports the extended retry, nothing retries without a key change, and an application other than the Relay Proxy never changes the key.The description was updated by an AI agent (Claude Code) for @kinyoklion.
Note
Overview
Relay Proxy key rotation can recover FDv2 clients that had permanently blocked synchronizers (e.g. 401).
LDRelayApplySDKKeynow notifies the data system via a non-blockingSDKKeyChanged()hook after the key override is applied.FDv2 unblocks all permanently failed synchronizers, keeps the synchronizer loop alive when none are available (waits on a one-slot channel instead of exiting), and transitions data source status from Off to Interrupted on key change so retry timing resets. Failures after a key change during an active sync use a new syncRestart path (no block, reset to first synchronizer). Running synchronizers are not interrupted; unblocked peers become eligible for fallback/recovery again.
Synchronizer list treats FDv1 fallback as a separate mode (
onFDv1) from per-slot blocking;unblockAll()clears blocks without leaving FDv1 mode. FDv1 implementsSDKKeyChangedas a no-op.Unit and client integration tests cover off-state recovery, FDv1 fallback after key change, in-flight key changes, and re-applying the same key.
Reviewed by Cursor Bugbot for commit 5ecdaa1. Bugbot is set up for automated code reviews on this repo. Configure here.