Repository navigation
fix: Stop reporting the data source as valid when the store rejects FDv2 data - #518
Merged
Merged
Conversation
…Dv2 data Store#apply now returns whether the store applied the changeset. It no longer notifies changeset listeners when the in-memory store rejects the data. When the store rejects a basis from an initializer, FDv2 logs a warning and tries the next initializer. It does not report VALID or signal readiness for that basis. When the store rejects a synchronizer update, FDv2 reports INTERRUPTED with a STORE_ERROR instead of VALID, and does not signal readiness. Generated-by: termag
kinyoklion
approved these changes
Dec 3, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit dd0abad. Configure here.
| true | ||
| rescue => e | ||
| @logger.error { "[LDClient] Couldn't apply changeset: #{e.message}" } | ||
| false |
There was a problem hiding this comment.
Persist failure treated as rejected data
Medium Severity
Store#apply returns false when the persistent store raises, even after the in-memory store has already accepted the changeset. FDv2 then treats that as a rejected payload: it can skip VALID, try the next initializer (overwriting good data), or mark the synchronizer INTERRUPTED and later fall back, even though evaluations already have the new data.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit dd0abad. Configure here.
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.


Summary
When the store could not apply an FDv2 changeset (for example, a flag that fails to decode),
Store#applylogged the error and returned nothing. FDv2 then reported VALID and signalled readiness with no usable data.Store#applynow returns whether it applied the changeset, and FDv2 acts on that result.Technical design decisions
STORE_ERROR, which is the kind Java reports for a failed apply. Go and Java still report VALID on this path after a failed apply.Details
Found while reviewing #515. Repro: the FDv1 body
{"flags":{"f":{"key":"f","version":1,"rules":"x"}}}passes payload conversion, then fails to decode in the in-memory store.Tests added:
Store#applyreturn values for full, delta, no-op, decode failure and a persistent store failure (spec/impl/data_store/store_spec.rb), plus FDv2 initializer and synchronizer behavior on a rejected changeset (spec/impl/data_system/fdv2_datasystem_spec.rb). All of them failed before the fix.Gates:
bundle exec rspec specandbundle exec rubocoppass. On this box, the Bundler autoload spec also fails on unmodified main because of the local gem setup.Opened from termag
Note
Overview
Store#applynow returns a boolean instead of void:truewhen a full transfer, delta, or no-op changeset is applied;falsewhen the in-memory store rejects data, persistence raises, or an exception is caught.set_basisandapply_deltapropagate that outcome, and changeset listeners are only notified on success.FDv2 uses that result so the client does not lie about data health: a rejected initializer basis logs a warning and falls through to the next initializer without marking VALID or setting the ready event; a rejected synchronizer update sets status to INTERRUPTED with
STORE_ERRORinstead of treating the source as valid. Environment ID and readiness are only updated when apply succeeds (or there is no changeset).Specs cover apply return values (decode failures, persistent store errors, listener behavior) and FDv2 initializer/synchronizer paths when the store rejects a changeset.
Reviewed by Cursor Bugbot for commit dd0abad. Bugbot is set up for automated code reviews on this repo. Configure here.