Repository navigation
Commit 298e2a3
authored
fix: Prevent a null prerequisites list from stopping the client from initializing (#587)
<!-- TERMAG_PR_BODY_BEGIN -->
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
<!-- TERMAG_PR_BODY_END -->
<!-- termag: box=i-099691946751009d8 project=appease-ai-feverish-2 -->
<sub>Opened from termag</sub>
<!-- CURSOR_SUMMARY -->
---
> [!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.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
8b76d12. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->1 parent 85e948c commit 298e2a3
2 files changed
Lines changed: 28 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
175 | 175 | | |
176 | 176 | | |
177 | 177 | | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
71 | | - | |
| 71 | + | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
0 commit comments