Repository navigation
chore!: hide wrapper-only APIs behind SPI for v4 - #874
Merged
turnipdabeets merged 1 commit intoOct 5, 2026
Merged
Conversation
This was referenced Sep 30, 2026
turnipdabeets
force-pushed
the
chore/v4-internalize-wrapper-apis
branch
from
October 5, 2026 16:16
a93db4c to
c97ea7d
Compare
turnipdabeets
force-pushed
the
chore/v4-remove-deprecated
branch
from
October 5, 2026 16:16
6db44c0 to
9393686
Compare
Moves postHogSdkName, postHogVersion, PostHogSessionManager, PostHogStorageManager, PostHogConfig.storageManager, PostHogConfig.snapshotEndpoint, dateToMillis and imageToBase64 behind @_spi(PostHogInternal), and makes unused public helpers internal. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
turnipdabeets
force-pushed
the
chore/v4-internalize-wrapper-apis
branch
from
October 5, 2026 16:42
8c739c7 to
11a2791
Compare
turnipdabeets
marked this pull request as ready for review
October 5, 2026 16:57
Contributor
|
[High risk] Hides internal SDK APIs behind a sealed SPI barrier. The PR appears safe to merge based on the reviewed changes. Reviews (1) · Last reviewed commit: "chore!: hide wrapper-only APIs behind SP..." |
Contributor
posthog-ios Compliance ReportDate: 2026-10-05 17:01:12 UTC
|
| Test | Status | Duration |
|---|---|---|
| Format Validation.Event Has Required Fields | ✅ | 3495ms |
| Format Validation.Event Has Uuid | ✅ | 2944ms |
| Format Validation.Event Has Lib Properties | ✅ | 3008ms |
| Format Validation.Distinct Id Is String | ✅ | 3471ms |
| Format Validation.Token Is Present | ✅ | 2944ms |
| Format Validation.Custom Properties Preserved | ✅ | 3047ms |
| Format Validation.Event Has Timestamp | ✅ | 2942ms |
| Retry Behavior.Retries On 503 | ✅ | 11434ms |
| Retry Behavior.Does Not Retry On 400 | ✅ | 5194ms |
| Retry Behavior.Does Not Retry On 401 | ✅ | 5012ms |
| Retry Behavior.Respects Retry After Header | ✅ | 8074ms |
| Retry Behavior.Implements Backoff | ✅ | 21428ms |
| Retry Behavior.Retries On 500 | ✅ | 5739ms |
| Retry Behavior.Retries On 502 | ✅ | 5611ms |
| Retry Behavior.Retries On 504 | ✅ | 9965ms |
| Retry Behavior.Max Retries Respected | ❌ | 21886ms |
| Deduplication.Generates Unique Uuids | ✅ | 3389ms |
| Deduplication.Preserves Uuid On Retry | ✅ | 9527ms |
| Deduplication.Preserves Uuid And Timestamp On Retry | ✅ | 16834ms |
| Deduplication.Preserves Uuid And Timestamp On Batch Retry | ✅ | 8495ms |
| Deduplication.No Duplicate Events In Batch | ✅ | 3337ms |
| Deduplication.Different Events Have Different Uuids | ✅ | 3368ms |
| Compression.Sends Gzip When Enabled | ✅ | 2906ms |
| Batch Format.Uses Proper Batch Structure | ✅ | 2977ms |
| Batch Format.Flush With No Events Sends Nothing | ✅ | 470ms |
| Batch Format.Multiple Events Batched Together | ✅ | 3023ms |
| Error Handling.Does Not Retry On 403 | ✅ | 5005ms |
| Error Handling.Does Not Retry On 413 | ✅ | 4943ms |
| Error Handling.Retries On 408 | ✅ | 9241ms |
Failures
retry_behavior.max_retries_respected
Expected 4 requests, got 6
Feature_Flags Tests
✅ 16/16 tests passed
View Details
| Test | Status | Duration |
|---|---|---|
| Request Payload.Request With Person Properties Device Id | ✅ | 2937ms |
| Request Payload.Flags Request Uses V2 Query Param | ✅ | 2943ms |
| Request Payload.Flags Request Hits Flags Path Not Decide | ✅ | 2908ms |
| Request Payload.Flags Request Omits Authorization Header | ✅ | 3011ms |
| Request Payload.Token In Flags Body Matches Init | ✅ | 2856ms |
| Request Payload.Groups Round Trip | ✅ | 2985ms |
| Request Payload.Groups Default To Empty Object | ✅ | 3032ms |
| Request Payload.Person Properties Distinct Id Auto Populated When Caller Omits It | ✅ | 2974ms |
| Request Payload.Disable Geoip False Propagates As Geoip Disable False | ✅ | 3069ms |
| Request Payload.Disable Geoip Omitted Defaults To False | ✅ | 2957ms |
| Request Payload.Flag Keys To Evaluate Contains Only Requested Key | ✅ | 2951ms |
| Request Lifecycle.No Flags Request On Init Alone | ✅ | 129ms |
| Request Lifecycle.No Flags Request On Normal Capture | ✅ | 2942ms |
| Request Lifecycle.Two Flag Calls Produce Two Remote Requests | ✅ | 5788ms |
| Request Lifecycle.Mock Response Value Is Returned To Caller | ✅ | 2923ms |
| Side Effect Events.Get Feature Flag Captures Feature Flag Called Event | ✅ | 3253ms |
dustinbyrne
approved these changes
Oct 5, 2026
3 of 5 tasks
turnipdabeets
added a commit
that referenced
this pull request
Oct 7, 2026
Moves postHogSdkName, postHogVersion, PostHogSessionManager, PostHogStorageManager, PostHogConfig.storageManager, PostHogConfig.snapshotEndpoint, dateToMillis and imageToBase64 behind @_spi(PostHogInternal), and makes unused public helpers internal. Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
turnipdabeets
added a commit
that referenced
this pull request
Oct 9, 2026
Moves postHogSdkName, postHogVersion, PostHogSessionManager, PostHogStorageManager, PostHogConfig.storageManager, PostHogConfig.snapshotEndpoint, dateToMillis and imageToBase64 behind @_spi(PostHogInternal), and makes unused public helpers internal. Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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
Second PR in the 4.0 stack, on top of #873. It shrinks the public surface to what apps are meant to use, by hiding SDK internals that were public only so PostHog's wrapper SDKs could reach them.
Public API change: breaking, see the
api/posthog-ios.public-api.txtdiff. The snapshot does not record SPI symbols, so everything below shows as removed there.Moved behind
@_spi(PostHogInternal):postHogSdkName,postHogVersionPostHogSessionManagerPostHogStorageManager,PostHogConfig.storageManagerPostHogConfig.snapshotEndpointdateToMillis(_:),imageToBase64(_:_:)Made internal, because no wrapper uses them:
toISO8601String(_:),toISO8601Date(_:),sanitizeDictionary(_:),deleteSafely(_:),postHogiOSSdkNameGzip,GzipError,CompressionLevelReachabilityErrorUIColor.init(hex:),UIColor.hexDescription(_:)None of these symbols appear in the posthog.com docs.
Effect on wrapper SDKs
@_spi(PostHogInternal).@_spi(PostHogInternal).import PostHog, so it would not compile against 4.0. The repo is archived and pins posthog-ios to 3.58.x, so it cannot resolve 4.0.Third-party wrappers that set
postHogSdkNameorpostHogVersionneed@_spi(PostHogInternal) import PostHog.Things reviewers may want to weigh in on:
postHogVersionis now SPI, so an app reading the SDK version with a plain import loses access.@objcmembers from Objective-C, so this PR also drops@objcfromPostHogSessionManager.shared,setSessionId(_:)andPostHogConfig.snapshotEndpoint. The generatedPostHog-Swift.hnow only declares an emptyPostHogSessionManagerclass (it is still anNSObjectsubclass). The wrappers call these from Swift.@testable importdoes not grant SPI access, so the tests and the compliance adapter now import with@_spi(PostHogInternal). The compliance adapter readspostHogSdkName, sincepostHogiOSSdkNameis now internal.PostHogExample's "Restart & Rotate Session Id" button now usesendSession()/startSession()instead ofPostHogSessionManager, so the example doesn't show the SPI import.💚 How did you test it?
make testpasses locally (909 tests, macOS).xcodebuild testand an explicit simulator id rather thanmake testOniOSSimulator.make apiCheckreports the snapshot up to date.example-rn-native-pluginapp builds for the iOS simulator against this branch, CocoaPods path only.make buildfor tvOS, watchOS, visionOS and the other example apps. posthog-kmp was not compiled against this branch.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset fileThe changeset is
majorand was written by hand in the changeset format.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
internalotherwise. App-facing API that wrappers also happen to use (startSession,endSession,isSessionReplayActive, the survey display types, theURLSession.postHog*helpers) is left public.🤖 Generated with Claude Code