Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Conversation

kinyoklion
Copy link
Member

@kinyoklion kinyoklion commented Oct 8, 2025

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.

  • Serialization:
    • Add VariationOrRolloutContext and a context-aware tag_invoke overload for data_model::Flag::VariationOrRollout, plus a forwarding overload without context.
    • Use the context-aware serializer when writing flag.fallthrough.
    • Extend WriteMinimal to accept a conversion context and call boost::json::value_from(val, ctx) for Boost >= 1.83; guarded by BOOST_VERSION.
    • Include boost/version.hpp to enable version checks.
  • Tests:
    • Update VariationOrRollout serialization tests to call value_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.

@kinyoklion kinyoklion marked this pull request as ready for review October 8, 2025 23:01
@kinyoklion kinyoklion requested a review from a team as a code owner October 8, 2025 23:01

namespace launchdarkly {

struct VariationOrRolloutContext {};
Copy link
Member Author

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(
Copy link
Member Author

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.

@kinyoklion kinyoklion marked this pull request as draft October 8, 2025 23:04
@kinyoklion
Copy link
Member Author

Tests will fail until the PR with build changes is merged.

@kinyoklion kinyoklion marked this pull request as ready for review October 10, 2025 18:12
@kinyoklion kinyoklion merged commit b598803 into main Oct 10, 2025
11 checks passed
@kinyoklion kinyoklion deleted the rlamb/disambiguate-sequence-boost-json branch October 10, 2025 18:12
@github-actions github-actions bot mentioned this pull request Oct 10, 2025
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.