Repository navigation
Conversation
|
@launchdarkly/js-sdk-common size report |
|
@launchdarkly/js-client-sdk-common size report |
|
@launchdarkly/js-client-sdk size report |
9c38ea8 to
724e94a
Compare
724e94a to
4fe3c92
Compare
4fe3c92 to
197417a
Compare
b1572a2 to
684ed50
Compare
684ed50 to
d5c5d4d
Compare
d5c5d4d to
039c061
Compare
039c061 to
cd08556
Compare
e73c276 to
8701dc9
Compare
8701dc9 to
e4e333c
Compare
e4e333c to
7164a19
Compare
1f93481 to
b17e046
Compare
3f05376 to
fd9e7c8
Compare
fd9e7c8 to
42838fd
Compare
42838fd to
596108e
Compare
02bfa05 to
4a7be4e
Compare
…ate some comments
There was a problem hiding this comment.
Devin Review found 1 potential issue.
1 flag not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
| // x-launchdarkly-tags. A browser preflight with that header fails, and the stream | ||
| // can never connect. | ||
| const { 'x-launchdarkly-tags': _tags, ...headers } = eventSourceInitDict.headers; | ||
| return createEventSource(url, { |
There was a problem hiding this comment.
🟡 Network failures reported as HTTP errors
For a status-less fetch failure, alreadyReported suppresses the network error after handleError queues an HTTP error with status 0. Clients receive ERROR_RESPONSE instead of NETWORK_ERROR, losing the failure message.
Learn more
The fetch-based EventSource calls the error filter before dispatching its error event. For a status-less failure, handleError currently builds errorInfoFromHttpError(0). The new guard discards the subsequent onerror result, which previously carried errorInfoFromNetworkError(err.message). The orchestrator passes the remaining error kind, message, and status code into reportStatusError, so consumers now see an HTTP response that never occurred.
Example: If fetch() rejects with network unreachable, the stream reports ERROR_RESPONSE, Unexpected status code: 0, and status code 0 instead of NETWORK_ERROR and network unreachable.
Recommended fix: Classify status-less failures as network errors in handleError, using the provided message, while retaining the single-result suppression in onerror. Add an assertion for the error kind and message in the status-less failure test.
Was this helpful? React with 👍 or 👎 to provide feedback.
| }, | ||
| "optionalDependencies": { | ||
| "@launchdarkly/eventsource": "0.2.1" | ||
| }, |
There was a problem hiding this comment.
Optional EventSource pin is unpublished
High Severity
The browser SDK pins optional @launchdarkly/eventsource to 0.2.1, but the workspace package, changelog, and release-please manifest are still at 0.2.0. Installs skip the missing optional package, so importing @launchdarkly/js-client-sdk/fetch-eventsource fails to resolve createEventSource.
Reviewed by Cursor Bugbot for commit 4577f29. Configure here.
There was a problem hiding this comment.
I think this is false
| }, | ||
| "dependencies": { | ||
| "@launchdarkly/js-client-sdk": "4.13.0" | ||
| }, |
There was a problem hiding this comment.
Example pins a nonexistent SDK version
Medium Severity
The new example depends on @launchdarkly/js-client-sdk 4.13.0, but the workspace package is still 4.12.0 (as is example/package.json). Yarn will not link the local SDK for an unsatisfied exact range, so the example cannot install or import the new fetch-eventsource entry until that version exists.
Reviewed by Cursor Bugbot for commit 4577f29. Configure here.
There was a problem hiding this comment.
I also think this is false
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
There are 3 total unresolved issues (including 2 from previous reviews).
❌ 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 5b13155. Configure here.
| // Every branch below queues a result for this failure, so onerror must not | ||
| // queue another one for the same event. | ||
| filterHandledFailure = true; | ||
|
|
There was a problem hiding this comment.
Network errors misclassified as HTTP errors
Medium Severity
The new filterHandledFailure mark stops onerror from reporting a status-less failure after the error filter already ran, which is the fetch EventSource path. handleError still always builds errorInfoFromHttpError(err.status ?? 0), so a network drop is recorded as ErrorResponse with status 0 ("Unexpected status code: 0") instead of NETWORK_ERROR. Data source status, inspectors, and diagnostics then show the wrong error kind for every offline or connection-drop on the opt-in transport.
Additional Locations (1)
Reviewed by Cursor Bugbot for commit 5b13155. Configure here.


Summary
Adds an opt-in
fetch()-basedEventSourceto the browser SDK behind its own@launchdarkly/js-client-sdk/fetch-eventsourceentry point, so neither the implementation nor its dependency reaches the default bundle. The native browserEventSourceremains the default. Includes theeventSourcefactory option plumbing and an example app.The browser contract-test entity can be opened with
?eventsource=fetch, which makes every client use the fetch-basedEventSourceand advertise theclient-use-postandclient-event-source-http-errorscapabilities. CI runs the fetch entity against both harnesses with no skip list: the v2 run covers the FDv1 path, includingREPORTstreaming and the tags header tests, and the v3 run covers the FDv2 path, including theusePostPOST streaming variants.The transport does not send the
x-launchdarkly-tagsheader. 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 opt-in
fetch()-based streaming transport for the browser SDK via a separate@launchdarkly/js-client-sdk/fetch-eventsourceexport (optional@launchdarkly/eventsourcedependency), keeping the nativeEventSourceas the default bundle.Introduces the
eventSourcefactory option: validated in browser options, wired throughBrowserPlatform/BrowserRequests, and used to advertise transport capabilities (e.g. POST streaming whencustomMethodis true).fetchBrowserEventSourceforwards stream init options but dropsx-launchdarkly-tagsbecause CORS preflight would fail.Contract tests and CI gain a
?eventsource=fetchentity mode (injects the fetch factory, enablesusePost, advertisesclient-use-post/client-event-source-http-errors), extra harness runs (native + fetch for FDv1/FDv2), updated suppression lists, and a small custom EventSource example app.In shared FDv2 streaming,
StreamingFDv2Baseavoids duplicate interrupted results when transports invoke both the error filter andonerrorfor the same failure.Reviewed by Cursor Bugbot for commit 5b13155. Bugbot is set up for automated code reviews on this repo. Configure here.