Repository navigation
Conversation
|
@launchdarkly/js-sdk-common size report |
|
@launchdarkly/js-client-sdk size report |
|
@launchdarkly/js-client-sdk-common size report |
7032cb2 to
c4b16bd
Compare
| redirect: 'error', | ||
| credentials: 'omit', | ||
| cache: 'no-store', |
There was a problem hiding this comment.
would like some opinions on this one. I personally don't see a reason to deviate from current behavior (what we have in nodes http/https implementation)
e974fde to
86efe47
Compare
86efe47 to
a023721
Compare
10e1865 to
cdaba41
Compare
cdaba41 to
36be846
Compare
| req.on('error', (err) => { | ||
| reject(err); | ||
| try { | ||
| return await net.fetch(url, { |
There was a problem hiding this comment.
🟡 Discarded error responses retain open connections
When error bodies exceed stream buffers, fetch leaves discarded responses paused. makeRequestor discards unsuccessful bodies, and EventSender never reads bodies. Unlike the former eagerly drained responses, these retain connections across retries.
Learn more
The previous response wrapper started reading every response immediately, including bodies callers ignored. Electron's native fetch instead exposes a backpressured body stream. The polling requestor reads only successful responses, and the event sender only inspects status and headers. An ignored body larger than the stream buffers pauses the underlying read. Electron pins its native URL loader until completion or cancellation, so garbage collection does not release that paused request. Polling retries can then create additional requests without releasing previous ones.
Example: A configured relay returns HTTP 500 with a 512 KiB diagnostic page. Polling rejects the status without reading or cancelling the page. The response pauses once its buffers fill, and the next poll opens another request while the previous loader remains retained.
Recommended fix: Preserve eager, rejection-safe response consumption for non-streaming requests, or explicitly cancel every response body that polling and event delivery discard. Keep the streaming path unbuffered. Add a regression test using a finite error body larger than the stream buffers and verify that the request completes or cancels after the caller ignores its body.
Was this helpful? React with 👍 or 👎 to provide feedback.
| // electron.net isn't available outside a real Electron main process. net.fetch is a standard | ||
| // fetch over Chromium's stack, so Node's own fetch stands in for it. Both decode a compressed | ||
| // body and keep the origin's content-encoding header. | ||
| jest.mock('electron', () => ({ | ||
| app: { | ||
| isReady: jest.fn(() => true), | ||
| whenReady: jest.fn(() => Promise.resolve()), | ||
| }, | ||
| net: { | ||
| fetch: jest.fn((url: string, init: RequestInit) => globalThis.fetch(url, init)), | ||
| }, |
There was a problem hiding this comment.
🔍 Native Electron transport remains untested
The net.fetch mock exercises Node fetch, not Chromium networking. REPORT requests, decompression, redirects, and cancellation lack native-runtime coverage. Electron integration tests remain necessary to validate those transport assumptions.
Was this helpful? React with 👍 or 👎 to provide feedback.
b2ba260 to
2d15645
Compare
There was a problem hiding this comment.
Risk: medium.
Automated risk review (dry run): Medium
This PR would not be automatically approved. Human approval required.
Why: This replaces the Electron SDK HTTP stack in ElectronRequests.ts (Node http/https to Electron net.fetch, streaming redirect handling, and the eventsource dependency), which is a bounded but meaningful behavior change. Cursor Bugbot was still pending after the wait window, so the automated reviewer signal is incomplete; human review is needed and no reviewers were assigned.
If you disagree with this review, share this PR in #feedback-agent-approvals or submit a changes-requested review explaining why.
Sent by Cursor Approval Agent: Dry-Run PR Approver


This PR will make it so that electron sdk will use the native
netmodule as the default HTTP transport.addresses:
Note
Overview
The Electron SDK’s platform HTTP layer now routes polling, analytics, diagnostics, and streaming through Electron’s
net.fetch(Chromium’s stack) instead of Nodehttp/httpsplus a custom response wrapper.ElectronRequestswaits forapp.whenReady(), applies caller timeouts viaAbortController, keeps non-streaming requests onredirect: 'error'withcredentials: 'omit'andcache: 'no-store', and uses a dedicated streaming path that **follow**s redirects and forcesaccept-encoding: identity.createEventSourceis wired to@launchdarkly/eventsource(replacinglaunchdarkly-eventsource) and reuses streamingfetch.ElectronResponseandHeaderWrapperare removed because responses are standard Fetch API objects.Tests add Electron mocks, streaming/SSE/timeout/redirect coverage, and client
close()cleanup so Jest can exit;HeaderWrappertests are dropped with the deleted type.Reviewed by Cursor Bugbot for commit 2d15645. Bugbot is set up for automated code reviews on this repo. Configure here.