-
Notifications
You must be signed in to change notification settings - Fork 54
chore: Create FDv2 polling and fallback data source #348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Matthew M. Keeler <mkeeler@launchdarkly.com>
keelerm84
left a comment
There was a problem hiding this 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.
| 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) |
There was a problem hiding this comment.
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.
Note
Introduces a functional polling-based data acquisition path with FDv1 fallback and robust parsing/error handling.
PollingDataSourceimplementingInitializer/Synchronizerwith retry logic, recoverable/unrecoverable error handling, and header-drivenenvironment_id/revert_to_fdv1HTTPPollingRequester(FDv2/sdk/poll) andHTTPFDv1PollingRequester(FDv1/sdk/latest-all) with ETag support, selector/filter query params, and JSON parsingpolling_payload_to_changeset(FDv2 events) andfdv1_polling_payload_to_changeset(flags/segments) to produceChangeSetsDataSystem:polling_ds_builder,fdv1_fallback_ds_builder;streaming_ds_builderremains unimplementedResultto carry optionalheaders; updatesChangeSetBuilder.no_changesto useSelector.no_selectorWritten by Cursor Bugbot for commit fa0bb87. This will update automatically on new commits. Configure here.