Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
5ce3fda
feat: orchestrator switches to FDv1 fallback on directive
beekld May 23, 2026
77c972f
chore: add orchestration logging for FDv2 data system
beekld Jun 2, 2026
5a2a9bc
fix: stop emitting kOff status from FDv2DataSystem destructor
beekld Jun 4, 2026
86b2e3d
feat: add FDv1AdapterSynchronizer wrapping IDataSynchronizer as IFDv2…
beekld May 28, 2026
8cc95b6
feat: add FDv2 configuration builder
beekld Jun 2, 2026
cdaec02
feat: add FDv1 polling overload to FDv2Builder::FDv1Fallback
beekld Jun 3, 2026
b3690ca
feat: variadic synchronizers, initializers, and per-source endpoint o…
beekld Jun 3, 2026
62709ec
test: update FDv2 URL tests to match refactored signatures
beekld Jun 4, 2026
a39b086
refactor: split FDv1 and FDv2 streaming/polling configs
beekld Jun 4, 2026
9bb657e
refactor: FDv2Builder starts empty; add Default() for spec config
beekld Jun 4, 2026
abbc191
feat: wire FDv2 dataSystem into server contract tests
beekld Jun 4, 2026
0469d55
test: add v3 contract test harness suppression file
beekld Jun 4, 2026
3e465ab
ci: add v3 contract test harness job for FDv2
beekld Jun 4, 2026
6074215
ci: add curl-backend variant of v3 contract test harness job
beekld Jun 4, 2026
a6ffcae
feat: derive FDv1 fallback synchronizer from harness synchronizers
beekld Jun 4, 2026
f99f1ad
chore: distinguish engaged vs. unconfigured FDv1 fallback in logs
beekld Jun 8, 2026
82d2730
fix: ignore FDv1 fallback directive when FDv1 source is active
beekld Jun 8, 2026
c164913
test: cover initializer ChangeSet+directive basis preservation
beekld Jun 8, 2026
44f47f4
feat: parse X-LD-FD-Fallback-TTL header into FDv2SourceResult
beekld Jun 8, 2026
6ca1a49
feat: parse protocolFallbackTTL and retryAfter from goodbye
beekld Jun 8, 2026
8f19a0e
feat: schedule FDv2 retry after FDv1 fallback TTL
beekld Jun 8, 2026
5b9e51e
merge: bring in FDv1 fallback TTL changes from #539
beekld Jun 8, 2026
407bc56
merge: bring in FDv1 fallback TTL changes from #540
beekld Jun 8, 2026
e1a9969
test: adapt new TTL streaming tests to 545's endpoint signature
beekld Jun 8, 2026
07d752d
merge: bring in FDv1 fallback TTL changes from #545
beekld Jun 8, 2026
303b3a8
chore: remove unused retry_after field from goodbye
beekld Jun 9, 2026
7f1e999
merge: pick up retry_after removal from #539
beekld Jun 9, 2026
c22e53d
merge: pick up retry_after removal from #540
beekld Jun 9, 2026
3ff8d63
merge: pick up retry_after removal from #545
beekld Jun 9, 2026
b1157e1
feat: translate FDv1 status changes to FDv2 results in FDv1AdapterSyn…
beekld Jun 9, 2026
638babc
merge: pick up FDv1 status translation from #540
beekld Jun 9, 2026
b2eae57
fix: pass status manager to FDv1AdapterSynchronizer
beekld Jun 9, 2026
2d7fe90
merge: pick up FDv1 status translation from #540
beekld Jun 9, 2026
9a93aab
docs: explain got_basis reuse in FDv1 fallback branch
beekld Jun 11, 2026
67126a9
fix: reset FDv1 fallback retry source between schedules
beekld Jun 11, 2026
81b1c7f
merge: pick up OpenSSL bump from main
beekld Jun 11, 2026
373150d
merge: pick up OpenSSL bump from #539
beekld Jun 11, 2026
71c202c
merge: pick up OpenSSL bump from #540
beekld Jun 11, 2026
fe0cd3d
merge: pick up OpenSSL bump from #545
beekld Jun 11, 2026
292c779
merge: pick up #539 squash from main
beekld Jun 11, 2026
7afaf7e
merge: pick up #539 squash from #540
beekld Jun 11, 2026
ecb1e0f
merge: pick up #539 squash from #545
beekld Jun 11, 2026
27f5c1e
fix: serialize StartAsync/ShutdownAsync on wrapped FDv1 source
beekld Jun 11, 2026
dab36f4
merge: pick up FDv1 source lifecycle fix from #540
beekld Jun 11, 2026
af98d9f
merge: pick up FDv1 source lifecycle fix from #545
beekld Jun 11, 2026
6c428c5
fix: give FDv1 adapter a private status manager
beekld Jun 11, 2026
55bd262
merge: pick up #549 from main
beekld Jun 11, 2026
7d01543
merge: pick up FDv1 adapter status sink fix from #540
beekld Jun 11, 2026
d759139
fix: wire FDv1 adapter factories to new private-status-manager API
beekld Jun 11, 2026
7bc416b
merge: pick up FDv1 adapter status sink fix from #545
beekld Jun 11, 2026
2f68933
fix: hold FDv1 source via shared_ptr and forward init-time errors
beekld Jun 12, 2026
937bf4a
merge: pick up shared_ptr/init-error fixes from #540
beekld Jun 12, 2026
1524301
fix: construct FDv1 sources via make_shared for enable_shared_from_this
beekld Jun 12, 2026
f7b69c6
merge: pick up shared_ptr/init-error fixes from #545
beekld Jun 12, 2026
796d25c
merge: pick up #550 from main
beekld Jun 12, 2026
15f5d5d
merge: pick up #550 from #540
beekld Jun 12, 2026
04e5f6a
merge: pick up #550 from #545
beekld Jun 12, 2026
83a5e4d
fix: handle FDv2 intentCode none as listening, reject unknown codes
beekld Jun 12, 2026
68c95ef
merge: pick up intentCode none fix from #555
beekld Jun 12, 2026
7575233
merge: pick up intentCode none fix from #545
beekld Jun 12, 2026
f40b13f
merge: pick up main after #540 squash
beekld Jun 15, 2026
1b6f086
merge: pick up main after #540 squash from #555
beekld Jun 15, 2026
83fe01b
merge: pick up main after #540 squash from #545
beekld Jun 15, 2026
3cadda8
merge: pick up main after #555 squash
beekld Jun 16, 2026
d908a20
merge: pick up main after #555 squash from #545
beekld Jun 16, 2026
13bdf20
docs: correct DisableFDv1Fallback comment to match actual behavior
beekld Jun 16, 2026
c3588e8
merge: pick up DisableFDv1Fallback doc fix from #545
beekld Jun 16, 2026
41b797e
merge: pick up #552 from main
beekld Jun 16, 2026
4566c7c
merge: pick up #552 from #545
beekld Jun 16, 2026
45f5926
refactor: replace public FDv2Builder ctor with Custom() factory
beekld Jun 16, 2026
f2cb722
merge: pick up FDv2Builder::Custom() refactor from #545
beekld Jun 16, 2026
440ee68
test: suppress FDv1 fallback directive halt scenario (tracks SDK-2527)
beekld Jun 16, 2026
afe78d6
refactor: remove public FDv2 payload-filter API; keep internal plumbing
beekld Jun 17, 2026
8de3efe
merge: pick up Filter API removal from #545
beekld Jun 17, 2026
6beade2
test: drop FDv2 payload filter wiring from contract harness
beekld Jun 17, 2026
1293152
Merge remote-tracking branch 'origin/main' into beeklimt/SDK-2102
beekld Jun 17, 2026
6190fe3
Merge remote-tracking branch 'origin/main' into beeklimt/SDK-2102
beekld Jun 18, 2026
5a479d4
fix: derive FDv1 fallback polling URL from synchronizers when fdv1Fal…
beekld Jun 18, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/server.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,27 @@ jobs:
test_service_port: ${{ env.TEST_SERVICE_PORT }}
token: ${{ secrets.GITHUB_TOKEN }}

