Repository navigation
fix: Restart the stream when a delete event has a version that is not an integer - #501
Merged
Merged
Conversation
… 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
keelerm84
approved these changes
Nov 17, 2026
There was a problem hiding this comment.
Automated risk review (dry run): Low
This PR would be automatically approved.
Why: This is a narrow bugfix in lib/ldclient-rb/impl/data_source/stream.rb that rejects non-integer stream DELETE versions and restarts the stream, with a covering unit test in spec/impl/data_source/stream_spec.rb. Bugbot completed with no findings, and the change does not touch infrastructure, auth, or approval-policy files.
Sent by Cursor Approval Agent: Dry-Run PR Approver
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
pushed a commit
that referenced
this pull request
Nov 20, 2026
🤖 I have created a release *beep* *boop* --- ## [8.20.1](8.20.0...8.20.1) (2026-11-20) ### Bug Fixes * Prevent a NaN or infinite metric value from discarding all events in a flush ([#498](#498)) ([2b0f4ef](2b0f4ef)) * Restart the stream when a delete event has a version that is not an integer ([#501](#501)) ([d060827](d060827)) * Signal readiness when selectorless initializers are exhausted ([#499](#499)) ([22fda02](22fda02)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). 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.


A stream
deletewhoseversionwas 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 now treats a delete without an integer version as invalid data and restarts the stream, as the other server SDKs do.Testing: a new unit test fails before this change and passes 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, and no other result changes. The v3 suite gives the same results as before.
SDK-3447
Opened from termag
Note
Overview
Streaming DELETE handling now requires an integer
versionbefore calling the update sink. If the parsed event has a non-integer version (e.g. a JSON string),process_messageraisesArgumentErrorso the SSE layer treats it like other invalid stream data and restarts the connection instead of applying the delete.That closes a bug where a bad delete version could be recorded in the store and block a later patch on the same key. A unit test covers the raise, no delete side effect, and a successful follow-up patch.
Reviewed by Cursor Bugbot for commit 8f6a727. Bugbot is set up for automated code reviews on this repo. Configure here.