Skip to content

fix: Ignore FDv2 objects with unrecognized kinds - #468

Merged
kinyoklion merged 3 commits into
mainfrom
rlamb/sdk-3340/fdv2-ignore-unknown-kinds
Oct 29, 2026
Merged

kinyoklion merged 3 commits into
mainfrom
rlamb/sdk-3340/fdv2-ignore-unknown-kinds

Conversation

@kinyoklion

@kinyoklion kinyoklion commented Oct 16, 2026 •

Copy link
Copy Markdown
Member

Summary

FDv2 SDKs must silently ignore objects of kinds they do not support, so new kinds can be added to payloads without breaking existing SDKs. The streaming and polling parsers passed any kind into the change set, and changes_to_store_data files every non-flag kind under segments, so an unknown-kind put replaced a real segment with the same key and an unknown-kind delete removed one. The parsers now skip put-object and delete-object events with an unsupported kind before from_h, so the object shape of a new kind cannot fail the payload either. A missing kind is still malformed, and known kinds are unchanged.

Tests

New specs in streaming_synchronizer_spec.rb and polling_payload_parsing_spec.rb mix unknown-kind puts and deletes with known objects and check only the known changes remain, with no warn/error logs on streaming (both failed before the change). spec/impl/data_system + spec/impl/data_store 220 examples, 0 failures; rubocop clean.

SDK-3340


Note

Overview
FDv2 put-object and delete-object events whose kind is not flag or segment are now skipped in both polling and streaming parsers, via new ProtocolV2.unsupported_kind?, so payloads can include future kinds without failing or mutating local state.

Previously, unknown kinds still entered the change set and were applied as segments in changes_to_store_data, which could overwrite or delete real segments by key.

Both paths also validate shape earlier: event data must be an object and kind must be a string (polling returns a failed result; streaming raises ArgumentError). Malformed events are still rejected; only unrecognized string kinds are ignored.

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

put-object and delete-object events whose kind is not flag or segment
are now dropped by the streaming and polling parsers before the object
is decoded. Previously they were forwarded to the store, which filed
any non-flag kind under segments and could overwrite or delete a real
segment with the same key.
@kinyoklion
kinyoklion marked this pull request as ready for review October 19, 2026 22:53
@kinyoklion
kinyoklion requested a review from a team as a code owner October 19, 2026 22:53
Comment thread lib/ldclient-rb/impl/data_system/protocolv2.rb Outdated
@kinyoklion
kinyoklion requested a review from keelerm84 October 27, 2026 21:56
@kinyoklion
kinyoklion merged commit 168e199 into main Oct 29, 2026
10 checks passed
@kinyoklion
kinyoklion deleted the rlamb/sdk-3340/fdv2-ignore-unknown-kinds branch October 29, 2026 17:22
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