contract-tests-fdv2:
runs-on: ubuntu-22.04
env:
TEST_SERVICE_PORT: 8123
TEST_SERVICE_BINARY: ./build/contract-tests/server-contract-tests/server-tests
SUPPRESSION_FILE: contract-tests/server-contract-tests/test-suppressions-fdv2.txt
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955
- uses: ./.github/actions/ci
with:
cmake_target: server-tests
run_tests: false
- name: 'Launch test service as background task'
run: $TEST_SERVICE_BINARY $TEST_SERVICE_PORT 2>&1 &
- name: 'Run v3 SDK test harness'
run: |
curl -s https://raw.githubusercontent.com/launchdarkly/sdk-test-harness/v3.0.0-alpha.3/downloader/run.sh \
| VERSION=v3.0.0-alpha.3 \
PARAMS="-url http://localhost:$TEST_SERVICE_PORT -debug -stop-service-at-end -skip-from=$SUPPRESSION_FILE" \
sh

contract-tests-curl:
runs-on: ubuntu-22.04
env:
Expand All @@ -59,6 +80,28 @@ jobs:
test_service_port: ${{ env.TEST_SERVICE_PORT }}
token: ${{ secrets.GITHUB_TOKEN }}

contract-tests-fdv2-curl:
runs-on: ubuntu-22.04
env:
TEST_SERVICE_PORT: 8123
TEST_SERVICE_BINARY: ./build/contract-tests/server-contract-tests/server-tests
SUPPRESSION_FILE: contract-tests/server-contract-tests/test-suppressions-fdv2.txt
steps:
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955
- uses: ./.github/actions/ci
with:
cmake_target: server-tests
run_tests: false
use_curl: true
- name: 'Launch test service as background task'
run: $TEST_SERVICE_BINARY $TEST_SERVICE_PORT 2>&1 &
- name: 'Run v3 SDK test harness'
run: |
curl -s https://raw.githubusercontent.com/launchdarkly/sdk-test-harness/v3.0.0-alpha.3/downloader/run.sh \
| VERSION=v3.0.0-alpha.3 \
PARAMS="-url http://localhost:$TEST_SERVICE_PORT -debug -stop-service-at-end -skip-from=$SUPPRESSION_FILE" \
sh

