chore: Extract shared sans-I/O cores and add config read-protocols#450
Open
jsonbailey wants to merge 2 commits into
Open
chore: Extract shared sans-I/O cores and add config read-protocols#450jsonbailey wants to merge 2 commits into
jsonbailey wants to merge 2 commits into
Conversation
8906a2a to
6cc7d23
Compare
6cc7d23 to
a3d1f1b
Compare
keelerm84
approved these changes
Jul 6, 2026
0ab6d94 to
d10e1a7
Compare
d10e1a7 to
bd528e9
Compare
Introduces SdkIdentityConfig / DataSourceBuilderConfig / PrivateAttributesConfig structural protocols in config.py; Config inherits DataSourceBuilderConfig + PrivateAttributesConfig. Widens DataSourceBuilder.build() (and the datasourcev2 data sources) to accept DataSourceBuilderConfig, and retypes the shared get_environment_metadata/secure_mode_hash helpers to SdkIdentityConfig and EventOutputFormatter to PrivateAttributesConfig. Behavior-identical (Config satisfies the protocols).
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.
What
Two pieces of async-SDK foundation, laid on the sync side and behavior-identical to
main:1. Shared sans-I/O
_commonmodules. Pulls I/O-free logic out of the sync data paths intoimpl/client_common.py,impl/datasystem/fdv2_common.py,impl/events/event_processor_common.py— imported by both the sync code and the future async siblings.client.py/event_processor.py/fdv2.pyroute through them;fdv2.pyre-exports the moved names via__all__so existing import paths still resolve.2. Config read-protocols +
build()widening. Introduces structuralProtocols inconfig.pydescribing the config surface each consumer reads, so a futureAsyncConfigcan satisfy the same contracts without a fork:SdkIdentityConfig—sdk_key,wrapper_name,wrapper_version,application; parameter type ofget_environment_metadata/secure_mode_hash.DataSourceBuilderConfig(SdkIdentityConfig)— addsbase_uri,stream_base_uri,http,initial_reconnect_delay,poll_interval,payload_filter_key,_instance_id; parameter type ofDataSourceBuilder.build().PrivateAttributesConfig—all_attributes_private,private_attributes; parameter type ofEventOutputFormatter.Configexplicitly inheritsDataSourceBuilderConfig+PrivateAttributesConfig.DataSourceBuilder.build()and thedatasourcev2data sources are widened fromConfigtoDataSourceBuilderConfig. Fully backward-compatible:Configsatisfies all three protocols, so every existing caller works unchanged.Why
Foundation for the async Python SDK (epic SDK-60). The
_commonmodules + config protocols let the sync and async clients share identical I/O-free behavior and config contracts instead of duplicating them. The async siblings andAsyncConfigland in separate slices.Parity
Behavior-identical to
main: the_commonextraction moves code verbatim, and the protocols/build()widening are types-only (Configsatisfies the protocols;build()still receives aConfigat runtime). Worth a careful sync-behavior review.Validation
uv run mypy ldclient— cleanuv run isort --check ldclient contract-tests/uv run pycodestyle ldclient contract-tests— cleanuv run pytest ldclient/testing --ignore=integrations— 935 passedRefs SDK-2602 (epic SDK-60).