Skip to content

chore!: posthog-android 4.0 (integration PR), remove deprecated APIs - #871

Open
turnipdabeets wants to merge 1 commit into
mainfrom
chore/v4-remove-deprecated
Open

turnipdabeets wants to merge 1 commit into
mainfrom
chore/v4-remove-deprecated

Conversation

@turnipdabeets

@turnipdabeets turnipdabeets commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

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 into main at 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):

💡 Motivation and Context

Starts the next major: posthog-android 4.0 and core posthog 7.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:

Removed Use instead
PostHogConfig.apiKey, PostHogConfig(apiKey = …), PostHogAndroidConfig(apiKey = …) projectToken
PostHogConfig.propertiesSanitizer, PostHogPropertiesSanitizer addBeforeSend
PostHogConfig.evaluationEnvironments evaluationContexts
getFeatureFlagPayload() (instance and static) getFeatureFlagResult(key)?.payload
PostHogSessionReplayConfig.debouncerDelayMs throttleDelayMs

posthog-server keeps its own deprecated apiKey and getFeatureFlagPayload; the server SDK gets its own major separately. The React Native and Flutter Android code calls none of the removed APIs.

remoteConfig is 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:testReleaseUnitTest pass (1064 core and 762 Android tests).
  • apiDump regenerated; apiCheck passes.
  • Tests that only covered the removed APIs are deleted; the payload test now goes through getFeatureFlagResult.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

If releasing new changes

  • Ran pnpm changeset to 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. remoteConfig was split out after it turned out to be a real behavior switch, not a no-op.

🤖 Generated with Claude Code

@turnipdabeets turnipdabeets self-assigned this Oct 22, 2026
@turnipdabeets
turnipdabeets marked this pull request as ready for review October 22, 2026 19:43
@turnipdabeets
turnipdabeets requested a review from a team as a code owner October 22, 2026 19:43
@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

posthog-android Compliance Report

Date: 2026-10-23 15:53:26 UTC
Duration: 118391ms

✅ All Tests Passed!

46/46 tests passed


Capture Tests

✅ 29/29 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields ✅ 398ms
Format Validation.Event Has Uuid ✅ 33ms
Format Validation.Event Has Lib Properties ✅ 25ms
Format Validation.Distinct Id Is String ✅ 24ms
Format Validation.Token Is Present ✅ 25ms
Format Validation.Custom Properties Preserved ✅ 25ms
Format Validation.Event Has Timestamp ✅ 29ms
Retry Behavior.Retries On 503 ✅ 7026ms
Retry Behavior.Does Not Retry On 400 ✅ 4025ms
Retry Behavior.Does Not Retry On 401 ✅ 4028ms
Retry Behavior.Respects Retry After Header ✅ 7026ms
Retry Behavior.Implements Backoff ✅ 17034ms
Retry Behavior.Retries On 500 ✅ 7020ms
Retry Behavior.Retries On 502 ✅ 7019ms
Retry Behavior.Retries On 504 ✅ 7018ms
Retry Behavior.Max Retries Respected ✅ 17020ms
Deduplication.Generates Unique Uuids ✅ 39ms
Deduplication.Preserves Uuid On Retry ✅ 7016ms
Deduplication.Preserves Uuid And Timestamp On Retry ✅ 12023ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 7018ms
Deduplication.No Duplicate Events In Batch ✅ 34ms
Deduplication.Different Events Have Different Uuids ✅ 26ms
Compression.Sends Gzip When Enabled ✅ 18ms
Batch Format.Uses Proper Batch Structure ✅ 19ms
Batch Format.Flush With No Events Sends Nothing ✅ 13ms
Batch Format.Multiple Events Batched Together ✅ 32ms
Error Handling.Does Not Retry On 403 ✅ 4019ms
Error Handling.Does Not Retry On 413 ✅ 4019ms
Error Handling.Retries On 408 ✅ 5027ms

Feature_Flags Tests

✅ 17/17 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id ✅ 41ms
Request Payload.Flags Request Uses V2 Query Param ✅ 23ms
Request Payload.Flags Request Hits Flags Path Not Decide ✅ 22ms
Request Payload.Flags Request Omits Authorization Header ✅ 23ms
Request Payload.Token In Flags Body Matches Init ✅ 19ms
Request Payload.Groups Round Trip ✅ 21ms
Request Payload.Groups Default To Empty Object ✅ 22ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False ✅ 22ms
Request Payload.Disable Geoip Omitted Defaults To False ✅ 26ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key ✅ 24ms
Request Lifecycle.No Flags Request On Init Alone ✅ 13ms
Request Lifecycle.No Flags Request On Normal Capture ✅ 18ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests ✅ 40ms
Request Lifecycle.Mock Response Value Is Returned To Caller ✅ 24ms
Retry Behavior.Retries Flags On 502 ✅ 324ms
Retry Behavior.Retries Flags On 504 ✅ 322ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event ✅ 20ms

@marandaneto
marandaneto marked this pull request as draft October 23, 2026 08:55
@marandaneto

Copy link
Copy Markdown
Member

moved to draft since its not mergeable yet

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) <[email protected]>
@turnipdabeets

Copy link
Copy Markdown
Contributor Author

moved to draft since its not mergeable yet

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.

This branch has not been deployed

No deployments
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