Skip to content

fix: Restart the stream when a delete event has a version that is not an integer - #585

Merged
kinyoklion merged 1 commit into
mainfrom
rlamb/sdk-3446/stream-delete-version
Nov 17, 2026
Merged

kinyoklion merged 1 commit into
mainfrom
rlamb/sdk-3446/stream-delete-version

Conversation

@kinyoklion

@kinyoklion kinyoklion commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

A stream delete whose version was a string was stored as a deleted item with that version, and the stream stayed open. A later patch for that key then failed when the store compared versions. The streaming data source, sync and async, now treats a delete without an integer version as invalid data and restarts the stream, as the other server SDKs do.

Testing: new sync and async unit tests fail before this change and pass after it. On the v2 contract-test suite with the corrected schema-mismatch delete test in sdk-test-harness, the delete case fails before this change and passes after it, for the sync and async services, and no other result changes. The v3 suite gives the same results as before.

SDK-3446

Opened from termag


Note

Overview
Streaming delete events with a non-integer version (e.g. a string) are now rejected in both sync and async processors. Before processing, the SDK checks that version is an int and not a bool; otherwise it raises ValueError, which triggers the existing interrupt-and-reconnect path instead of applying a bad delete to the feature store.

That behavior aligns with other LaunchDarkly server SDKs and avoids corrupt store state that could break later patch version checks. Unit tests were added for sync and async streaming to assert the stream is dropped and re-established when delete version is invalid.

Reviewed by Cursor Bugbot for commit be4282e. Bugbot is set up for automated code reviews on this repo. Configure here.

… an integer

A delete whose version was a string was stored as a deleted item with that version, and the stream stayed open. A later patch for that key then failed when the store compared versions.

Generated-by: termag
@kinyoklion
kinyoklion marked this pull request as ready for review November 17, 2026 17:31
@kinyoklion
kinyoklion requested a review from a team as a code owner November 17, 2026 17:31
@cursor cursor Bot added the risk:low label Nov 17, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Risk: low.

Automated risk review (dry run): Low

This PR would be automatically approved.

Why: The change is a two-line integer-version check on stream delete events in streaming.py and async_streaming.py, with new sync and async unit tests covering the restart path.

If you disagree with this review, share this PR in #feedback-agent-approvals or submit a changes-requested review explaining why.

Open in Web View Automation 

Sent by Cursor Approval Agent: Dry-Run PR Approver

@kinyoklion
kinyoklion merged commit cf8b84a into main Nov 17, 2026
19 checks passed
@kinyoklion
kinyoklion deleted the rlamb/sdk-3446/stream-delete-version branch November 17, 2026 17:53
kinyoklion added a commit to launchdarkly/sdk-test-harness that referenced this pull request Nov 17, 2026
…647)

<!-- TERMAG_PR_BODY_BEGIN -->
The delete payload in the `well-formed JSON not matching schema` tests
was missing its closing brace, so the delete case repeated the
malformed-JSON case. It now sends a well-formed delete whose version is
a string.

Python (sync and async), Ruby and Erlang apply that delete instead of
restarting the stream, so they fail the case until their fixes merge:
launchdarkly/python-server-sdk#585, launchdarkly/ruby-server-sdk#501 and
launchdarkly/erlang-server-sdk#213. Merge this after those. The v3 copy
of this test comes with #568, which has the same fix.

Testing: on the v2 `streaming/validation` tests against 14 server-side
test services here, only Python (sync and async), Ruby and Erlang
change. Each fails the delete case without its fix and passes with it.
<!-- TERMAG_PR_BODY_END -->

<!-- termag: box=i-099691946751009d8 project=appease-ai-feverish-2 -->
<sub>Opened from termag</sub>

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Overview**
> Fixes the **delete** subtest under `drop and reconnect if stream event
has well-formed JSON not matching schema` in
`sdktests/server_side_stream_validation.go`.
> 
> The payload was missing its closing `}`, so it duplicated the
malformed-JSON behavior. It now sends valid JSON
`{"path":"/flags/x","version":"no"}`—schema-invalid because `version` is
a string—so the harness asserts drop-and-reconnect on schema mismatch,
not on parse failure.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
295f67a. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
keelerm84 added a commit that referenced this pull request Nov 19, 2026
Adapts the flag overrides change (#580) to 10.x: the FDv1 data system is gone, the data system option is data_system, and the V2 suffixes are dropped. The FDv1-only tests from main are removed. The FDv1 streaming fix (#585) does not apply because 10.x has no FDv1 streaming source.
tanderson-ld pushed a commit that referenced this pull request Dec 1, 2026
🤖 I have created a release *beep* *boop*
---


##
[9.21.1](9.21.0...9.21.1)
(2026-11-30)


### Bug Fixes

* Drop track events with a NaN or infinite metric value
([#599](#599))
([6a0e1bf](6a0e1bf))
* Prevent a false synchronizer failure warning when an FDv2 client
closes
([#584](#584))
([5721c67](5721c67))
* Prevent a null prerequisites list from stopping the client from
initializing
([#587](#587))
([298e2a3](298e2a3))
* Prevent an FDv2 initializer result from being applied after close
([#583](#583))
([85e948c](85e948c))
* Report the FDv2 data source status as OFF after close when more
([5721c67](5721c67))
* Restart the stream when a delete event has a version that is not an
integer
([#585](#585))
([cf8b84a](cf8b84a))
* Signal readiness when selectorless initializers are exhausted
([#582](#582))
([fa654b0](fa654b0))


### Documentation

* Explain the cached data warning from the FDv2 file data source
([#591](#591))
([5cc96b0](5cc96b0))

---
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]
> **Overview**
> This PR **bumps the LaunchDarkly Python server SDK from 9.21.0 to
9.21.1** via Release Please—updating `pyproject.toml`,
`ldclient/version.py`, `.release-please-manifest.json`, and the
provenance example version.
> 
> The new **CHANGELOG** entry for 9.21.1 documents what ships in this
patch: FDv2 lifecycle and streaming fixes (initializer results after
close, data source status OFF on close, false synchronizer warnings,
non-integer delete versions restarting the stream, selectorless
initializer readiness), client init when prerequisites are null,
dropping track events with NaN/infinite metrics, and docs for the FDv2
file data source cached-data warning.
> 
> No runtime code appears in the diff; this is the release metadata and
changelog for fixes already merged on `main`.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
458695f. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants