feat: warn that payload filtering has no effect with FDv2 - #1984
Conversation
Payload filtering is not supported with the FDv2 data system. Document that on the shared payloadFilterKey option and log a warning when it is configured alongside an FDv2 data system. Co-Authored-By: Bee Klimt <bklimt@launchdarkly.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
@cursor review |
|
@launchdarkly/js-sdk-common size report |
|
@launchdarkly/js-client-sdk-common size report |
|
@launchdarkly/js-client-sdk size report |
|
@launchdarkly/browser size report |
…-payload-filter-warning
Documents that the shared
payloadFilterKeyoption has no effect with the FDv2 data system, and logs a warning when it's configured alongside FDv2.Closes SDK-2974, part of SDK-2575.
payloadFilterKeyremains fully supported for FDv1, so the option itself is neither deprecated nor removed.constructFDv2; client-side warning from the sharedcreateFDv2DataManagerBase(covers browser, react-native and node-client).?filter=query param is still sent on FDv2 requests during this deprecation period; the FDv2 backend path doesn't use it to select the payload.Requirements
Implementation details
Related issues
Follows the same approach as the Go (launchdarkly/go-server-sdk#440) and Java (launchdarkly/java-core#209) deprecations, and the parallel Python (launchdarkly/python-server-sdk#518) / Ruby (launchdarkly/ruby-server-sdk#434) PRs. Payload-filter scenarios for FDv2 were removed from the test harness in launchdarkly/sdk-test-harness#431.
Describe the solution you've provided
packages/shared/sdk-server/src/api/options/LDOptions.tsandpackages/shared/sdk-client/src/api/LDOptions.ts: doc comments note that payload filtering isn't supported with FDv2.packages/shared/sdk-server/src/LDClientImpl.ts: warns inconstructFDv2whenpayloadFilterKeyis configured.packages/shared/sdk-client/src/datasource/FDv2DataManagerBase.ts: warns whenserviceEndpoints.payloadFilterKeyis configured. Centralizing it here covers every client-side SDK, since browser, react-native and node-client all build on this manager.Describe alternatives you've considered
?filter=from FDv2 request URLs now: deferred to the removal phase so this change is behavior-preserving.Additional context
Verified:
yarn workspace @launchdarkly/js-server-sdk-common test(53 suites, 1022 passed) andlint;yarn workspace @launchdarkly/js-client-sdk-common test(57 suites, 866 passed) andlint.Link to Devin session: https://app.devin.ai/sessions/ed604c6db94d452ea9f2dc35d6acc398
Open in Devin Desktop: https://app.devin.ai/desktop/session/ed604c6db94d452ea9f2dc35d6acc398?variant=devin
Requested by: @beekld
Note
Overview
When
payloadFilterKeyis set while using the FDv2 data system, the SDK now logs a warning that payload filtering is unsupported and has no effect on FDv2 requests.payloadFilterKeyis unchanged for FDv1 and is not removed or deprecated.Warnings are emitted at server FDv2 setup in
constructFDv2(LDClientImpl) and at shared client FDv2 setup increateFDv2DataManagerBase(browser, React Native, node-client). LDOptions doc comments on client and server now state the same limitation.Tests cover both code paths (warn when a filter key is present, no matching warn when absent).
Reviewed by Cursor Bugbot for commit cfaa48b. Bugbot is set up for automated code reviews on this repo. Configure here.