Skip to content

Conversation

@jsonbailey
Copy link
Contributor

@jsonbailey jsonbailey commented Jan 13, 2026

Note

Introduces a functional polling-based data acquisition path with FDv1 fallback and robust parsing/error handling.

  • New PollingDataSource implementing Initializer/Synchronizer with retry logic, recoverable/unrecoverable error handling, and header-driven environment_id/revert_to_fdv1
  • Adds HTTP clients: HTTPPollingRequester (FDv2 /sdk/poll) and HTTPFDv1PollingRequester (FDv1 /sdk/latest-all) with ETag support, selector/filter query params, and JSON parsing
  • Parsing utilities: polling_payload_to_changeset (FDv2 events) and fdv1_polling_payload_to_changeset (flags/segments) to produce ChangeSets
  • Wires builders in DataSystem: polling_ds_builder, fdv1_fallback_ds_builder; streaming_ds_builder remains unimplemented
  • Extends Result to carry optional headers; updates ChangeSetBuilder.no_changes to use Selector.no_selector
  • Adds specs for initializer behavior, synchronizer state transitions, header handling, and payload parsing

Written by Cursor Bugbot for commit fa0bb87. 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
LaunchDarkly::Result.fail(changeset_result.error, changeset_result.exception, response_headers)
end
rescue JSON::ParserError => e
LaunchDarkly::Result.fail("Failed to parse JSON: #{e.message}", e)
Copy link

Choose a reason for hiding this comment

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

JSON parse errors lose response headers with fallback signal

Low Severity

The JSON::ParserError rescue blocks in HTTPPollingRequester and HTTPFDv1PollingRequester don't pass response_headers to Result.fail, even though the variable is in scope (assigned on line 259/336 before parsing occurs). All other error paths in these methods correctly include headers. If the server sends a 2xx response with the x-launchdarkly-fd-fallback header but malformed JSON body, the fallback signal is lost and the synchronizer will keep retrying instead of reverting to FDv1.

Additional Locations (1)

Fix in Cursor Fix in Web

@jsonbailey jsonbailey changed the title chore: Create FDv2 and fallback polling data source chore: Create FDv2 polling and fallback data source Jan 13, 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.

3 participants