Repository navigation
fix: Prevent a null prerequisites list from stopping the client from initializing - #587
Merged
kinyoklion merged 1 commit intoNov 18, 2026
Merged
Conversation
… the store An explicit null prerequisites property made the dependency ordering fail with a TypeError, so the store was never initialized and the stream restarted forever. Generated-by: termag
There was a problem hiding this comment.
Risk: low.
Automated risk review (dry run): Low
This PR would be automatically approved.
Why: The change treats a null prerequisites list as empty in ldclient/versioned_data_kind.py when ordering flag dependencies, matching an omitted list, and adds a focused unit test in ldclient/testing/test_ldclient.py. It is a narrow correctness fix with tests and no infrastructure, auth, or CI changes.
If you disagree with this review, share this PR in #feedback-agent-approvals or submit a changes-requested review explaining why.
Sent by Cursor Approval Agent: Dry-Run PR Approver
keelerm84
approved these changes
Nov 18, 2026
kinyoklion
deleted the
rlamb/sdk-3667/explicit-null-optional-properties
branch
November 18, 2026 17:19
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.


When flag data sets
prerequisitesto null, the SDK cannot write the data set to its store. The store puts each prerequisite flag before the flags that depend on it, and that ordering iterated over the null value and raised a TypeError. The sync client then restarted the stream again and again and never initialized. The async client fails the same way when it writes to a persistent store. A null prerequisites list now has the same effect as an omitted list, which is how the flag model already reads it.Testing: added a unit test for store ordering with a null prerequisites list; the explicit-null data-model contract tests now pass, and the full v2 and v3 contract suites are unchanged for the sync and async clients.
SDK-3667
Opened from termag
Note
Overview
Fixes client initialization when flag payloads include
prerequisites: null. Feature store ordering usedflag.get('prerequisites', []), which still returnsNonewhen the field is present but null, so dependency traversal raised a TypeError and blocked store writes (sync stream restart loop / async persistent store failures).FEATURES.get_dependency_keysnow treats a null prerequisites list like a missing list via(flag.get('prerequisites') or []).Adds
test_store_data_set_ordering_treats_null_prerequisites_as_emptyto assert flags still land in dependency order (bbeforea) when a prerequisite flag has null prerequisites.Reviewed by Cursor Bugbot for commit 8b76d12. Bugbot is set up for automated code reviews on this repo. Configure here.