Skip to content

chore: Extract shared sans-I/O cores and add config read-protocols#450

Open
jsonbailey wants to merge 2 commits into
mainfrom
jb/sdk-2602/core-extraction
Open

chore: Extract shared sans-I/O cores and add config read-protocols#450
jsonbailey wants to merge 2 commits into
mainfrom
jb/sdk-2602/core-extraction

Conversation

@jsonbailey

@jsonbailey jsonbailey commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

What

Two pieces of async-SDK foundation, laid on the sync side and behavior-identical to main:

1. Shared sans-I/O _common modules. Pulls I/O-free logic out of the sync data paths into impl/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.py route through them; fdv2.py re-exports the moved names via __all__ so existing import paths still resolve.

2. Config read-protocols + build() widening. Introduces structural Protocols in config.py describing the config surface each consumer reads, so a future AsyncConfig can satisfy the same contracts without a fork:

  • SdkIdentityConfigsdk_key, wrapper_name, wrapper_version, application; parameter type of get_environment_metadata / secure_mode_hash.
  • DataSourceBuilderConfig(SdkIdentityConfig) — adds base_uri, stream_base_uri, http, initial_reconnect_delay, poll_interval, payload_filter_key, _instance_id; parameter type of DataSourceBuilder.build().
  • PrivateAttributesConfigall_attributes_private, private_attributes; parameter type of EventOutputFormatter.

Config explicitly inherits DataSourceBuilderConfig + PrivateAttributesConfig. DataSourceBuilder.build() and the datasourcev2 data sources are widened from Config to DataSourceBuilderConfig. Fully backward-compatible: Config satisfies all three protocols, so every existing caller works unchanged.

Why

Foundation for the async Python SDK (epic SDK-60). The _common modules + config protocols let the sync and async clients share identical I/O-free behavior and config contracts instead of duplicating them. The async siblings and AsyncConfig land in separate slices.

Parity

Behavior-identical to main: the _common extraction moves code verbatim, and the protocols/build() widening are types-only (Config satisfies the protocols; build() still receives a Config at runtime). Worth a careful sync-behavior review.

Validation

  • uv run mypy ldclient — clean
  • uv run isort --check ldclient contract-tests / uv run pycodestyle ldclient contract-tests — clean
  • uv run pytest ldclient/testing --ignore=integrations — 935 passed

Refs SDK-2602 (epic SDK-60).

@jsonbailey jsonbailey force-pushed the jb/sdk-2602/core-extraction branch from 8906a2a to 6cc7d23 Compare June 25, 2026 20:39
@jsonbailey jsonbailey marked this pull request as ready for review June 25, 2026 20:53
@jsonbailey jsonbailey requested a review from a team as a code owner June 25, 2026 20:53
@jsonbailey jsonbailey changed the title refactor: Extract shared sans-I/O cores from sync data paths chore: Extract shared sans-I/O cores from sync data paths Jun 25, 2026
@jsonbailey jsonbailey force-pushed the jb/sdk-2602/core-extraction branch from 6cc7d23 to a3d1f1b Compare June 25, 2026 22:23
Comment thread ldclient/impl/client_core.py Outdated
@jsonbailey jsonbailey force-pushed the jb/sdk-2602/core-extraction branch 2 times, most recently from 0ab6d94 to d10e1a7 Compare July 7, 2026 21:18
@jsonbailey jsonbailey force-pushed the jb/sdk-2602/core-extraction branch from d10e1a7 to bd528e9 Compare July 7, 2026 21:32
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).
@jsonbailey jsonbailey changed the title chore: Extract shared sans-I/O cores from sync data paths chore: Extract shared sans-I/O cores and add config read-protocols Jul 8, 2026
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