FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

feat: Add async FDv1 streaming and data source status tracking by jsonbailey · Pull Request #464 · launchdarkly/python-server-sdk · GitHub

feat: Add async FDv1 streaming and data source status tracking - #464

Merged
jsonbailey merged 13 commits into
mainfrom
jb/sdk-2743/async-fdv1-streaming
Aug 4, 2026
Merged

feat: Add async FDv1 streaming and data source status tracking#464
jsonbailey merged 13 commits into
mainfrom
jb/sdk-2743/async-fdv1-streaming

Conversation

jsonbailey commented Jul 21, 2026
edited by cursor Bot
Loading

Copy link
Copy Markdown
Contributor

Overview

Adds the async FDv1 streaming data source and its companion async data source status tracking, plus a new shared sans-I/O datasource_common module. This is one slice of the async Python SDK work.

What's included

  • Async FDv1 streaming data source (ldclient/impl/datasource/async_streaming.py) — driven by ld_eventsource's AsyncSSEClient and owning its own aiohttp session via make_client_session. It consumes SSE put/patch/delete events and pushes the resulting data into the async data source update sink.

  • Async data source status tracking (ldclient/impl/datasource/async_status.py — AsyncDataSourceUpdateSinkImpl and friends). The streaming source pushes data and status transitions into this update sink, so the two are runtime-coupled and land together in this slice.

  • New shared sans-I/O datasource_common module (ldclient/impl/datasource/datasource_common.py) — STREAM_ALL_PATH, sink_or_store, and parse_path. Both the sync data sources and the new async streaming source use it.

  • Behavior-preserving extraction of the sync data sources. streaming.py and polling.py are routed through datasource_common: the inline _sink_or_store/_parse_path/STREAM_ALL_PATH/ParsedPath definitions are removed in favor of importing the shared helpers, with call sites switched accordingly. No behavior change. The shared module is also needed by the upcoming async polling slice.

  • Unified status provider (sync/async). The async status provider was unified with the sync one: the redundant AsyncDataSourceStatusProviderImpl (which had no async-specific behavior — byte-identical to the sync provider apart from its sink type) is removed, and the async data system now reuses the sync DataSourceStatusProviderImpl. To let both sinks satisfy it structurally, the sync provider's update_sink parameter was widened to a small status-only Protocol (_DataSourceStatusSource). This is the same interface-segregation pattern as the PR 1b config read-protocols and mirrors the already-unified big-segment status provider. This adds a small behavior-preserving change to sync status.py.

Notes

  • The async public class carries the experimental .. caution:: block.
  • No CHANGELOG entries or version bumps (handled at release time).

Tracked internally: SDK-2743


Note

Medium Risk
Touches core flag data ingestion (streaming, store versioning, change notifications) for the new async path; sync changes are mostly refactors to shared helpers plus a widened status-provider type.

Overview
Adds async FDv1 streaming (AsyncStreamingUpdateProcessor) and AsyncDataSourceUpdateSinkImpl so SSE put/patch/delete updates flow through the async feature store with status and flag-change notifications, mirroring the sync stack.

Introduces datasource_common (STREAM_ALL_PATH, sink_or_store, parse_path, polling endpoint constant) and wires sync streaming/polling/feature requester through it instead of duplicated helpers—no intended behavior change on the sync path.

Async store contract: AsyncFeatureStore.delete now returns whether the delete was applied; the async sink only updates dependency tracking and flag listeners when upsert/delete actually write, avoiding spurious events on stale versions.

Status provider: DataSourceStatusProviderImpl accepts a small _DataSourceStatusSource protocol so one provider works with sync and async sinks.

Async streaming owns an aiohttp session built lazily in _run via make_client_session when no SSE factory is injected, with teardown on stop/errors; extensive tests cover streaming, status sink, and session lifecycle.

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

jsonbailey marked this pull request as ready for review July 27, 2026 20:38
jsonbailey requested a review from a team as a code owner July 27, 2026 20:38
jsonbailey force-pushed the jb/sdk-2743/async-fdv1-streaming branch from 924244b to 485382a Compare July 27, 2026 21:32
jsonbailey force-pushed the jb/sdk-2743/async-fdv1-streaming branch from 485382a to 73977fd Compare July 27, 2026 22:00
jsonbailey force-pushed the jb/sdk-2743/async-fdv1-streaming branch from 4149c47 to 89de1c5 Compare July 29, 2026 19:31

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

There are 2 total unresolved issues (including 1 from previous review).

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit c7f3f28. Configure here.

Restore an async __monitor_store_update helper mirroring the sync sink,
so the prior-data read during init() is monitored alongside store.init.
A failure in that read now records STORE_ERROR and moves the status to
INTERRUPTED, matching the sync data source status sink.
Its stop() is a coroutine, so it must implement the async update processor
interface rather than the sync UpdateProcessor (whose stop is synchronous).
Share the FDv1 polling endpoint from the sans-I/O datasource_common module
(next to STREAM_ALL_PATH) so the sync and async feature requesters no longer
each define their own copy.
Defer creating the owned aiohttp session + SSE factory from __init__ to _run(),
so the ClientSession is created on the running event loop (aiohttp's
expectation) rather than at construction time. Behavior is unchanged when a
factory is injected.
The async streaming processor builds its own aiohttp session in _run when no factory is injected, but only closed it on a normal loop exit or via stop(). If a later step raised — create(), the SSE iterator, or interrupt() — the exception escaped _run with no finally and the session leaked. Wrap the stream body in try/finally so the owned session is always closed.
jsonbailey force-pushed the jb/sdk-2743/async-fdv1-streaming branch from 21e1e09 to 5c7185e Compare August 4, 2026 16:32
The FDv1 streaming processors logged the raw, server-provided path on an unrecognized patch/delete path. No other LaunchDarkly SDK logs the raw path (Go/Java/JS ignore it silently, .NET logs a path-free message), so drop the interpolated value from both the sync and async warnings. FDv2 has no such log.
jsonbailey requested a review from joker23 August 4, 2026 18:37
jsonbailey merged commit 4bf7067 into main Aug 4, 2026
24 of 25 checks passed
jsonbailey deleted the jb/sdk-2743/async-fdv1-streaming branch August 4, 2026 19:45
jsonbailey added a commit that referenced this pull request Aug 5, 2026
## Overview

