Repository navigation
Conversation
Contributor
posthog-android Compliance ReportDate: 2026-12-03T08:54:40.444208+00:00 ✅ All Tests Passed!243/243 tests passed Capture_V1 Tests✅ 111/111 tests passed View Details
Capture_Ai_V1 Tests✅ 115/115 tests passed View Details
Feature_Flags Tests✅ 17/17 tests passed View Details
|
Contributor
ioannisj
marked this pull request as ready for review
December 3, 2026 09:59
PR overviewNo security issues were found in this pull request. Reviews
|
Member
|
we are just moving the rules from A to B, or am I missing something? |
marandaneto
reviewed
Dec 3, 2026
| @@ -0,0 +1,25 @@ | |||
| # Session replay: Gson serializes these by field name. RREvent subclasses only inherit its fields. | |||
Member
There was a problem hiding this comment.
minify works with differet tools, proguard, r8 and dexguard
do all those tools read from this file as well? do we need a min. version for each tool? i do know that at least jar has a min. AGP support, but we are probably past this min. version, worth checkin tho
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

💡 Motivation and Context
Fixes #1031
The Android AAR kept every class in
com.posthog.surveysandcom.posthog.internal.replaywith all its members, so R8 couldn't shrink or rename any of them in apps that use the SDK.Changes:
com.posthog:posthogjar atMETA-INF/proguard/posthog.pro, next to the classes they keep. R8 reads rules from the jar, so the AAR and a plain jar dependency both get them. The rules only keep classes, so they can't change behavior on the JVM; the posthog-server tests pass.SurveyProgressandStoredSurveyResponserules as they are.PostHogKeepRulesTest. It walks the models with the SDK's own Gson instance and fails whenposthog.promisses a class that Gson handles by reflection, or names one that it doesn't..gitignoreexception, since the existingproguard/pattern ignored the new file.On the reflection point in the issue, I checked all reflection in the SDK, not only Gson. Only Gson reaches these two packages. The other reflection (
Class.forName,getMethod,Proxy) targets Compose, Firebase and the Compose survey delegate, which have their own rules that this PR doesn't touch. The enums in both packages are now renamed. That is safe because each one has a registered adapter that writes itsvalue, and the new test fails if an enum ever falls back to Gson's name-based adapter. Replacing Gson is worth its own issue if we want it.💚 How did you test it?
survey sentevent carried both responses.mapping.txt: the 22 classes keep their names and fields. The rest of both packages is renamed (trigger group models, enums,PostHogDisplay*classes).packaging.resources.excludes += "META-INF/**"still applies the rules../gradlew :posthog:test :posthog-android:testReleaseUnitTest :posthog-server:test spotlessCheck apiCheckpasses.RRMousePositionrule makesPostHogKeepRulesTestfail.android analyze --analysis=optimization, version 1.1.16919734, R8 9.5.17-dev),mainvs this branch:posthog-androidAAR: onmainit warns "Contains keep rules which do not target library code" and lists the 4 package-wide rules as unused, since the classes live in the core jar. That warning is gone here. The AAR now has only theSurveyProgressandStoredSurveyResponserules.posthogjar: no rules onmain. Here it keeps 22 of 364 classes, 41 of 3157 methods and 131 of 1222 fields (keep ratio 0.03).📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file🤖 Agent context
DRI: @ioannisj
Autonomy: Human-driven (agent-assisted)