Repository navigation
feat: Add payloadFilter option to request a filtered environment - #548
Draft
abelonogov-ld wants to merge 1 commit into
Draft
abelonogov-ld wants to merge 1 commit into
abelonogov-ld wants to merge 1 commit into
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requirements
Related issues
Mirrors
payloadFilterKeyin the React Native and browser SDKs (js-core#551) and follows the filtered environments SDK spec. Android counterpart: android-client-sdk#422.Describe the solution you've provided
Adds
LDConfig.payloadFilter(andObjcLDConfig.payloadFilter). When set, the SDK addsfilter=<key>to every flag data request:/meval, GET and REPORT)/msdk/evalx, GET and REPORT)DarklyServicevalidates the key once when it's created. A nil or empty key means no filter. A key that doesn't match^[a-zA-Z0-9][._\-a-zA-Z0-9]*$is dropped with an error log, and the full environment is requested, as the spec requires (filtering-strictbehavior).shouldGetReasons(url:)used to overwrite the URL's query items withwithReasons=true. It's replaced byaddingQueryItems(to:), which buildswithReasonsandfiltertogether, so both are sent when both are configured.The contract-test service now maps the harness's
streaming.filter/polling.filterto the new option and declares thefilteringandfiltering-strictcapabilities.Describe alternatives you've considered
loggermay be assigned afterpayloadFilter, so the error would go to the default logger; validating inDarklyServiceuses the final config.Additional context
This PR only sends the parameter; the SDK does no filtering of its own and doesn't change how it picks streaming or polling. The server doesn't currently apply the filter on every mobile endpoint:
/msdk/evalx): the streamer drops the query string before it reaches the origin, so these responses are unfiltered./meval): the filter is forwarded and applied to the initialputwhen thepayload-filter-gonfalon-sdk-endpointsflag is on. Live updates are only routed by filter whenpayload-filter-streamer-updatesis on.So an app that falls back to polling (or runs in the background, where iOS polls) may see the full flag set. The React Native SDK has the same limitation today.
I haven't run the contract test harness against this branch locally; the contract-test service builds. All 718 tests pass under
swift test.