fix: FDv2 initializer readiness#1017
Conversation
|
@launchdarkly/browser size report |
|
@launchdarkly/js-sdk-common size report |
|
@launchdarkly/js-client-sdk-common size report |
|
@launchdarkly/js-client-sdk size report |
| // NOTE: this is a hack right now. The only condition that we will consider a valid basis | ||
| // is when there is a valid selector. Currently, the only data source that does not have a | ||
| // valid selector is the file data initializer, which will have a blank selector. | ||
| basisReceived(); |
There was a problem hiding this comment.
Would the FDv2 fallback also not have a selector? I may just not know how that part works.
There was a problem hiding this comment.
From my understanding here, the basis can be consumed without a selector, however that would not be considered a successful initialization from this particular initializer. I think this function might not be named correctly here as from the invocation it is simply a success callback (
). @tanderson-ld thoughts?There was a problem hiding this comment.
I agree there is a bug in the code before this PR as even when payload.basis is false, basisReceived is called.
LDClientImpl is passing in a function called initSuccess. I think at that time I had thought getting a basis (independent of selector) was sufficient to consider it initialized. This would be my thinking at the time since I thought this code path was only hit when basis == true.
Since Casey's requirement is "Basis with a Payload Selector.", should this logic be updated to ensure basis is also true when selector is not null?
The name basisRecieved in basisReceived: VoidFunction = () => {} parameter may need to be adjusted.
this commit also changes the initialization callback funciton to `initializedCallback` from `basisRecieved` to be more clear on what the callback is for.
🤖 I have created a release *beep* *boop* --- <details><summary>akamai-edgeworker-sdk-common: 2.0.12</summary> ## [2.0.12](akamai-edgeworker-sdk-common-v2.0.11...akamai-edgeworker-sdk-common-v2.0.12) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from ^2.17.0 to ^2.17.1 </details> <details><summary>akamai-server-base-sdk: 3.0.13</summary> ## [3.0.13](akamai-server-base-sdk-v3.0.12...akamai-server-base-sdk-v3.0.13) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^2.0.11 to ^2.0.12 * @launchdarkly/js-server-sdk-common bumped from ^2.17.0 to ^2.17.1 </details> <details><summary>akamai-server-edgekv-sdk: 1.4.15</summary> ## [1.4.15](akamai-server-edgekv-sdk-v1.4.14...akamai-server-edgekv-sdk-v1.4.15) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/akamai-edgeworker-sdk-common bumped from ^2.0.11 to ^2.0.12 * @launchdarkly/js-server-sdk-common bumped from ^2.17.0 to ^2.17.1 </details> <details><summary>browser-telemetry: 1.0.14</summary> ## [1.0.14](browser-telemetry-v1.0.13...browser-telemetry-v1.0.14) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/js-client-sdk bumped from 0.9.1 to 0.10.0 </details> <details><summary>cloudflare-server-sdk: 2.7.12</summary> ## [2.7.12](cloudflare-server-sdk-v2.7.11...cloudflare-server-sdk-v2.7.12) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common-edge bumped from 2.6.10 to 2.6.11 </details> <details><summary>fastly-server-sdk: 0.2.4</summary> ## [0.2.4](fastly-server-sdk-v0.2.3...fastly-server-sdk-v0.2.4) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from 2.17.0 to 2.17.1 </details> <details><summary>js-client-sdk: 0.10.0</summary> ## [0.10.0](js-client-sdk-v0.9.1...js-client-sdk-v0.10.0) (2025-12-09) ### Features * add initial polling retries to BrowserDataManager ([#1030](#1030)) ([cd91013](cd91013)) </details> <details><summary>js-server-sdk-common: 2.17.1</summary> ## [2.17.1](js-server-sdk-common-v2.17.0...js-server-sdk-common-v2.17.1) (2025-12-09) ### Bug Fixes * FDv2 initializer readiness ([#1017](#1017)) ([7a3af02](7a3af02)) </details> <details><summary>js-server-sdk-common-edge: 2.6.11</summary> ## [2.6.11](js-server-sdk-common-edge-v2.6.10...js-server-sdk-common-edge-v2.6.11) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from 2.17.0 to 2.17.1 </details> <details><summary>node-server-sdk: 9.10.5</summary> ## [9.10.5](node-server-sdk-v9.10.4...node-server-sdk-v9.10.5) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from 2.17.0 to 2.17.1 </details> <details><summary>node-server-sdk-dynamodb: 6.2.17</summary> ## [6.2.17](node-server-sdk-dynamodb-v6.2.16...node-server-sdk-dynamodb-v6.2.17) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/node-server-sdk bumped from 9.10.4 to 9.10.5 * peerDependencies * @launchdarkly/node-server-sdk bumped from >=9.4.3 to >=9.10.5 </details> <details><summary>node-server-sdk-otel: 1.3.5</summary> ## [1.3.5](node-server-sdk-otel-v1.3.4...node-server-sdk-otel-v1.3.5) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/node-server-sdk bumped from 9.10.4 to 9.10.5 * peerDependencies * @launchdarkly/node-server-sdk bumped from >=9.4.3 to >=9.10.5 </details> <details><summary>node-server-sdk-redis: 4.2.17</summary> ## [4.2.17](node-server-sdk-redis-v4.2.16...node-server-sdk-redis-v4.2.17) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/node-server-sdk bumped from 9.10.4 to 9.10.5 * peerDependencies * @launchdarkly/node-server-sdk bumped from >=9.4.3 to >=9.10.5 </details> <details><summary>server-sdk-ai: 0.15.2</summary> ## [0.15.2](server-sdk-ai-v0.15.1...server-sdk-ai-v0.15.2) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/js-server-sdk-common bumped from 2.17.0 to 2.17.1 * peerDependencies * @launchdarkly/js-server-sdk-common bumped from 2.x to 2.17.1 </details> <details><summary>server-sdk-ai-langchain: 0.4.2</summary> ## [0.4.2](server-sdk-ai-langchain-v0.4.1...server-sdk-ai-langchain-v0.4.2) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/server-sdk-ai bumped from ^0.15.1 to ^0.15.2 * peerDependencies * @launchdarkly/server-sdk-ai bumped from ^0.15.0 to ^0.15.2 </details> <details><summary>server-sdk-ai-openai: 0.4.2</summary> ## [0.4.2](server-sdk-ai-openai-v0.4.1...server-sdk-ai-openai-v0.4.2) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/js-server-sdk-common bumped from 2.17.0 to 2.17.1 * @launchdarkly/server-sdk-ai bumped from ^0.15.1 to ^0.15.2 * peerDependencies * @launchdarkly/server-sdk-ai bumped from ^0.15.0 to ^0.15.2 </details> <details><summary>server-sdk-ai-vercel: 0.4.2</summary> ## [0.4.2](server-sdk-ai-vercel-v0.4.1...server-sdk-ai-vercel-v0.4.2) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * devDependencies * @launchdarkly/server-sdk-ai bumped from ^0.15.1 to ^0.15.2 * peerDependencies * @launchdarkly/server-sdk-ai bumped from ^0.15.0 to ^0.15.2 </details> <details><summary>shopify-oxygen-sdk: 0.1.2</summary> ## [0.1.2](shopify-oxygen-sdk-v0.1.1...shopify-oxygen-sdk-v0.1.2) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common bumped from 2.17.0 to 2.17.1 </details> <details><summary>vercel-server-sdk: 1.3.37</summary> ## [1.3.37](vercel-server-sdk-v1.3.36...vercel-server-sdk-v1.3.37) (2025-12-09) ### Dependencies * The following workspace dependencies were updated * dependencies * @launchdarkly/js-server-sdk-common-edge bumped from 2.6.10 to 2.6.11 </details> --- 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] > Cuts a release with a browser SDK feature and a core bug fix, plus widespread version and dependency bumps across AI, server, edge, telemetry, and store packages. > > - **Features** > - Browser SDK (`@launchdarkly/js-client-sdk`) `0.10.0`: add initial polling retries. > - **Bug Fixes** > - Core server common (`@launchdarkly/js-server-sdk-common`) `2.17.1`: FDv2 initializer readiness. > - **Ecosystem Updates** (versions and embedded `sdkVersion` constants) > - **AI**: `@launchdarkly/server-sdk-ai` → `0.15.2`; providers (`langchain`, `openai`, `vercel`) → `0.4.2` with peer/dev dep bumps. > - **Server/Edge SDKs**: Node `9.10.5`; Cloudflare `2.7.12` (edge common `2.6.11`); Vercel `1.3.37`; Fastly `0.2.4`; Akamai base `3.0.13` and EdgeKV `1.4.15`. > - **Shared**: Edgeworker common `2.0.12`; Edge common `2.6.11`; Server common `2.17.1`. > - **Telemetry**: Browser telemetry `1.0.14` (uses browser SDK `0.10.0`); Node OTEL `1.3.5`. > - **Stores**: DynamoDB `6.2.17`; Redis `4.2.17` (peer/dev deps to Node SDK `9.10.5`). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 2615b2d. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Requirements
Describe the solution you've provided
This PR will:
Note
FDv2 now calls the initialization callback only when
payload.stateis non-empty, with tests added, and docs updated with an example forcustomdata source options.createPayloadListenerFDv2, replacebasisReceivedwithinitializedCallbackand invoke it only whenpayload.state !== ''duringapplyChanges.createPayloadListenersFDv2.test.tsto useinitializedCallbackand assert conditional invocation for non-empty vs empty state; keep existing behavior checks for basis/updates.CustomDataSourceOptionsinLDDataSystemOptions.tswith@experimentalnote and a usage example mirroring default standard options.Written by Cursor Bugbot for commit 38af523. This will update automatically on new commits. Configure here.