feat: Add async FDv1 streaming and data source status tracking - #464
Merged
Conversation
jsonbailey
marked this pull request as ready for review
July 27, 2026 20:38
jsonbailey
force-pushed
the
jb/sdk-2743/async-fdv1-streaming
branch
from
July 27, 2026 21:32
924244b to
485382a
Compare
jsonbailey
force-pushed
the
jb/sdk-2743/async-fdv1-streaming
branch
from
July 27, 2026 22:00
485382a to
73977fd
Compare
jsonbailey
force-pushed
the
jb/sdk-2743/async-fdv1-streaming
branch
from
July 29, 2026 19:31
4149c47 to
89de1c5
Compare
There was a problem hiding this comment.
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
August 4, 2026 16:32
21e1e09 to
5c7185e
Compare
joker23
reviewed
Aug 4, 2026
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.
joker23
approved these changes
Aug 4, 2026
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.

Overview
Adds the async FDv1 streaming data source and its companion async data source status tracking, plus a new shared sans-I/O
datasource_commonmodule. 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 byld_eventsource'sAsyncSSEClientand owning its ownaiohttpsession viamake_client_session. It consumes SSEput/patch/deleteevents and pushes the resulting data into the async data source update sink.Async data source status tracking (
ldclient/impl/datasource/async_status.py—AsyncDataSourceUpdateSinkImpland 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_commonmodule (ldclient/impl/datasource/datasource_common.py) —STREAM_ALL_PATH,sink_or_store, andparse_path. Both the sync data sources and the new async streaming source use it.Behavior-preserving extraction of the sync data sources.
streaming.pyandpolling.pyare routed throughdatasource_common: the inline_sink_or_store/_parse_path/STREAM_ALL_PATH/ParsedPathdefinitions 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 syncDataSourceStatusProviderImpl. To let both sinks satisfy it structurally, the sync provider'supdate_sinkparameter was widened to a small status-onlyProtocol(_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 syncstatus.py.Notes
.. caution::block.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) andAsyncDataSourceUpdateSinkImplso SSEput/patch/deleteupdates 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.deletenow 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:
DataSourceStatusProviderImplaccepts a small_DataSourceStatusSourceprotocol so one provider works with sync and async sinks.Async streaming owns an aiohttp session built lazily in
_runviamake_client_sessionwhen 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.