Repository navigation
chore!: posthog-android 4.0 (integration PR), remove deprecated APIs - #871
turnipdabeets wants to merge 5 commits into
Conversation
posthog-android Compliance ReportDate: 2026-10-28 20:46:24 UTC ✅ All Tests Passed!46/46 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
|
moved to draft since its not mergeable yet |
48776ff to
2f486a0
Compare
Was hoping to get a review on these changes in particular first so I can merge all the other PRs into this one. Then we can mark this as draft if we want. Just because there are changes in here, but it's just removing deprecated APIs so I'll can keep this in draft and and merge into it. |
2f486a0 to
a41d9b9
Compare
Remove the public APIs already marked deprecated: apiKey and the apiKey factories, propertiesSanitizer and PostHogPropertiesSanitizer, evaluationEnvironments, getFeatureFlagPayload, and the replay debouncerDelayMs. remoteConfig moves to its own change because setting it to false still changes setup behavior. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
a41d9b9 to
caf64bd
Compare
Matches posthog-ios 4.0 and the sdk-specs payload decoding contract.
* chore!: make SDK-internal helpers non-public for posthog-android 4.0 Make internal the public declarations that no other module in this repo and no wrapper (Flutter, React Native, KMP) uses. LogLine and LogcatParser are Java, so they become package-private. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> * fix: keep GzipRequestInterceptor public for the compliance adapter sdk_compliance_adapter is a separate Gradle module, only included by its Dockerfile, and constructs GzipRequestInterceptor directly. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Setup now always loads /config. With remoteConfig = false, setup used to skip /config, which left remote settings unloaded since /flags stopped returning config. Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
* chore!: pass the load result to the feature flags callback PostHogConfig.onFeatureFlags and reloadFeatureFlags() now take a PostHogFeatureFlagsCallback, whose loaded() receives a PostHogFeatureFlagsLoaded with the enabled flags, their values, and errorsLoading, matching posthog-ios 4.0. Every path that invoked the callback passes an accurate result, including failures, a disabled SDK, and bootstrap. PostHogOnFeatureFlags moves to posthog-server under the same name, so the server's API is unchanged and it can drop the type in its own major. * chore: drop the unused server callback wrapper posthog-server calls its own PostHogOnFeatureFlags directly, and the core stateless client never calls config.onFeatureFlags. Bump posthog-server to minor since it now depends on core 7.0, and document that a bootstrapped onFeatureFlags runs on the setup() thread. * fix: report persisted flags when the first flags load fails Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: isolate the bootstrap internal flags callback from setup Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: keep loaded flags when a flags reload fails Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: retry flag cache hydration while storage is unreadable A failed load now hydrates the flag cache before the callback. Under Direct Boot that read returned empty values and latched, so persisted flags stayed hidden after unlock. Only latch once the preferences are readable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: skip flag cache reads while storage is unreadable Every flag getter retried hydration under Direct Boot and re-read each cached key, each read failing against locked preferences. Check availability once and skip the reads until storage is readable. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: don't let cache hydration undo a concurrent reset Hydration reads the cache off the flags lock, so a reset() landing between the read and the commit had the previous identity's flags restored. clear() now bumps a generation and hydration drops a commit from an older one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Important
This is the posthog-android 4.0 integration PR. Don't merge it until 4.0 is ready. Every other 4.0 change is a PR stacked on this branch (
chore/v4-remove-deprecated) and merges into it. This PR then merges everything intomainat once. The branch carries one changeset,.changeset/android-v4-major.md, and each stacked PR adds one line to it.Stacked PRs (merge into this branch):
remoteConfigoptionPostHogFeatureFlagsCallback)onFeatureFlagslistener you can unsubscribe (stacked on chore!: pass the load result to the feature flags callback #877)/i/v1/analytics/events)optionsand one property precedence (stacked on feat!: send events through capture v1 and add captureAi #881)captureAion the capture v1 AI endpoint (stacked on feat!: add per-event capture options and one property precedence #882)nullfor malformed feature flag payloads💡 Motivation and Context
Starts the next major: posthog-android 4.0 and core
posthog7.0, following the iOS 4.0 plan (PostHog/posthog-ios#557, PostHog/posthog-ios#873).This first change removes APIs that are already deprecated on
main:PostHogConfig.apiKey,PostHogConfig(apiKey = …),PostHogAndroidConfig(apiKey = …)projectTokenPostHogConfig.propertiesSanitizer,PostHogPropertiesSanitizeraddBeforeSendPostHogConfig.evaluationEnvironmentsevaluationContextsgetFeatureFlagPayload()(instance and static)getFeatureFlagResult(key)?.payloadPostHogSessionReplayConfig.debouncerDelayMsthrottleDelayMsposthog-serverkeeps its own deprecatedapiKeyandgetFeatureFlagPayload; the server SDK gets its own major separately. The React Native and Flutter Android code calls none of the removed APIs.remoteConfigis also deprecated, but removing it changes behavior (setup always fetches/config), so it gets its own stacked PR (#874).No sdk-specs contract is affected; this only removes deprecated aliases.
💚 How did you test it?
./gradlew :posthog:test :posthog-android:testReleaseUnitTestpass (1064 core and 762 Android tests).apiDumpregenerated;apiCheckpasses.getFeatureFlagResult.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Claude Code (Claude Opus 5.5) found the deprecated APIs, removed them, updated the tests and API dumps, and checked the Flutter and React Native Android code for callers.
remoteConfigwas split out after it turned out to be a real behavior switch, not a no-op.🤖 Generated with Claude Code