build-test-server:
runs-on: ubuntu-22.04
steps:
Expand Down
42 changes: 36 additions & 6 deletions contract-tests/data-model/include/data_model/data_model.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(ConfigTags,
applicationId,
applicationVersion);

enum class HookStage {
BeforeEvaluation,
AfterEvaluation,
AfterTrack
};
enum class HookStage { BeforeEvaluation, AfterEvaluation, AfterTrack };

NLOHMANN_JSON_SERIALIZE_ENUM(HookStage,
{{HookStage::BeforeEvaluation, "beforeEvaluation"},
Expand All @@ -127,7 +123,10 @@ NLOHMANN_JSON_SERIALIZE_ENUM(HookStage,
struct ConfigHookInstance {
std::string name;
std::string callbackUri;
std::optional<std::unordered_map<std::string, std::unordered_map<std::string, nlohmann::json>>> data;
std::optional<
std::unordered_map<std::string,
std::unordered_map<std::string, nlohmann::json>>>
data;
std::optional<std::unordered_map<std::string, std::string>> errors;
};

Expand All @@ -150,6 +149,35 @@ struct ConfigWrapper {

NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(ConfigWrapper, name, version);

struct ConfigDataSynchronizerParams {
std::optional<ConfigStreamingParams> streaming;
std::optional<ConfigPollingParams> polling;
};

NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(ConfigDataSynchronizerParams,
streaming,
polling);

struct ConfigDataInitializerParams {
std::optional<ConfigPollingParams> polling;
};

NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(ConfigDataInitializerParams,
polling);

struct ConfigDataSystemParams {
std::optional<std::vector<ConfigDataInitializerParams>> initializers;
std::optional<std::vector<ConfigDataSynchronizerParams>> synchronizers;
std::optional<ConfigPollingParams> fdv1Fallback;
std::optional<std::string> payloadFilter;
};

NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(ConfigDataSystemParams,
initializers,
synchronizers,
fdv1Fallback,
payloadFilter);

struct ConfigBigSegmentsParams {
std::string callbackUri;
std::optional<uint32_t> userCacheSize;
Expand All @@ -171,6 +199,7 @@ struct ConfigParams {
std::optional<bool> initCanFail;
std::optional<ConfigStreamingParams> streaming;
std::optional<ConfigPollingParams> polling;
std::optional<ConfigDataSystemParams> dataSystem;
std::optional<ConfigEventParams> events;
std::optional<ConfigServiceEndpointsParams> serviceEndpoints;
std::optional<ConfigClientSideParams> clientSide;
Expand All @@ -188,6 +217,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(ConfigParams,
initCanFail,
streaming,
polling,
dataSystem,
events,
serviceEndpoints,
clientSide,
Expand Down
193 changes: 159 additions & 34 deletions contract-tests/server-contract-tests/src/entity_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,48 +12,125 @@
using launchdarkly::LogLevel;
using namespace launchdarkly::server_side;

EntityManager::EntityManager(boost::asio::any_io_executor executor,
launchdarkly::Logger& logger)
: counter_{0}, executor_{std::move(executor)}, logger_{logger} {}

std::optional<std::string> EntityManager::create(ConfigParams const& in) {
std::string id = std::to_string(counter_++);

auto config_builder = ConfigBuilder(in.credential);

// The contract test service sets endpoints in a way that is disallowed
// for users. Specifically, it may set just 1 of the 3 endpoints, whereas
// we require all 3 to be set.
//
// To avoid that error being detected, we must configure the Endpoints
// builder with the 3 default URLs, which we can fetch by just calling Build
// on a new builder. That way when the contract tests set just 1 URL,
// the others have already been "set" so no error occurs.
auto const default_endpoints =
*config::builders::EndpointsBuilder().Build();
namespace {

config::builders::DataSystemBuilder::FDv2 BuildFDv2(
ConfigDataSystemParams const& cfg,
config::builders::EndpointsBuilder* endpoints) {
auto fdv2 = config::builders::DataSystemBuilder::FDv2::Custom();

if (cfg.synchronizers) {
for (auto const& sync : *cfg.synchronizers) {
if (sync.streaming) {
auto s = decltype(fdv2)::Streaming();
if (sync.streaming->baseUri) {
s.BaseUrl(*sync.streaming->baseUri);
}
if (sync.streaming->initialRetryDelayMs) {
s.InitialReconnectDelay(std::chrono::milliseconds(
*sync.streaming->initialRetryDelayMs));
}
fdv2.Synchronizer(std::move(s));
} else if (sync.polling) {
auto p = decltype(fdv2)::Polling();
if (sync.polling->baseUri) {
p.BaseUrl(*sync.polling->baseUri);
}
if (sync.polling->pollIntervalMs) {
p.PollInterval(
std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::milliseconds(
*sync.polling->pollIntervalMs)));
}
fdv2.Synchronizer(std::move(p));
}
}
}

auto& endpoints =
config_builder.ServiceEndpoints()
.EventsBaseUrl(default_endpoints.EventsBaseUrl())
.PollingBaseUrl(default_endpoints.PollingBaseUrl())
.StreamingBaseUrl(default_endpoints.StreamingBaseUrl());
if (cfg.initializers) {
for (auto const& init : *cfg.initializers) {
if (init.polling) {
auto p = decltype(fdv2)::Polling();
if (init.polling->baseUri) {
p.BaseUrl(*init.polling->baseUri);
}
fdv2.Initializer(std::move(p));
}
}
}

if (in.serviceEndpoints) {
if (in.serviceEndpoints->streaming) {
endpoints.StreamingBaseUrl(*in.serviceEndpoints->streaming);
using FDv2Builder = config::builders::DataSystemBuilder::FDv2;
if (cfg.fdv1Fallback) {
if (cfg.fdv1Fallback->baseUri) {
endpoints->PollingBaseUrl(*cfg.fdv1Fallback->baseUri);
} else if (cfg.synchronizers && !cfg.synchronizers->empty()) {
// No explicit baseUri: derive from the synchronizers list, matching
// the no-fdv1Fallback branch below.
ConfigDataSynchronizerParams const* selected = nullptr;
for (auto const& sync : *cfg.synchronizers) {
if (sync.polling) {
selected = &sync;
break;
}
}
if (!selected) {
selected = &cfg.synchronizers->front();
}
if (selected->polling && selected->polling->baseUri) {
endpoints->PollingBaseUrl(*selected->polling->baseUri);
} else if (selected->streaming && selected->streaming->baseUri) {
endpoints->PollingBaseUrl(*selected->streaming->baseUri);
}
}
if (in.serviceEndpoints->polling) {
endpoints.PollingBaseUrl(*in.serviceEndpoints->polling);
FDv2Builder::FDv1Polling p;
if (cfg.fdv1Fallback->pollIntervalMs) {
p.PollInterval(std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::milliseconds(*cfg.fdv1Fallback->pollIntervalMs)));
}
if (in.serviceEndpoints->events) {
endpoints.EventsBaseUrl(*in.serviceEndpoints->events);
fdv2.FDv1Fallback(std::move(p));
Comment thread
cursor[bot] marked this conversation as resolved.
} else if (cfg.synchronizers && !cfg.synchronizers->empty()) {
// Derive an FDv1 fallback from the synchronizers list: prefer the
// first polling sync, otherwise reuse the first synchronizer's
// baseUri. The fallback is always polling. The fallback reads its
// URL from the global ServiceEndpoints, so set the polling endpoint
// to the selected baseUri.
ConfigDataSynchronizerParams const* selected = nullptr;
for (auto const& sync : *cfg.synchronizers) {
if (sync.polling) {
selected = &sync;
break;
}
}
if (!selected) {
selected = &cfg.synchronizers->front();
}
FDv2Builder::FDv1Polling p;
if (selected->polling) {
if (selected->polling->baseUri) {
endpoints->PollingBaseUrl(*selected->polling->baseUri);
}
if (selected->polling->pollIntervalMs) {
p.PollInterval(std::chrono::duration_cast<std::chrono::seconds>(
std::chrono::milliseconds(
*selected->polling->pollIntervalMs)));
}
} else if (selected->streaming && selected->streaming->baseUri) {
endpoints->PollingBaseUrl(*selected->streaming->baseUri);
}
fdv2.FDv1Fallback(std::move(p));
}

return fdv2;
}

config::builders::DataSystemBuilder::BackgroundSync BuildBackgroundSync(
ConfigParams const& in,
config::builders::EndpointsBuilder* endpoints) {
auto datasystem = config::builders::DataSystemBuilder::BackgroundSync();

if (in.streaming) {
if (in.streaming->baseUri) {
endpoints.StreamingBaseUrl(*in.streaming->baseUri);
endpoints->StreamingBaseUrl(*in.streaming->baseUri);
}
auto streaming = decltype(datasystem)::Streaming();
if (in.streaming->initialRetryDelayMs) {
Expand All @@ -68,7 +145,7 @@ std::optional<std::string> EntityManager::create(ConfigParams const& in) {

if (in.polling) {
if (in.polling->baseUri) {
endpoints.PollingBaseUrl(*in.polling->baseUri);
endpoints->PollingBaseUrl(*in.polling->baseUri);
}
if (!in.streaming) {
auto method = decltype(datasystem)::Polling();
Expand All @@ -85,7 +162,55 @@ std::optional<std::string> EntityManager::create(ConfigParams const& in) {
}
}

config_builder.DataSystem().Method(std::move(datasystem));
return datasystem;
}

} // namespace

EntityManager::EntityManager(boost::asio::any_io_executor executor,
launchdarkly::Logger& logger)
: counter_{0}, executor_{std::move(executor)}, logger_{logger} {}

std::optional<std::string> EntityManager::create(ConfigParams const& in) {
std::string id = std::to_string(counter_++);

auto config_builder = ConfigBuilder(in.credential);

// The contract test service sets endpoints in a way that is disallowed
// for users. Specifically, it may set just 1 of the 3 endpoints, whereas
// we require all 3 to be set.
//
// To avoid that error being detected, we must configure the Endpoints
// builder with the 3 default URLs, which we can fetch by just calling Build
// on a new builder. That way when the contract tests set just 1 URL,
// the others have already been "set" so no error occurs.
auto const default_endpoints =
*config::builders::EndpointsBuilder().Build();

auto& endpoints =
config_builder.ServiceEndpoints()
.EventsBaseUrl(default_endpoints.EventsBaseUrl())
.PollingBaseUrl(default_endpoints.PollingBaseUrl())
.StreamingBaseUrl(default_endpoints.StreamingBaseUrl());

if (in.serviceEndpoints) {
if (in.serviceEndpoints->streaming) {
endpoints.StreamingBaseUrl(*in.serviceEndpoints->streaming);
}
if (in.serviceEndpoints->polling) {
endpoints.PollingBaseUrl(*in.serviceEndpoints->polling);
}
if (in.serviceEndpoints->events) {
endpoints.EventsBaseUrl(*in.serviceEndpoints->events);
}
}

if (in.dataSystem) {
config_builder.DataSystem().Method(
BuildFDv2(*in.dataSystem, &endpoints));
} else {
config_builder.DataSystem().Method(BuildBackgroundSync(in, &endpoints));
}

auto& event_config = config_builder.Events();

Expand Down
1 change: 1 addition & 0 deletions contract-tests/server-contract-tests/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ int main(int argc, char* argv[]) {
srv.add_capability("track-hooks");
srv.add_capability("wrapper");
srv.add_capability("instance-id");
srv.add_capability("fdv1-fallback");
srv.add_capability("big-segments");

net::signal_set signals{ioc, SIGINT, SIGTERM};
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# C++ implements TTL-based FDv1 fallback; this scenario tests the older terminal semantics. Tracked in SDK-2527.
streaming/fdv2/FDv1 fallback directive/directive without FDv1 fallback configured halts the data system

# FDv2 public payload filter API is not exposed by the C++ SDK.
streaming/requests/URL path is computed correctly/environment_filter_key="encoding_not_necessary"/base URI has no trailing slash/GET
streaming/requests/URL path is computed correctly/environment_filter_key="encoding_not_necessary"/base URI has a trailing slash/GET
polling/requests/URL path is computed correctly/environment_filter_key="encoding_not_necessary"/base URI has no trailing slash/GET
polling/requests/URL path is computed correctly/environment_filter_key="encoding_not_necessary"/base URI has a trailing slash/GET
Loading