Repository navigation
Conversation
Generated-By: PostHog Desktop Task-Id: 380b019d-762a-419d-a407-c985b2876490
383cf33 to
4818f23
Compare
posthog-python Compliance ReportDate: 2026-10-08T13:17:43.753283+00:00 ✅ All Tests Passed!121/121 tests passed Capture_V1 Tests✅ 95/95 tests passed View Details
Capture_Ai Tests✅ 5/5 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
Feature_Flags_Local_Evaluation Tests✅ 4/4 tests passed View Details
|
dustinbyrne
left a comment
There was a problem hiding this comment.
The provider-only loader fix and patch changeset look sound. One non-blocking documentation suggestion below.
AI-assisted review.
| return | ||
|
|
||
| if not self.personal_api_key: | ||
| if not self._can_load_feature_flags(): |
There was a problem hiding this comment.
[P2] Configuration docs omit provider-only polling eligibility
The constructor and module configuration docs (posthog/client.py:793–796 and posthog/__init__.py:365–368) describe enable_local_evaluation polling when a personal API key is configured. This patch also permits loading with a provider alone and, by default, starts background refresh after loading (client.py:3482–3486,3515–3525).
The existing description is incomplete rather than wholly false. Provider-only clients previously returned before poller creation; the changed eligibility check makes this lifecycle distinction relevant.
Consider documenting that either privileged configuration or a cache provider permits definition loading, that provider refreshes consult its fetch decision, and that enable_local_evaluation=False suppresses background polling without preventing explicit or first-use hydration.
Verification is a static comparison of these descriptions against the eligibility predicate and poller-start condition. This documentation-only recommendation does not require an automated behavioral regression.
| should_fetch = True | ||
| if self._flag_definition_cache_provider: |
There was a problem hiding this comment.
one follow-up came up as we ported this to other SDKs.
keyless readers should read the cache directly without invoking the fetch-decision callback, since it can acquire fetch leadership for a worker that cannot fetch.
should_fetch = self.personal_api_key is not None
if self._flag_definition_cache_provider and should_fetch:
💡 Motivation and Context
flag_definition_cache_providerand nosecret_keynever evaluates flags locally. Every flag call makes a remote/flagsrequest.load_feature_flags()returns early when no key is set, before it calls the cache provider. It also setsfeature_flags = []._load_feature_flags()already handles this case: it reads the provider first, and needs the key only for an API fetch.💚 How did you test it?
load_feature_flags()and the two lazy-load checks now accept either a key or a cache provider. With neither, the client logs the same warning as before.TestCacheInitialization: a client with a provider and no key loads the cached definitions throughload_feature_flags(), and through the lazy load on the firstget_feature_flag()call. Both cases fail without the fix. The existing provider tests call the private_load_feature_flags()directly, so they never reached this check.posthoganalytics.📝 Checklist
If releasing new changes
sampo addto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
claude-opus-5-5)./flags, because the web process had no local definitions..sampo/changesets/, in the same format assampo add.Created with PostHog Desktop