Skip to content

Conversation

@kinyoklion
Copy link
Member

@kinyoklion kinyoklion commented Oct 31, 2025

Note

Validate null/malformed PATCH payloads as invalid and restart the SSE connection on invalid stream events; add broad tests and enable full contract tests.

  • Data handling (server-sdk):
    • Treat patch events with "data": null or missing/invalid data as schema failures, returning kInvalidMessage.
    • Maintain status/error reporting for invalid messages without crashing.
  • Streaming reconnection:
    • On kInvalidMessage from stream events, log and async_restart the SSE client with backoff.
    • Add sse::Client::async_restart(reason) API and implement in both backends:
      • FoxyClient: cancel stream, trigger backoff/reconnect.
      • CurlClient: abort current transfer, trigger backoff/reconnect.
  • Tests:
    • Add extensive cases for null/missing fields, wrong types, malformed JSON, and delete/put validation in data_source_event_handler_test.cpp.
  • CI:
    • Run contract tests without suppressions (remove test-suppressions.txt and extra_params skips).

Written by Cursor Bugbot for commit b6ebec5. This will update automatically on new commits. Configure here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All tests now pass, so no suppressions are needed.

return tl::unexpected(JsonError::kSchemaFailure);
}
// Check if the optional is empty (indicates null data)
if (!data->has_value()) {
Copy link
Member Author

@kinyoklion kinyoklion Oct 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actual root fix.

self->event_handler_->HandleMessage(event.type(), event.data());
// TODO: Use the result of handle message to restart the
// event source if we got bad data. sc-204387
auto status =
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secondary handle strange JSON and reconnect.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we just restart the stream when we encounter invalid JSON, then we could create a thundering-herd in the case the service somehow sent invalid JSON. So we defer the restart to the event source implementation. Which allows for it to incorporate back-off.

@kinyoklion kinyoklion marked this pull request as ready for review October 31, 2025 20:48
@kinyoklion kinyoklion requested a review from a team as a code owner October 31, 2025 20:48
@kinyoklion kinyoklion merged commit d12b7a0 into main Nov 3, 2025
46 checks passed
@kinyoklion kinyoklion deleted the rlamb/sdk-1502/handle-null-payload branch November 3, 2025 16:55
@github-actions github-actions bot mentioned this pull request Nov 3, 2025
kinyoklion pushed a commit that referenced this pull request Nov 3, 2025
🤖 I have created a release *beep* *boop*
---


<details><summary>launchdarkly-cpp-client: 3.11.0</summary>

##
[3.11.0](launchdarkly-cpp-client-v3.10.1...launchdarkly-cpp-client-v3.11.0)
(2025-11-03)


### Features

* Add proxy support when using CURL networking.
([c9a6b17](c9a6b17))
* Add support for CURL networking.
([c9a6b17](c9a6b17))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * launchdarkly-cpp-internal bumped from 0.12.1 to 0.13.0
    * launchdarkly-cpp-common bumped from 1.10.0 to 1.11.0
    * launchdarkly-cpp-sse-client bumped from 0.5.5 to 0.6.0
</details>

<details><summary>launchdarkly-cpp-common: 1.11.0</summary>

##
[1.11.0](launchdarkly-cpp-common-v1.10.0...launchdarkly-cpp-common-v1.11.0)
(2025-11-03)


### Features

* Add proxy support when using CURL networking.
([c9a6b17](c9a6b17))
* Add support for CURL networking.
([c9a6b17](c9a6b17))


### Bug Fixes

* Correctly handle a wrapper name without a wrapper version.
([245dd97](245dd97))
</details>

<details><summary>launchdarkly-cpp-internal: 0.13.0</summary>

##
[0.13.0](launchdarkly-cpp-internal-v0.12.1...launchdarkly-cpp-internal-v0.13.0)
(2025-11-03)


### Features

* Add proxy support when using CURL networking.
([c9a6b17](c9a6b17))
* Add support for CURL networking.
([c9a6b17](c9a6b17))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * launchdarkly-cpp-common bumped from 1.10.0 to 1.11.0
    * launchdarkly-cpp-networking bumped from 0.1.0 to 0.2.0
</details>

<details><summary>launchdarkly-cpp-networking: 0.2.0</summary>

##
[0.2.0](launchdarkly-cpp-networking-v0.1.0...launchdarkly-cpp-networking-v0.2.0)
(2025-11-03)


### Features

* Add proxy support when using CURL networking.
([c9a6b17](c9a6b17))
* Add support for CURL networking.
([c9a6b17](c9a6b17))
</details>

<details><summary>launchdarkly-cpp-server: 3.10.0</summary>

##
[3.10.0](launchdarkly-cpp-server-v3.9.1...launchdarkly-cpp-server-v3.10.0)
(2025-11-03)


### Features

* Add proxy support when using CURL networking.
([c9a6b17](c9a6b17))
* Add support for CURL networking.
([c9a6b17](c9a6b17))
* Add support for hooks.
([03e2a59](03e2a59))


### Bug Fixes

* Discard track events when the associated context is invalid.
([03e2a59](03e2a59))
* Handle null payloads.
([#497](#497))
([d12b7a0](d12b7a0))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * launchdarkly-cpp-internal bumped from 0.12.1 to 0.13.0
    * launchdarkly-cpp-common bumped from 1.10.0 to 1.11.0
    * launchdarkly-cpp-sse-client bumped from 0.5.5 to 0.6.0
</details>

<details><summary>launchdarkly-cpp-server-otel: 0.1.0</summary>

## 0.1.0 (2025-11-03)


### Features

* Add tracing hook.
([#496](#496))
([7eb5a2e](7eb5a2e))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * launchdarkly-cpp-server bumped from 3.9.1 to 3.10.0
</details>

<details><summary>launchdarkly-cpp-server-redis-source: 2.2.1</summary>

##
[2.2.1](launchdarkly-cpp-server-redis-source-v2.2.0...launchdarkly-cpp-server-redis-source-v2.2.1)
(2025-11-03)


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * launchdarkly-cpp-server bumped from 3.9.1 to 3.10.0
</details>

<details><summary>launchdarkly-cpp-sse-client: 0.6.0</summary>

##
[0.6.0](launchdarkly-cpp-sse-client-v0.5.5...launchdarkly-cpp-sse-client-v0.6.0)
(2025-11-03)


### Features

* Add proxy support when using CURL networking.
([c9a6b17](c9a6b17))
* Add support for CURL networking.
([c9a6b17](c9a6b17))


### Bug Fixes

* Handle null payloads.
([#497](#497))
([d12b7a0](d12b7a0))


### Dependencies

* The following workspace dependencies were updated
  * dependencies
    * launchdarkly-cpp-networking bumped from 0.1.0 to 0.2.0
</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]
> Publish workspace releases adding CURL networking with proxy support,
server hooks, new server OTEL integration, and synchronized
dependency/version updates.
> 
> - **Releases**:
>   - **Client SDK `3.11.0`**:
>     - Features: CURL networking + proxy support.
> - Deps: `launchdarkly-cpp-internal@0.13.0`,
`launchdarkly-cpp-common@1.11.0`, `launchdarkly-cpp-sse-client@0.6.0`.
>     - Version constants/tests/CMake updated.
>   - **Server SDK `3.10.0`**:
>     - Features: CURL networking + proxy support; hooks support.
> - Bug fixes: discard track events with invalid context; handle null
payloads.
>     - Deps: bumped to internal/common/sse versions above.
>     - Version constants/tests/CMake updated.
> - **SSE Client `0.6.0`**: CURL networking + proxy support; fix null
payloads; dep on `launchdarkly-cpp-networking@0.2.0`.
>   - **Networking `0.2.0`**: add CURL networking + proxy support.
> - **Common `1.11.0`**: add CURL networking + proxy support; fix
wrapper name without version.
> - **Internal `0.13.0`**: add CURL networking + proxy support; deps
updated.
> - **Server Redis Source `2.2.1`**: dep bump to
`launchdarkly-cpp-server@3.10.0`; CMake/package version updates.
> - **New: Server OTEL `0.1.0`**: tracing hook integration; dep on
`launchdarkly-cpp-server@3.10.0`.
> - **Repo**:
> - `.release-please-manifest.json` updated to new versions across
`libs/*`.
> 
> <sup>Written by [Cursor
Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit
5a6226c. 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.

3 participants