Repository navigation
feat!: posthog-android 4.0 and posthog 7.0 - #871
turnipdabeets wants to merge 60 commits into
Conversation
posthog-android Compliance ReportDate: 2026-11-16T15:03:29.740009+00:00 ✅ All Tests Passed!232/232 tests passed Capture_V1 Tests✅ 105/105 tests passed View Details
Capture_Ai_V1 Tests✅ 110/110 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
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>
) * docs: generate the SDK reference for 3.x Generated by bin/docs_scripts/generate_markdown.py. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * docs: generate the experimental SDK reference for 4.x Generated by bin/docs_scripts/generate_markdown.py --major 4 --experimental from feat/v4-capture-v1 (PRs #871 and #881), with the capability tags applied on top. Adds the 3.x to 4.0 migration guide page. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> * docs: regenerate the Android references from Dokka's HTML The 4.x page and migration guide come from chore/v4-remove-deprecated (the 4.0 branch) with the capability tags and getting-started applied. Both still need to land there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: regenerate the Android references with braces kept in code Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: regenerate the Android references from docs/capabilities.json The 3.x pages lose only the blank line the stripped capability tags left behind. The 4.x page also moves captureAi to Capture AI and onFeatureFlags to On feature flags, which the map's "next" entries add. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: regenerate the Android references after review fixes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: regenerate the Android migration page from the current 4.0 guide Rebuilt from docs/migration-3.x-to-4.0.md on chore/v4-remove-deprecated, which dropped the SDK identity section (#942) and added the custom httpClient paragraph. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: regenerate the Android migration page from the current 4.0 guide Rebuilt from docs/migration-3.x-to-4.0.md on chore/v4-remove-deprecated, which now covers the missing-flag response, posthog-server 2.25 and retry scope. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: regenerate the Android 4.x page from chore/v4-remove-deprecated Picks up the branch's feature flag doc comment fixes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: regenerate the references with the getting-started intro Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
* fix: skip the person-properties hash for maybe-personless updates A process_person_profile value capture can't read as false, such as "maybe" or "true", counted as person-processed, so the $set stored and matched the dedupe hash. PostHog may drop or not apply that update, so the same properties sent later were dropped as a duplicate. Mirror posthog-ios #1050: only a missing setting or a Boolean true uses the hash, and an update PostHog might apply clears it. A setting capture reads as false still leaves the hash as it is. Claude-Session: https://claude.ai/code/session_019xLynttdFZAHfqTem5BhPQ * fix: clear the person-properties hash for every update that may be personless Match posthog-ios #1050: only a missing process_person_profile or a Boolean true checks and records the hash. Any other value, including a definite false, is sent and clears the stored hash, so the SDK no longer depends on parsing false spellings the way the server does. Claude-Session: https://claude.ai/code/session_019xLynttdFZAHfqTem5BhPQ
# Conflicts: # posthog/src/main/java/com/posthog/PostHog.kt
…e migration guide Capture v1 moved to /docs/api/capture-v1 (posthog.com#21385).
…974) posthog-android 3.x calls core APIs that 7.0 removes, so an app that pins core 7.x next to posthog-android 3.x crashes with NoSuchMethodError when it builds PostHogAndroidConfig. Publish a constraint from core to posthog-android at the matching major so Gradle upgrades posthog-android instead. Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
* docs: publish MIGRATION.md as the SDK's migration guide page The reference generator read docs/migration-*.md, which the 4.0 branch no longer has since the guide moved to MIGRATION.md, so a release kept the old generated page. That page now becomes the Android migration guide on posthog.com, so read MIGRATION.md and regenerate it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: say Gradle upgrades posthog-android 3.x to 4.0 next to core 7.0 Since the core-to-android constraint, core 7.0 or posthog-server 2.25 next to posthog-android 3.x resolves posthog-android 4.0 instead of failing at runtime. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: queue events in the personless hash tests and fix a Retry-After flake The two personless dedup tests dropped every event in beforeSend, so no hash was ever stored and they passed with personless detection switched off. They now queue events to a mock server, and fail under that mutation. The HTTP-date Retry-After test compared against the real clock, so it read 19 instead of 20 when the request crossed a second boundary. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Keeps the 4.0 shapes where main conflicts: $feature_flag_response is still omitted for a missing or failed flag and getFeatureFlag has no defaultValue; main's $feature_flag_error and disableGeoIp ($geoip_disable stays a property under capture v1) come through. Main's new tests are adapted to the capture v1 path and the 4.0 flag API. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Gson can build a failed FeatureFlag record without its metadata object, and the 3.x payload migration read flag.metadata.payload unguarded, so the first flag read after reopening a PostHogMemoryPreferences cache threw a NullPointerException to the caller. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ange (#973) * docs: sort the Android 4.0.0 migration guide by when you make each change Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: keep the 4.0.0 guide's table cells to one value Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: move the posthog.com Android SDK page into the reference The posthog.com Android SDK page redirects to this reference once 4.0.0 ships, so its setup, how-to, and configuration sections now live in docs/getting-started.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: title a single migration guide's page with its H1 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit 2eeb772) * docs: publish the root MIGRATION.md as the migration page Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> (cherry picked from commit f7650a7) * Revert "docs: move the posthog.com Android SDK page into the reference" This reverts commit 0e67e30. * docs: add the Android facts from the retired posthog.com page that no other page has Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: move the Android one-API facts from getting-started into KDoc Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: preserve Android tracing setup * docs: name the SDK in versions, cut self-hosted notes, and split dashes and semicolons Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: address review on the reordered 4.0 migration guide - Move "Upgrade your dependencies" and "Upgrade posthog-server" to During: both come down to declaring posthog-android 4.0.0. - Give the PostHogStateless break its own During section and checklist item. - Drop "Check timestamps and IDs": nothing in it changes but the request ID header, which the proxy section covers. - Say what staying on capture costs for $ai_* events, scope the intro to analytics and AI events, and say why follow ups can wait. - disableGeoIp exists now (main's #971), so the guide no longer says there's no GeoIP setting. Name the real remote config path. - Regenerate references/posthog-android-migration.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: say flush doesn't block, and register persists across app restarts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: pass the migration page generator one guide Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: point the copy page button at posthog.com and reword the change categories Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * docs: restore the self-hosted note on serving capture v1 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Anna Garcia <anna.g@posthog.com>
* fix: keep a registered personless setting off identity events A registered `$process_person_profile: false`, or a `process_person_profile` option a wrapper registers, no longer applies to `$identify`, `$create_alias`, `$merge_dangerously`, `$groupidentify`, `$set` and `$set_once`. PostHog drops those events with person processing off. A value passed on the call or set in `beforeSend` still applies. * docs: note the identity-event exception on register * docs: keep the $set and $set_once distinction in the migration guide * test: cover $set_once, $merge_dangerously, a call property and beforeSend
The generated page still told users that a registered $process_person_profile reaches identify, alias, group and setPersonProperties, which #979 changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
There was a problem hiding this comment.
PostHog Review · Standard · reviewed 7bd8b19: 1 Must fix, 3 Should fix. This pull request is large, so the review ran in 4 parts with less depth than usual.
See this review and its findings in PostHog Review. Comment @posthog review --deep for a Deep review. A Deep review takes longer and looks deeper than a Standard review.
* fix: close replay masking and legacy retry gaps from 4.0 review
- Mask Compose text that a negative TextIndent paints left of its layout
box (or right of it, for right-to-left text).
- Read cleared text semantics from SemanticsModifier elements on Compose
1.0-1.2, which have no getTail, instead of discarding every frame.
- Re-queue one copy per uuid when capture asks to retry legacy events,
since it drops a uuid's later copies in a batch for good.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* fix: measure only rendered text and keep node runtimes fail-closed
- Skip clearAndSetSemantics { text = ... } replacements when looking for
the text to measure: only semantics with GetTextLayoutResult count.
- A missing getTail is only expected on pre-1.3 layout wrappers. On a
NodeCoordinator it throws again, so the frame is discarded.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
|
Adding one more 4.0 change: #984 flips |
Important
This is the posthog-android 4.0 integration PR. Don't merge it until every item under "Before release" is done. "Release day" and "After release" items don't block the merge. All stacked 4.0 PRs are merged into this branch (
chore/v4-remove-deprecated), and this PR merges them intomainat once. The branch carries the core and Android changeset.changeset/android-v4-major.md, the Android-only.changeset/android-v4-replay-and-device.md, and the server-only.changeset/server-keep-on-feature-flags.md.Closes #822
💡 Motivation and Context
posthog-android 4.0 and core
posthog7.0:/i/v1/analytics/events), and the newcaptureAisends AI events to/i/v1/ai/events.options, and one property precedence: SDK-set, then super properties, then event properties, thenbeforeSend.The upgrade guide is
MIGRATION.md.Docs and onboarding that ship with this release (merge once 4.0.0 is on Maven Central):
projectToken,4.+,onFeatureFlags), Compose and WebView replay masking, removed replay installation snippetprojectToken,4.+, screenshot-only replay) and the Android, iOS and FluttercaptureAitabs in LLM analytics manual captureWhat gets released
posthog-androidposthog(core)PostHog,PostHogConfig,PostHogInterfaceand the flags types live in core, so the Android API breaks are core API breaks. Apps get core 7.0 throughposthog-android4.0.posthog-serverapi(project(":posthog")), so 2.25 pulls in core 7.0. Its own API is unchanged (PostHogOnFeatureFlagsmoves into it with the same name), it stays on/batchand its ownPostHogMemoryQueue, andPostHogEventkeeps its 3.x constructor andcopy.posthog-android-surveys-composemainand here, and it only uses APIs 4.0 keeps, so the published 0.5.x works with 4.0. Verified on device (survey below).posthog-server-openfeaturecom.posthog.server.*.The Flutter and React Native Android plugins are unaffected until they move to 4.0: Flutter 5 pins
[3.75.0,4.0.0)and React Native pins exact 3.x versions. With #974, core 7.0 makes Gradle upgrade the app'sposthog-android3.x to 4.0, soposthog-server2.25 next toposthog-android3.x resolves 4.0 instead of crashing at runtime. A Flutter 5 app that also pulls in core 7 still crashes at runtime: theposthog_flutter5 plugin compiles in its own Gradle project against 3.x and calls APIs 4.0 removes (checked with posthog_flutter 5.60.2). The guide covers both.Merged into this branch
apiKey,propertiesSanitizer,evaluationEnvironments,getFeatureFlagPayload(),debouncerDelayMsremoteConfigoptionPostHogFeatureFlagsCallback)onFeatureFlagslistener you can unsubscribenullfor malformed feature flag payloadsdefaultValuefromgetFeatureFlagPostHogConfig.onFeatureFlagsin favor of the listenerposthog-androidto core's major with a Gradle constraintMIGRATION.md, the guide describes #974's Gradle upgrade, and two personless dedup tests test something again$liband$lib_versionon capture v1 events, filled last and as a paironFeatureFlagsaftersetup()gets its catch-up on the main thread without waiting for the startup loadgetFeatureFlagResultandPostHogFeatureFlagsLoaded@PostHogInternaldeclarations from the API dump$feature_flag_responsefor a missing flagnullarray elements in event properties$process_person_profile(or wrapper-registered option) no longer applies to$identify,$create_alias,$merge_dangerously,$groupidentify,$setand$set_once, so it can't stop identifying userscaptureAi,$locale/$app_language, wrapperbeforeSend, and the capture v1 fixes (#897, #901, #902, #903, #904, #905, #909, #924, #927, #928, #929, #930, #934)mainis merged in up to the 3.76.0 release, including #922 (drop touches inside masked views), #937 (no$feature_flag_calledfor survey targeting flags) and #823 (compose activity and dialog windows into one scene, released in 3.76.0). A follow-up commit makes #922's touch hit test read the unmerged semantics tree, which the 4.0 mask walk uses. #823 is adapted to 4.0, which removes wireframe mode andRRStyle: a dialog's dim is a small translucent screenshot image stretched over the scene, and a dialog masked whole is a masked screenshot. Only that part is in the 4.0 changeset, since 3.76.0 already released the composed scene.mainis then merged up to 3.77.1: #967 (person-properties hash stored once the update is queued), #971 (disableGeoIp) and #970 (failed flag records read as unavailable). Where they conflicted with 4.0, 4.0's shape is kept and main's behavior comes through:getFeatureFlagreturnsnull(4.0 has nodefaultValue), and its$feature_flag_calledomits$feature_flag_responseinstead of sending"", with main's$feature_flag_error(evaluation_failed, …) added.disableGeoIpstamps$geoip_disableafter the caller's properties, as onmain. Under capture v1 it stays an event property (the capture v1 spec'sgeoip_disable_injected_into_properties), not an option, and it's on the minimal$feature_flag_calledallowlist next to the legacy option properties.main, so the 4.0 changesets are unchanged.sdk-specs: 4.0 implements the capture v1 contract (PostHog/sdk-specs#146, #147) and the property precedence from PostHog/sdk-specs#143. #881's description lists where Android differs from the spec. An event named only with whitespace is sent, as the capture spec only requires a non-empty name.
Release review changes in this PR
Retry-After, migrated 3.x queues, non-string map keys). The server changeset now lists the core changes it also gets:PostHogEvent.options, the map key fix,beforeSendcopies and quieter debug logs.posthog-android4.0.0 or later instead of4.+; PostHog no longer saves non-JSON payloads, so only older payloads are affected; the first event after a language change carries the previous$localeor$app_language, and a runtimesetOverrideLocaleConfigchange alone isn't picked up (both confirmed on API 32 and API 37 emulators); a self-hosted proxy set up from PostHog's guides before 29 October 2026 stripsAuthorization, so events get401and are dropped.PostHogMemoryPreferences) afterclose()andsetup()threw aNullPointerExceptionto the caller when a cached failed flag had no metadata. fix(flags): decode payloads cached by 3.x from the cached flag details #935's 3.x payload migration readmetadata.payloadunguarded. Fixed in3cf406d4with a regression test. Android'sSharedPreferencescache wasn't affected.references/posthog-android-migration.mdfromMIGRATION.md(7bd8b195). It still said a registered$process_person_profilereachesidentify,alias,groupandsetPersonProperties, which fix: keep a registered personless setting off identity events #979 changed. The release regenerates it too, but only as a best-effort step.debugon (found on the Android 8 run).Before release
MIGRATION.mdopens with a link tohttps://posthog.com/docs/api/capture-v1, which is a 404 until it merges. ThecaptureAidocs (#21963) are merged into its branch too. Not a hard blocker: the upgrade steps don't depend on that page.Release day, after 4.0.0 is on Maven Central
These pin
4.+, so they can't merge earlier. Until they do, the docs and onboarding pin3.+and their snippets compile on 3.x, so a few days' lag is fine.context_mill_version(feat: install SDKs at the docs' version and keep agents on today's majors context-mill#502, feat(cli): add --context-mill-version to pin skills to a release wizard#1541, feat(wizard): pin cloud runs to a context-mill release posthog#132411, all merged). Programs that aren't pinned move to 4.x with the next context-mill release after the docs merge, as intended.evaluation-contexts.mdxrow also says iOS removedevaluationEnvironmentsin 4.0.0.projectToken, replay) and thecaptureAitabs. Its iOS and Flutter tabs pin posthog-ios 4.0 and posthog_flutter 6.0, so it also waits for those unless they ship the same day or the tabs are split out.After release
MIGRATION.md-based migration page, after the iOS, Android, Flutter and React Native majors publish their references. #22061 now covers only Python, JavaScript Web, Node.js, Go and Rust.android-v4.0.0tag.chore/v4-*/feat/v4-*filters from the compliance workflow.$app_language($localecollected different from iOS #822): chore(taxonomy): add $app_language for mobile SDKs posthog#128366 (taxonomy) is merged; add a "Most common app language" tile ($app_languagebreakdown) to the global Mobile Analytics dashboard template, then close$localecollected different from iOS #822 and reply to the reporter.Follow-ups found during the review
No blocking issues. Nothing needs a follow-up PR before release.
A Gradle constraint for
posthog-server, like fix: align posthog-android to core's major with a Gradle constraint #974's forposthog-android? An app withposthog-android4.0 andposthog-server2.24.x (directly or throughposthog-server-openfeature0.1.3) resolves core 7.0, and 2.24.x'sasCoreConfigthen fails at setup withNoSuchMethodError(it passesremoteConfigandonFeatureFlags). The guide documents it. A constraint would need the server version that ships with core 7.0.Session replay drops frames with a
SelectionContainer. When text masking is on and a screen hasText(…, Modifier.clearAndSetSemantics { … })inside aSelectionContainer, the text node (SelectableTextAnnotatedStringNode) can't be measured, so the frame is discarded instead of masked. It's deliberate (fail closed, covered byframe is discarded when cleared semantics hide text we cannot measure), but neither the changeset nor the guide mentions it.Low confidence:
textPaintedBoundsCacheis keyed by semantics node ID only. IDs are unique perSemanticsOwner, so two ComposeViews with the same node ID, text and size but a different shadow or stroke could share masked bounds.Nit: the compliance adapter maps the harness's
max_retriestopushNotificationSubscriptionMaxRetries, which doesn't affect capture retries.@turnipdabeets: decide who should fix remote config on Android 6 and 7.0. It isn't new in 4.0 and doesn't block the release.
us-assets.i.posthog.comandeu-assets.i.posthog.comserve a Let's Encrypt certificate chained to ISRG Root X1, which Android 7.0 and older don't trust, so/array/{token}/configfails withSSLHandshakeException: Trust anchor for certification path not found./flagsand capture work, becauseus.i.posthog.comuses Amazon's chain. Without remote config, those devices never start session replay, exception autocapture (Java/Kotlin and native) or surveys. Events, flags, logs and AI events still work, and nothing crashes. 3.x already always loaded remote config, so this already happens today. It's a fix for whoever owns the assets host's certificate (infra), not this SDK.:posthog-android:animalsnifferReleasefails locally on this branch (1,237 violations, Gson and Kotlin signature false positives) and onmaintoo (1,307), and CI doesn't run it. Fixing or removing that task is a separate cleanup.💚 How did you test it?
The device runs below were on this branch before the 3.77.1 merge (
9bbfa914, then the docs commits; Android 6–13 ran on34198711), against PostHog Cloud project 381971 and a local mock PostHog server.After merging 3.77.1 (
830f7891)::posthog:test,:posthog-server:test,:posthog-server-openfeature:test,:posthog-android:testDebugUnitTest,apiCheckandspotlessCheckpass, after adapting main's 8 new tests to capture v1 and the 4.0 flag API. The device runs weren't repeated.On the current head (
7bd8b195, after3cf406d4, #973, #979 and the regenerated migration page): CI Build & Test (compile, tests, survey interaction tests, release tasks and dependency locks) andtest-android-sdkpass. SDK compliance passed on9217eeca, which has the same code.Automated
spotlessCheckapiCheckmake test(every module, debug tests,testWithoutCompose, Gradle plugin unit and functional tests):posthog-android:lintRelease:posthog-android-surveys-compose:testDebugUnitTest(Compose survey UI):posthog:animalsnifferMain(API 23 signatures for core)capture_v1,capture_ai_v1,feature_flags)Harness 1.27 and 1.28 only add flags v4 and flag rules v2 tests, which need the
flags_response_v4capability the adapter doesn't declare, so 1.26.0 runs the same tests.Devices
Pixel 10a (Android 16), emulators for Android 6, 7.0, 8, 9, 10, 11, 12, 13 (API 23, 24, 26, 28, 29, 30, 31, 33; google_apis arm64), Android 14 (API 34) and Android 17 (API 37). Sample app built from this branch with a local driver activity (not committed), with
debug, session replay, surveys, error tracking, logs, deep links and lifecycle and screen autocapture on. Results were read from logcat, from PostHog with SQL and Replay Vision, and from the mock server's request log.Upgrade from 3.76.0 (Pixel offline, API 34 online)
$process_person_profileand$session_idset as properties){plan=premium, seats=5}), listener getserrorsLoading=truewith the cached flagsPostHog-Request-IdwithPostHog-Attempt: 2; all 5 ingested, person-less,$session_idkeptNew behavior (PostHog Cloud)
/i/v1/analytics/eventswithAuthorization: Bearer,PostHog-Sdk-Info,PostHog-Request-Id,PostHog-Attempt, gzip, noapi_keybody fieldoptionsand legacy option propertiesoptions = {process_person_profile: false}, a$process_person_profile: falseproperty, abeforeSendthat sets the option, and a registered$process_person_profileall made an identified user's event person-less; a plain event and the event afterunregisterstayedfull; an unknown option didn't become a property$os_namebeat the SDK value; event beat super;beforeSendbeat bothuserPropertiesvs$setuserPropertieswon key by key, the other$setkey was kept$lib/$lib_versionset by the app$window_id = 1231,true,null,Any()"1","true","null"; the object key was dropped with the rest of the event sentbeforeSendreturningnulldistinctIdargumentcaptureAi$ai_generationand$ai_spandelivered through/i/v1/ai/events; a 9 MiB event returnednulland logged the limit only; a non-$ai_name got PostHog'smisrouted_eventdrop, logged per batchidentify,group,alias,setPersonProperties,captureException,screenwith optionsgetFeatureFlagwithout a defaultpremium,true,nullfor a missing flag;isFeatureEnabled("missing", true)returnedtrueand its$feature_flag_calledleft out$feature_flag_responseonFeatureFlagsunsubscribe(), and stayed registered acrossclose()andsetup()reloadFeatureFlags(callback)PostHogRemoteConfigThreadwith aPostHogFeatureFlagsLoadedphx_project token$locale/$app_language$localeen-US;$app_languagenot sent by default,de-DEaftercmd locale set-app-locales,fr-CAaftersetAppLanguage("fr-CA"), gone after clearing. The first event after each change still carried the previous value, as the code documents; the guide now says so$process_person_profile=true&$set=xDeep Link Openedkeptutm_sourceandrefand skipped the$parametersPayload rules (mock
/flagsserving each payload kind)hello,{broken, empty,{'a': 1},nullnull, flag value stilltrue"hello",{"a": 1},false,[1, 2]on a variantString, map,Boolean, listPostHog Cloud now refuses to save a payload that isn't valid JSON, so this can only be tested with a mock or an old flag.
Transport errors (mock server, each scenario isolated)
Retry-After: 120{}requestHeaderswithAuthorizationandX-E2EAuthorizationwith the Bearer token and keptX-E2E;/configand/flagskept the app'sAuthorizationRegression
01a1ac64-d968…: 92 snapshot events, 17 taps over 80 s across the native, Compose, survey, logs and error tracking screens; Replay Vision confirmed every screen is a screenshot with masked text and images and no broken or black framessurvey shownandsurvey sent(rating 4) ingested$exception(with steps) and a fatal crash, sent before the process died/i/v1/logsflushed 3 recordsApplication Opened(including after the crash relaunch),$screen,$autocapturetaps,Deep Link OpenedAndroid 6–13 (fresh emulator per version, same 4.0 build, PostHog Cloud)
Each emulator ran the same script: the full capture set (core events, options, precedence,
identify/group/alias,captureException,captureAiwith a 2 MB and a 9 MiB event), a deep link, five screens (native, Compose, interaction, survey), logs, a fatal crash and relaunch, then Home. The API levels cover everyBuild.VERSION_CODESbranch inposthog-android(N, O, P, Q, R, S, TIRAMISU). Android 13 set a per-app language withcmd locale set-app-locales … fr-FR.$app_languagefr-FR$identify,$groupidentify,$create_alias,$setand$feature_flag_called.$localewasen-USeverywhere.beforeSend-filteredtest_event, and logged NaN and Infinity as unserializable instead of losing the event.captureAicall returnednullwithout crashing on every version. On Android 6 it hit anOutOfMemoryErrorwhile serializing, which the SDK caught and logged.Application Backgroundeddidn't arrive. The "app has stopped" dialog kept the crashed process alive until the script pressed Home, which killed it. That's a test artifact, not an SDK issue.The temporary survey is archived; the e2e test events stay in the test project only.
📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Claude Code (Claude Opus 5.5) wrote the stacked PRs and ran this release review: it merged
main(3.76.0) into the branch, rewrote the changesets and fixed the guide, checked which unreleased artifacts link against core 7.0, and ran the automated suite and the device tests above. The device driver activity, the 3.76.0 upgrade build and the mock server stayed local and aren't committed.🤖 Generated with Claude Code