-
Notifications
You must be signed in to change notification settings - Fork 3
fix: Ensure that serialization of a variation or rollout uses the correct overload. #483
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
||
namespace launchdarkly { | ||
|
||
struct VariationOrRolloutContext {}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is effectively a "tag" which can be used as a discriminator.
obj.emplace("contextKind", rollout.contextKind.t); | ||
} | ||
|
||
void tag_invoke( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the situation arose this function was not getting called for serialization. Instead the standard handling for std::variant was being called. This resulted in the value being directly serialized. So for example 42
instead of {variant: 42}
. This would only happen for fallthrough. A rule directly serializes the value into a root field.
Tests will fail until the PR with build changes is merged. |
🤖 I have created a release *beep* *boop* --- <details><summary>launchdarkly-cpp-client: 3.10.1</summary> ## [3.10.1](launchdarkly-cpp-client-v3.10.0...launchdarkly-cpp-client-v3.10.1) (2025-10-10) ### Dependencies * The following workspace dependencies were updated * dependencies * launchdarkly-cpp-internal bumped from 0.12.0 to 0.12.1 </details> <details><summary>launchdarkly-cpp-internal: 0.12.1</summary> ## [0.12.1](launchdarkly-cpp-internal-v0.12.0...launchdarkly-cpp-internal-v0.12.1) (2025-10-10) ### Bug Fixes * Ensure that serialization of a variation or rollout uses the correct overload. ([#483](#483)) ([b598803](b598803)) </details> <details><summary>launchdarkly-cpp-server: 3.9.1</summary> ## [3.9.1](launchdarkly-cpp-server-v3.9.0...launchdarkly-cpp-server-v3.9.1) (2025-10-10) ### Dependencies * The following workspace dependencies were updated * dependencies * launchdarkly-cpp-internal bumped from 0.12.0 to 0.12.1 </details> <details><summary>launchdarkly-cpp-server-redis-source: 2.1.20</summary> ## [2.1.20](launchdarkly-cpp-server-redis-source-v2.1.19...launchdarkly-cpp-server-redis-source-v2.1.20) (2025-10-10) ### Dependencies * The following workspace dependencies were updated * dependencies * launchdarkly-cpp-server bumped from 3.9.0 to 3.9.1 </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Bumps SDK versions and dependencies across client, server, internal, and redis-source; updates changelogs, CMake/package metadata, and version assertions in tests. > > - **Releases/Versions**: > - `libs/client-sdk`: `3.10.1` (CMake `VERSION`, `kVersion`, tests, `package.json`, `CHANGELOG.md`). > - `libs/server-sdk`: `3.9.1` (CMake `VERSION`, `kVersion`, tests, `package.json`, `CHANGELOG.md`). > - `libs/internal`: `0.12.1` (`package.json`, `CHANGELOG.md`). > - `libs/server-sdk-redis-source`: `2.1.20` (CMake `VERSION`, `package.json`, `CHANGELOG.md`). > - `.release-please-manifest.json` updated to reflect new versions. > - **Dependencies**: > - Update workspace deps: `launchdarkly-cpp-internal` to `0.12.1` in client/server; `launchdarkly-cpp-server` to `3.9.1` in redis-source. > - **Tests**: > - Update expected SDK version strings in client/server C++ and C binding tests. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 8a371be. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
The was boost::json handles tag_invokes seems to have changed slightly such that serialization of a
VariationOrRollout
may be handled by the built-in handling for a std::variant instead of our specialized override.This PR introduces the use of context to ensure our specific serialization is always used in this case.
https://www.boost.org/doc/libs/1_87_0/libs/json/doc/html/json/conversion/contextual_conversions.html
Note
Use Boost.JSON contextual conversions (with version guards) to ensure
Flag::VariationOrRollout
always serializes via the custom tag_invoke instead of std::variant defaults.VariationOrRolloutContext
and a context-awaretag_invoke
overload fordata_model::Flag::VariationOrRollout
, plus a forwarding overload without context.flag.fallthrough
.WriteMinimal
to accept a conversion context and callboost::json::value_from(val, ctx)
for Boost >=1.83
; guarded byBOOST_VERSION
.boost/version.hpp
to enable version checks.VariationOrRollout
serialization tests to callvalue_from(..., VariationOrRolloutContext())
for Boost >=1.83
and adjust variant construction.Written by Cursor Bugbot for commit aa1250c. This will update automatically on new commits. Configure here.