Skip to content

Conversation

@jsonbailey
Copy link
Contributor

@jsonbailey jsonbailey commented Jan 13, 2026

Note

Introduces FDv2 polling support and FDv1 fallback, wiring them into the data system and enhancing error/metadata handling.

  • Adds PollingDataSource with fetch/sync, plus HTTP requesters HTTPPollingRequester (FDv2 /sdk/poll) and HTTPFDv1PollingRequester (FDv1 /sdk/latest-all) with ETag/304 handling and header extraction (x-launchdarkly-env-id, x-launchdarkly-fd-fallback).
  • Provides builders PollingDataSourceBuilder and FDv1PollingDataSourceBuilder and exposes them via DataSystem.polling_ds_builder and fdv1_fallback_ds_builder.
  • Implements payload parsing helpers: polling_payload_to_changeset (FDv2 events) and fdv1_polling_payload_to_changeset (flags/segments) returning ChangeSets.
  • Extends Result to include optional headers; fixes ChangeSetBuilder.no_changes to use Selector.no_selector.
  • Adds extensive specs for initializer, synchronizer, and payload parsing, covering success paths, recoverable/unrecoverable errors, fallback signaling, and env-id propagation.

Written by Cursor Bugbot for commit 85bc160. This will update automatically on new commits. Configure here.

@jsonbailey jsonbailey requested a review from a team as a code owner January 13, 2026 06:36
Copy link
Member

@keelerm84 keelerm84 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes seem okay to me, minus the bot feedback.

@jsonbailey jsonbailey requested a review from keelerm84 January 13, 2026 15:57
Base automatically changed from jb/sdk-1543/fdv2-test-data-source to main January 13, 2026 15:57
@jsonbailey jsonbailey changed the title chore: Create FDv2 and fallback polling data source chore: Create FDv2 polling and fallback data source Jan 13, 2026
@http_client = Impl::Util.new_http_client(config.base_uri, config)
.use(:auto_inflate)
.headers("Accept-Encoding" => "gzip")
end
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HTTP client connections never closed, causing resource leak

Medium Severity

HTTPPollingRequester and HTTPFDv1PollingRequester create persistent HTTP connections via new_http_client (which calls .persistent()) but neither class provides a stop or close method to release these connections. The existing Requestor class follows the pattern of having a stop method that calls @http_client.close. Without cleanup methods, persistent connections holding file descriptors and sockets are never released when the data source is stopped, leading to resource leaks in long-running applications.

Additional Locations (1)

Fix in Cursor Fix in Web

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.

3 participants