Skip to content

fix: Prevent a null prerequisites list from stopping the client from initializing - #587

Merged
kinyoklion merged 1 commit into
mainfrom
rlamb/sdk-3667/explicit-null-optional-properties
Nov 18, 2026
Merged

kinyoklion merged 1 commit into
mainfrom
rlamb/sdk-3667/explicit-null-optional-properties

Conversation

@kinyoklion

@kinyoklion kinyoklion commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

When flag data sets prerequisites to 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 used flag.get('prerequisites', []), which still returns None when 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_keys now treats a null prerequisites list like a missing list via (flag.get('prerequisites') or []).

Adds test_store_data_set_ordering_treats_null_prerequisites_as_empty to assert flags still land in dependency order (b before a) 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.

… 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
@kinyoklion
kinyoklion marked this pull request as ready for review November 17, 2026 23:22
@kinyoklion
kinyoklion requested a review from a team as a code owner November 17, 2026 23:22
@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 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.

Open in Web View Automation 

Sent by Cursor Approval Agent: Dry-Run PR Approver

@kinyoklion
kinyoklion merged commit 298e2a3 into main Nov 18, 2026
18 checks passed
@kinyoklion
kinyoklion deleted the rlamb/sdk-3667/explicit-null-optional-properties branch November 18, 2026 17:19
keelerm84 added a commit that referenced this pull request Nov 23, 2026
Adapts the main changes to 10.x: the #591 docs and tests use Files.new_data_source and data_system and drop the FDv1 case, the #587 test uses an initializer instead of an update processor, the README keeps the 3.11 minimum, and CI keeps the single v3 contract test step with the new action tag.
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