Skip to content

feat: Add an opt-in fetch-based EventSource entry to the browser SDK - #2033

Merged
joker23 merged 21 commits into
mainfrom
skz/sdk-3151/common-eventsource-node-consumers
Oct 30, 2026
Merged

joker23 merged 21 commits into
mainfrom
skz/sdk-3151/common-eventsource-node-consumers

Conversation

@joker23

@joker23 joker23 commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds an opt-in fetch()-based EventSource to the browser SDK behind its own @launchdarkly/js-client-sdk/fetch-eventsource entry point, so neither the implementation nor its dependency reaches the default bundle. The native browser EventSource remains the default. Includes the eventSource factory option plumbing. The example app moved to #2139 to keep this diff smaller.

The browser contract-test entity can be opened with ?eventsource=fetch, which makes every client use the fetch-based EventSource and advertise the client-use-post and client-event-source-http-errors capabilities. CI runs the fetch entity against both harnesses. The v2 run (with suppressions_fetch_eventsource.txt) covers the FDv1 path, including REPORT streaming and the poll tags header tests; the stream tags assertions are skipped because the transport strips the tags header. The v3 run (with suppressions_datamode_changes.txt) covers the FDv2 path, including the usePost POST streaming variants.

The transport does not send the x-launchdarkly-tags header. The streaming service's CORS allow-list does not include it, and the browser preflight would fail.

Replaces #2034 and #2048, which GitHub auto-marked merged during a stack reorder; their bot-review history lives there.


Note

Overview
Adds an optional @launchdarkly/js-client-sdk/fetch-eventsource subpath and eventSource client option so apps can stream with a fetch()-based EventSource instead of the native one, without pulling @launchdarkly/eventsource into the default bundle. BrowserRequests delegates creation to the configured factory and exposes capabilities (headers, custom method, read timeout) so REPORT / POST streaming can be enabled when the transport supports them; fetchBrowserEventSource strips x-launchdarkly-tags on stream requests to avoid CORS preflight failures.

CI and contract tests restart the browser entity with ?eventsource=fetch, run extra harness passes (FDv1/FDv2, native vs fetch), and split skip lists (suppressions_fetch_eventsource.txt, tightened suppressions_datamode_changes.txt). The entity advertises client-use-post and client-event-source-http-errors in fetch mode and maps usePost from harness config.

StreamingFDv2Base now classifies status-less filter failures as network errors, dedupes filter vs onerror for the same event object, and adds tests for those paths. React CI switches contract-test installs to yarn workspaces focus. Package-config baselines cover the new export.

Reviewed by Cursor Bugbot for commit 6b2eac2. Bugbot is set up for automated code reviews on this repo. Configure here.

@joker23
joker23 added this pull request to stack #2035 September 18, 2026 20:32
@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 32220 bytes
Compressed size limit: 32500
Uncompressed size: 152548 bytes

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 26066 bytes
Compressed size limit: 44000
Uncompressed size: 168326 bytes

@github-actions

github-actions Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 34404 bytes
Compressed size limit: 35000
Uncompressed size: 122974 bytes

@joker23
joker23 force-pushed the skz/sdk-3151/common-eventsource-node-consumers branch from 9c38ea8 to 724e94a Compare September 18, 2026 20:55
@joker23
joker23 force-pushed the skz/sdk-3151/common-eventsource-node-consumers branch from 724e94a to 4fe3c92 Compare September 18, 2026 21:36
@joker23
joker23 force-pushed the skz/sdk-3151/common-eventsource-node-consumers branch from 4fe3c92 to 197417a Compare September 21, 2026 13:44
@joker23
joker23 force-pushed the skz/sdk-3151/common-eventsource-node-consumers branch 4 times, most recently from b1572a2 to 684ed50 Compare September 22, 2026 19:53
@joker23
joker23 force-pushed the skz/sdk-3151/common-eventsource-node-consumers branch from 684ed50 to d5c5d4d Compare September 22, 2026 20:36
@joker23
joker23 force-pushed the skz/sdk-3151/common-eventsource-node-consumers branch from d5c5d4d to 039c061 Compare September 22, 2026 21:44
@joker23
joker23 force-pushed the skz/sdk-3151/common-eventsource-node-consumers branch from 039c061 to cd08556 Compare September 23, 2026 16:32
@joker23
joker23 force-pushed the skz/sdk-3151/common-eventsource-node-consumers branch 2 times, most recently from e73c276 to 8701dc9 Compare September 24, 2026 14:07
@joker23
joker23 force-pushed the skz/sdk-3151/common-eventsource-node-consumers branch from 8701dc9 to e4e333c Compare September 24, 2026 14:23
@joker23
joker23 force-pushed the skz/sdk-3151/common-eventsource-node-consumers branch from e4e333c to 7164a19 Compare September 24, 2026 15:20
@joker23
joker23 force-pushed the skz/sdk-3151/common-eventsource-node-consumers branch from 02bfa05 to 4a7be4e Compare October 7, 2026 15:55
devin-ai-integration[bot]

This comment was marked as resolved.

cursor[bot]

This comment was marked as resolved.

cursor[bot]

This comment was marked as resolved.

cursor[bot]

This comment was marked as resolved.

@github-actions github-actions Bot mentioned this pull request Oct 30, 2026
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.

2 participants