From 4a191650f080f7bc6bc13d1e3dec996e44a117e5 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Thu, 3 Sep 2026 20:54:40 +0000 Subject: [PATCH] feat: warn that payload filtering has no effect with FDv2 Co-Authored-By: Bee Klimt --- lib/ldclient-rb/config.rb | 3 +++ lib/ldclient-rb/impl/data_system/fdv2.rb | 5 ++++ spec/impl/data_system/fdv2_datasystem_spec.rb | 23 +++++++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/lib/ldclient-rb/config.rb b/lib/ldclient-rb/config.rb index fb1c2170..638a4553 100644 --- a/lib/ldclient-rb/config.rb +++ b/lib/ldclient-rb/config.rb @@ -358,6 +358,9 @@ def offline? # This payload filter key only applies to the default streaming and polling data sources. It will not affect TestData or FileData # data sources, nor will it be applied to any data source provided through the {#data_source} config property. # + # Payload filtering is not supported with the FDv2 data system, so this key has no effect on requests made by FDv2 + # data sources. + # attr_reader :payload_filter_key # diff --git a/lib/ldclient-rb/impl/data_system/fdv2.rb b/lib/ldclient-rb/impl/data_system/fdv2.rb index edd016f0..2d28d69d 100644 --- a/lib/ldclient-rb/impl/data_system/fdv2.rb +++ b/lib/ldclient-rb/impl/data_system/fdv2.rb @@ -54,6 +54,11 @@ def initialize(sdk_key, config, data_system_config) @config = config @data_system_config = data_system_config @logger = config.logger + + unless config.payload_filter_key.nil? + @logger.warn { "[LDClient] Payload filtering is not supported with the FDv2 data system; the configured payload filter has no effect on FDv2 requests" } + end + @synchronizer_builders = data_system_config.synchronizers || [] @fdv1_fallback_synchronizer_builder = data_system_config.fdv1_fallback_synchronizer @disabled = @config.offline? diff --git a/spec/impl/data_system/fdv2_datasystem_spec.rb b/spec/impl/data_system/fdv2_datasystem_spec.rb index 3cff8ec1..6f3ae768 100644 --- a/spec/impl/data_system/fdv2_datasystem_spec.rb +++ b/spec/impl/data_system/fdv2_datasystem_spec.rb @@ -585,6 +585,29 @@ def build(_sdk_key, _config) fdv2.stop end end + + describe "payload filter key" do + let(:data_system_config) do + LaunchDarkly::DataSystem::ConfigBuilder.new + .initializers([]) + .synchronizers([]) + .build + end + + it "warns when a payload filter key is configured" do + logger = double.as_null_object + expect(logger).to receive(:warn) + + FDv2.new(sdk_key, LaunchDarkly::Config.new(logger: logger, payload_filter_key: "microservice-1"), data_system_config) + end + + it "does not warn when no payload filter key is configured" do + logger = double.as_null_object + expect(logger).not_to receive(:warn) + + FDv2.new(sdk_key, LaunchDarkly::Config.new(logger: logger), data_system_config) + end + end end end end