Skip to content

docs: clarify is_initialized() semantics (SDK-2641)#454

Merged
keelerm84 merged 2 commits into
mainfrom
mk/SDK-2641/fix-is-initialized-doc
Jul 8, 2026
Merged

docs: clarify is_initialized() semantics (SDK-2641)#454
keelerm84 merged 2 commits into
mainfrom
mk/SDK-2641/fix-is-initialized-doc

Conversation

@keelerm84

@keelerm84 keelerm84 commented Jul 7, 2026

Copy link
Copy Markdown
Member

What

Rewrites the LDClient.is_initialized() docstring in the Python server SDK. Docstring only — no behavior change.

Why

The old docstring claimed the method "Returns true if the client has successfully connected to LaunchDarkly." That overpromises. The implementation returns True in three cases, only one of which involves a live connection:

  1. Offline mode — returns True unconditionally, no connection attempted.
  2. LDD/daemon mode (use_ldd) — returns True purely from the config flag.
  3. data_availability.at_least(CACHED) — a populated (possibly stale) persistent store satisfies this even if the live data source never connected, is still retrying, or permanently failed. Per the enum, CACHED means "data, not necessarily the latest."

The Go, Ruby, and JS SDKs all word their equivalent around "initialized/ready" with explicit hedges. Go is the clearest, so this change aligns the Python wording with Go's Initialized():

  • Reframed as "initialized and has flag data available to serve requests" rather than "connected."
  • Notes offline/LDD always return True.
  • Warns that a True result does not guarantee flag data is up to date.
  • Points to data_source_status_provider for connection-status detail.

Ticket

SDK-2641


Note

Low Risk
Docstring-only update with no logic, API, or runtime changes.

Overview
Documentation-only change to LDClient.is_initialized() in ldclient/client.py — runtime behavior is unchanged.

The docstring no longer claims the client has successfully connected to LaunchDarkly. It now describes initialized with flag data available (live data, persistent cache, or offline/LDD), notes that True does not mean data is current, and directs integrators to data_source_status_provider for connection detail. It also spells out when False applies and how evaluations behave (defaults vs. prior persistent-store data).

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

The is_initialized() docstring claimed the method returns true only after
successfully connecting to LaunchDarkly. In reality it also returns true in
offline mode, in LDD/daemon mode, and whenever a persistent store already has
(possibly stale) cached data -- none of which require a live connection.

Reword to align with the Go SDK's Initialized() documentation: describe it as
'initialized and has flag data available', note that offline/LDD always return
true, warn that a true result does not guarantee flag data is up to date, and
point to data_source_status_provider for connection status. Docstring only; no
behavior change.
@keelerm84 keelerm84 marked this pull request as ready for review July 7, 2026 14:25
@keelerm84 keelerm84 requested a review from a team as a code owner July 7, 2026 14:25
Comment thread ldclient/client.py Outdated
Comment thread ldclient/client.py
If this returns false, it means the client has not yet obtained any flag data. It might still be
starting up, or attempting to reconnect after an unsuccessful attempt, or it might have received
an unrecoverable error (such as an invalid SDK key) and given up. In this state, feature flag
evaluations will return default values -- unless you are using a persistent store integration and

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part about persistent stores conflicts or at least can be a little confusing here since it is mentioned in the paragraph when it returns true.

Per review: the standalone 'Additionally, offline/LDD always returns true'
paragraph duplicated the offline/LDD case already listed in the first
paragraph. Removed it. (The Go SDK keeps that callout only because its first
paragraph does not mention offline.)

@jsonbailey jsonbailey left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor comments but I don't think they need to block.

@keelerm84 keelerm84 merged commit bab14db into main Jul 8, 2026
24 of 25 checks passed
@keelerm84 keelerm84 deleted the mk/SDK-2641/fix-is-initialized-doc branch July 8, 2026 12:11
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