PR 7 of the SDK-60 async epic: the async FDv1 polling data source and
feature requester.

- **`async_polling.py`** — async FDv1 polling update processor. Polls
the feature requester on an interval and pushes flag/segment data into
the data source update sink, updating data source status (VALID / OFF)
as appropriate.
- **`async_feature_requester.py`** — async FDv1 feature requester that
fetches the full flag/segment payload over HTTP.
- **`test_async_polling.py`** — unit tests for the async polling update
processor.

## Stacking

This PR is **stacked on #464** (base branch
`jb/sdk-2743/async-fdv1-streaming`), which provides the shared
`datasource_common` module these files import. Until #464 merges, this
PR will also show #464's commits in its diff; a rebase after #464 merges
will drop them, leaving only the three files here.

SDK-2825

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Medium Risk**
> New experimental async flag-ingestion path affects client
initialization and data-source status; shutdown and HTTP error handling
must stay correct to avoid leaks or stuck waits.
> 
> **Overview**
> Adds **experimental** async FDv1 polling: an `AsyncFeatureRequester`
contract plus `AsyncFeatureRequesterImpl` that GETs the poll endpoint
with gzip, optional payload filter query param, and **ETag / 304**
caching before returning flags and segments.
> 
> **`AsyncPollingUpdateProcessor`** runs polls on `AsyncRepeatingTask`,
writes via `sink_or_store`, sets **ready** when the store initializes,
and reports **VALID / INTERRUPTED / OFF** on success, recoverable
errors, and fatal HTTP failures (matching sync polling semantics,
including unblocking init on unrecoverable errors).
> 
> **`AsyncRepeatingTask.wait_stopped()`** lets shutdown wait for the
in-flight poll to finish; **`stop()`** on the processor uses that (with
**`requester.close()` in `finally`**) so transports are not closed
mid-request.
> 
> Broad unit tests cover caching, transport ownership, error recovery,
sink status, and shutdown ordering.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
305f2b0. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
jsonbailey pushed a commit that referenced this pull request Aug 28, 2026
🤖 I have created a release *beep* *boop*
---


##
[9.17.0](9.16.1...9.17.0)
(2026-08-28)


### Features

* Add async big segment store manager and async Redis adapter
([#462](#462))
([aa492d2](aa492d2))
* Add async DynamoDB persistent feature store
([#490](#490))
([cb010df](cb010df))
* Add async event processor
([ec7c113](ec7c113))
* Add async event processor
([#472](#472))
([ec7c113](ec7c113))
* Add async FDv1 polling data source and feature requester
([#475](#475))
([cca37a8](cca37a8))
* Add async FDv1 streaming and data source status tracking
([#464](#464))
([4bf7067](4bf7067))
* Add async FDv2 data sources
([#485](#485))
([5da1515](5da1515))
* Add async FDv2 data system
([#486](#486))
([6a70132](6a70132))
* Add async hook, plugin, and flag tracker
([#463](#463))
([686a70a](686a70a))
* Add async migration support
([#470](#470))
([577d51e](577d51e))
* Add async persistent feature store foundation and Redis adapter
([f9c76ee](f9c76ee))
* Add AsyncConfig for the async SDK client
([#471](#471))
([0587a78](0587a78))
* Add AsyncLDClient with FDv1 data system and public API
([#480](#480))
([fd041a5](fd041a5))
* Add Config.with_wrapper_information
([#501](#501))
([8a98583](8a98583))
* Add environment ID support for hooks.
([#484](#484))
([49e809f](49e809f))
* Add read-only store views and async persistence foundation for the
data system
([#503](#503))
([0eb61fa](0eb61fa))


### Bug Fixes

* Allow tombstones without a key property
([#502](#502))
([5f44e61](5f44e61))
* Escape attribute names reported in redactedAttributes
([#505](#505))
([90059cb](90059cb))
* Prevent a persistent-store outage from throwing in the sync FDv2
evaluation
([#506](#506))
([467da53](467da53))
* Return empty prerequisites for a flag that fails to evaluate in
all_flags_state
([#483](#483))
([73e9b07](73e9b07))

---
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**
> **Release Please** bumps the package from **9.16.1** to **9.17.0** in
`pyproject.toml`, `ldclient/version.py`,
`.release-please-manifest.json`, and the provenance example in
`PROVENANCE.md`.
> 
> `CHANGELOG.md` gains a new **9.17.0** (2026-08-28) section that
records what ships in this minor release: a broad **async** surface
(`AsyncLDClient`, `AsyncConfig`, async FDv1/FDv2 data systems, event
processor, hooks/plugins, migration, and Redis/DynamoDB persistent
stores plus big-segment async support), plus sync improvements
(`Config.with_wrapper_information`, hook environment ID, read-only store
views) and bug fixes (tombstones, `redactedAttributes` escaping, FDv2
persistent-store resilience, `all_flags_state` prerequisites).
> 
> No application logic changes appear in this diff—only version metadata
and release notes.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
f225e46. 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>
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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL