fix: Ensure that serialization of a variation or rollout uses the correct overload.#483
Merged
kinyoklion merged 6 commits intomainfrom Oct 10, 2025
Merged
Conversation
kinyoklion
commented
Oct 8, 2025
|
|
||
| namespace launchdarkly { | ||
|
|
||
| struct VariationOrRolloutContext {}; |
Member
Author
There was a problem hiding this comment.
This is effectively a "tag" which can be used as a discriminator.
kinyoklion
commented
Oct 8, 2025
| @@ -255,7 +255,7 @@ void tag_invoke(boost::json::value_from_tag const& unused, | |||
| void tag_invoke( | |||
Member
Author
There was a problem hiding this comment.
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.
Member
Author
|
Tests will fail until the PR with build changes is merged. |
keelerm84
approved these changes
Oct 9, 2025
Merged
kinyoklion
pushed a commit
that referenced
this pull request
Oct 13, 2025
🤖 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>
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.
The was boost::json handles tag_invokes seems to have changed slightly such that serialization of a
VariationOrRolloutmay 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::VariationOrRolloutalways serializes via the custom tag_invoke instead of std::variant defaults.VariationOrRolloutContextand a context-awaretag_invokeoverload fordata_model::Flag::VariationOrRollout, plus a forwarding overload without context.flag.fallthrough.WriteMinimalto accept a conversion context and callboost::json::value_from(val, ctx)for Boost >=1.83; guarded byBOOST_VERSION.boost/version.hppto enable version checks.VariationOrRolloutserialization tests to callvalue_from(..., VariationOrRolloutContext())for Boost >=1.83and adjust variant construction.Written by Cursor Bugbot for commit aa1250c. This will update automatically on new commits. Configure here.