Repository navigation
feat: add payloadFilter option to request a filtered environment - #422
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>
Draft
2 of 3 tasks
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. iOS counterpart: ios-client-sdk#548.Describe the solution you've provided
Adds
LDConfig.Builder.payloadFilter(String). When set, the SDK addsfilter=<key>to every flag data request:/meval, GET and REPORT)/msdk/evalx, GET and REPORT), including the FDv1 fallback synchronizer in the data systemDefaultFDv2Requestoralready accepted a filter but was always passednull)The key is checked when the config is built. A null 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).The value reaches FDv1 data sources through
ClientContext.getConfig()and FDv2 builders through the internalDataSourceBuildInputsInternal, so there are no changes to the publicClientContextorDataSourceBuildInputsAPIs.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
StreamingDataSourceBuilder/PollingDataSourceBuilder, as the Java server SDK does. A single top-level option matches React Native and covers the FDv2 data system without changes to each builder.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 switches between streaming and polling may see the full flag set after a poll. The React Native SDK has the same limitation today.
I haven't run the contract test harness against this branch locally. All 764 unit tests pass.