Skip to content

chore!: make SDK-internal helpers non-public - #872

Open
turnipdabeets wants to merge 2 commits into
chore/v4-remove-deprecatedfrom
chore/v4-narrow-public-api
Open

turnipdabeets wants to merge 2 commits into
chore/v4-remove-deprecatedfrom
chore/v4-narrow-public-api

Conversation

@turnipdabeets

@turnipdabeets turnipdabeets commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Note

Stacked on the 4.0 integration PR #871. Merges into chore/v4-remove-deprecated, not main.

💡 Motivation and Context

Shrinks the public API for 4.0 by making SDK-internal helpers non-public. Matches PostHog/posthog-ios#874.

These were public only by accident. No other module in this repo uses them, and neither do the Flutter, React Native (posthog-js plugin and replay plugin) or KMP wrappers, checked against each wrapper's latest main:

  • CustomHeadersInterceptor, PostHogPrintLogger
  • PropertyGroupDeserializer, PropertyValueDeserializer
  • RRDocumentNode, RRDomContentLoadedEvent, RRLoadedEvent
  • personPropertiesContext(), findBestTranslationMatch(), PostHogPreferences.PUSH_SUBSCRIPTION_REJECTED, ThrowableCoercer.fromThrowableToPostHogProperties()
  • Bitmap.isValid(), Bitmap.webpBase64()
  • LogLine, LogcatParser (Java, so package-private)

Most other @PostHogInternal types can't become internal: Kotlin internal is per module, and they're used by posthog-android or posthog-server, or appear in a public signature (PostHogConfig, PostHogApi, PostHogReplayIntegration). The wrappers also use PostHogPreferences, PostHogSessionManager, PostHogSerializer, the RR replay types, base64 and getApplicationInfo, so those stay public. GzipRequestInterceptor stays public because sdk_compliance_adapter (a separate module that only its Dockerfile includes) constructs it.

💚 How did you test it?

  • All modules and their tests compile, including the Android sample.
  • ./gradlew :posthog:test :posthog-server:test :posthog-server-openfeature:test :posthog-android:testReleaseUnitTest :posthog-android-surveys-compose:testReleaseUnitTest pass.
  • apiDump regenerated.
  • sdk_compliance_adapter compiles when included the way its Dockerfile does.

📝 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 (adds a line to .changeset/android-v4-major.md)

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Claude Code (Claude Opus 5.5) listed every public declaration in an internal package or marked @PostHogInternal, searched the other modules and the wrapper repos for uses, and let the compiler reject candidates that a public signature still exposes (nine were reverted for that reason).

🤖 Generated with Claude Code

@turnipdabeets
turnipdabeets requested a review from a team as a code owner October 22, 2026 19:41
@turnipdabeets turnipdabeets self-assigned this Oct 22, 2026

@posthog posthog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 780200f: 1 Must fix.

Comment thread posthog/src/main/java/com/posthog/internal/GzipRequestInterceptor.kt Outdated
@turnipdabeets
turnipdabeets force-pushed the chore/v4-narrow-public-api branch from 66f5d4d to 937cc56 Compare October 23, 2026 15:47
@turnipdabeets
turnipdabeets force-pushed the chore/v4-remove-deprecated branch from 48776ff to 2f486a0 Compare October 23, 2026 15:47
@turnipdabeets
turnipdabeets force-pushed the chore/v4-remove-deprecated branch from 2f486a0 to a41d9b9 Compare October 26, 2026 16:29
@turnipdabeets
turnipdabeets force-pushed the chore/v4-narrow-public-api branch from 937cc56 to 97fba3d Compare October 26, 2026 16:29
@turnipdabeets
turnipdabeets force-pushed the chore/v4-remove-deprecated branch from a41d9b9 to caf64bd Compare October 26, 2026 18:47
turnipdabeets and others added 2 commits October 26, 2026 18:42
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) <[email protected]>
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) <[email protected]>
@turnipdabeets
turnipdabeets force-pushed the chore/v4-narrow-public-api branch from 97fba3d to 011a635 Compare October 26, 2026 23:05

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