Skip to content

chore!: iOS Major Release 4.0 - #873

Draft
turnipdabeets wants to merge 90 commits into
mainfrom
chore/v4-remove-deprecated
Draft

turnipdabeets wants to merge 90 commits into
mainfrom
chore/v4-remove-deprecated

Conversation

@turnipdabeets

@turnipdabeets turnipdabeets commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Important

This is the posthog-ios 4.0 integration PR. Don't merge it until every item under "Before release" is done. It targets main without changesets pre mode, so merging it publishes 4.0.0. "Release day" and "After release" items don't block the merge. Every stacked 4.0 PR merges into this branch (chore/v4-remove-deprecated), and this PR brings them into main at once. The branch carries one changeset, .changeset/v4-major-release.md.

Closes #557
Closes #472

💡 Motivation and Context

posthog-ios 4.0:

  • Analytics events go to capture v1 (/i/v1/analytics/events) with Authorization: Bearer, and the new captureAi sends AI events to /i/v1/ai/events. There's no /batch fallback.
  • Per-event capture options, and one property precedence: SDK-set, then super properties, then event properties, then beforeSend.
  • APIs deprecated in 3.x are removed, the feature flags callbacks change, and session replay always records masked screenshots.
  • Swift Package Manager only, with iOS 15, macOS 11, tvOS 15 and watchOS 10 minimums and Xcode 26. Replay, crash reporting and surveys are package traits you can turn off.

The upgrade guide is MIGRATION.md, sorted into Before, During and Follow ups. It's also served at /docs/libraries/ios/migration.

Public API change: breaking, see the api/posthog-ios.public-api.txt diff. Removed and renamed 3.x APIs fail to compile with an error naming the replacement (#977).

Docs and onboarding that ship with this release (merge once 4.0.0 is tagged on GitHub):

What gets released

Artifact Bump Notes
posthog-ios (Swift Package Manager) 3.98.0 → 4.0.0 The tag the release workflow pushes.
PostHog pod (CocoaPods) not released 4.x isn't published to CocoaPods (#972). CocoaPods trunk goes read-only on 2026-12-02, so a 4.x pod would stop updating within weeks, and pod builds always compile every trait in. 3.x stays on CocoaPods. The README, changeset and guide say so.

Wrappers stay on 3.x until their own majors adopt 4.0: posthog_flutter main pins < 4.0.0, the React Native plugin pins ~> 3.92.7, and both import posthog-ios with @_spi(PostHogInternal).

Wrapper Release PR Adopts posthog-ios 4.0 Docs
posthog_flutter 6.0 PostHog/posthog-flutter#637 PostHog/posthog-flutter#649 (merged into feat/v6-desktop-capture-v1) PostHog/posthog.com#20924
@posthog/react-native-plugin 3.0 PostHog/posthog-js#5194 PostHog/posthog-js#5237, #5236 (drops screenshotMode) and #5449 (SPM by default), merged into the release branch; PostHog/posthog-js#5734 (captureMethod) is open PostHog/posthog.com#20922
posthog-kmp PostHog/posthog-kmp#108 same PR

React Native cost of SPM only: the plugin's minimum React Native rises from 0.71 to 0.75 (the first with spm_dependency), and its 3.0 makes SPM the default (#5449). No Podfile linkage or Expo change is needed. posthog-js#5237 turns the Surveys trait off in the plugin's Package.swift, but the plugin still sets config.surveys = false, which only compiles with the trait. Guard that line with a define only the plugin's Package.swift sets, since spm_dependency can't pass traits.

Merged into this branch

PR Change
this PR's first commit Remove deprecated APIs: apiKey, propertiesSanitizer, evaluationEnvironments, remoteConfig, getFeatureFlagPayload(_:), debouncerDelay, maskPhotoLibraryImages
#876, #906 iOS 15, macOS 11, tvOS 15 and watchOS 10 minimums
#898 Xcode 26 / swift-tools-version: 6.2; Package@swift-5.9.swift removed
#916, #975, #981, #968 SessionReplay, CrashReporting and Surveys traits, on by default; a trait that's off also removes its public API, snapshotted in CI
#874 Wrapper-only APIs behind @_spi(PostHogInternal)
#890 Remove PostHogDataMode.cellular
#912 Rename console log types to PostHogConsoleLog*
#875 Drop 2.x queue files and their top-level $set; 3.x migrations are kept
#905 Drop legacy version and build from lifecycle events
#913 reloadFeatureFlags callback receives a PostHogFeatureFlagsLoaded
#903 Malformed flag payloads return nil
#909 Replace the vendored Reachability with NWPathMonitor
#907, #973 Remove wireframe replay capture and screenshotMode
#937, #1052 Remove, then restore screenshotModeBackgroundCapture (still experimental)
#965 Remove the didReceiveFeatureFlags notification; use onFeatureFlags(_:)
#974 setBeforeSend(_:) accepts plain closure arrays instead of trapping at runtime
#976 Replay masks cover content drawn outside a masked view's bounds (also released in 3.93.1, so not in the changeset)
#977 unavailable fix-its for removed and renamed APIs
#1071 Replace screenshotModeBackgroundCapture and screenshotModeGPUCapture with captureMethod (.standard, .background, .gpu); both old options get unavailable stubs
#1087 Error tracking marks frames from frameworks other than the app's executable as not in-app by default (inAppByDefault = false). f60b76b85 tells upgraders to append to inAppIncludes: assigning it drops the app's own entries, so its frames stop being in-app
#1080 The 4.0 side of #1079: handled-error stack traces start at the caller
#1001 isFeatureEnabled(_:defaultValue:)
#1027 setSdkName(_:version:) (SPI, Objective-C) for wrapper SDKs
#1045 registerOptionsForWrapper(_:) / unregisterOptionsForWrapper(_:) (SPI, Objective-C)
#938 Capture v1, per-event options, property precedence, captureAi (#939), no /batch fallback (#940), $locale/$app_language (#1009), maxRetries → pushNotificationSubscriptionMaxRetries, and the capture v1 fixes (#1018, #1019, #1025, #1026)
#1036, #1050 Keep $lib and $lib_version per event, filled last and as a pair; skip the person-properties hash for updates that may be personless
#1037 An empty-string variant reads as disabled
#1047 Omit NSNull and nil event properties
#1067, #1053 A registered $process_person_profile no longer applies to $identify, $create_alias, $merge_dangerously, $groupidentify, $set and $set_once
#972 SPM-only release, RELEASING.md and the CocoaPods notice
#910 Text and names left stale by the 4.0 changes
#978, #980, #1061 MIGRATION.md for all of 4.0, sorted by when you make each change, plus docs/getting-started.md for the generated reference

main is merged in up to 3.96.2 plus #911 and #966 (experimental GPU capture, off by default): #1059 (failed flag records), #1063 (background-capture masks), #1042 and #1043 (surveys). 3.x changesets were released from main, so they aren't repeated in the 4.0 changeset. Where they met 4.0, 4.0's shape is kept: a failed flag's $feature_flag_called omits $feature_flag_response instead of sending null (06d91a9e8), which the guide's "Check null properties" covers.

main is then merged up to 3.97.0 (ef45d7b59): only the release commit, whose screenshotModeGPUCapture changeset was released from main. The podspec stays deleted.

main is now merged up to c493586e4 (b6e42b06c): 3.97.1, 3.97.2 and 3.98.0 (#1054, #1064, #1068, #1069, #1075, #1078, #1079/#1086, #1074), #1082 and #1089 (CI and tests). 3.98.0's changesets were released from main, so they aren't in the 4.0 changelog. The podspec stays deleted and postHogVersion stays behind @_spi(PostHogInternal).

Left in place on purpose:

  • The internal PostHogEvent.apiKey and PostHogRemoteConfig.getFeatureFlagPayload, and PostHogConfig(apiKey:) in scripts/downgrade-compatibility-smoke, which compiles against 3.48.0.
  • The storage migrations migrateLegacyStorage (3.20) and mergeLegacyContainerIfNeeded (3.27). Removing them would lose the distinct ID and queued events for apps updating straight from an older version: in the last 7 days (US), about 8% of iOS SDK end users were on an app build older than 3.27. We'll revisit in a later major.

sdk-specs: 4.0 implements the capture v1 contract (PostHog/sdk-specs#146, #147) and the property precedence from PostHog/sdk-specs#143. #938 lists where iOS differs from the spec. PostHog/sdk-specs#187 (4.0 compliance audit) is merged.

Before release

Release day, after 4.0.0 is tagged

After release

Found in testing, not 4.0 regressions

The 2026-11-05 device run turned up three things that behave the same in 3.93.6. None blocks 4.0:

  • Session replay records only the key window, and surveys show in their own window above it, so a survey popover never appears in a recording.
  • optOut() then optIn() logs "Failed to enable PHPLCrashReporter: A PLCrashReporter instance has already been enabled". Crash reporting keeps working.
  • identify(_:) on an already identified user with a different ID is ignored until reset(), as in 3.x.

💚 How did you test it?

2026-11-12, iPhone 17 Pro simulator (iOS 26.4), at 79325748a, through a logging proxy to PostHog Cloud (US), covering what merged after the 2026-11-05 run:

2026-11-05: all runs at 91118b1 (after #938 and #1027 merged). The two commits after it change only docs and the harness pin.

CI: every check is green on 91118b1: build (iOS, macOS, tvOS, watchOS, visionOS, SPM, no-traits, minimum toolchain Xcode 26.0.1), test, test-no-traits, the three test-ios-simulator jobs, replay masking snapshots, public API snapshot, examples, downgrade compatibility (3.48.0, 3.48.3, 3.58.0), lint.

SDK compliance harness: 234/234 on harness 1.26.0 in CI (all capture v1, AI and flags suites). Locally on harness 1.28.0, the latest release: also 234/234, so this PR bumps the pin to 1.28.0. 1.27.0 and 1.28.0 only touch feature flag rules v2 contracts and add a feature_flags_v4 suite that iOS doesn't opt into.

End to end against PostHog Cloud (US), on an iPhone 14 Pro Max (iOS 26.5.2) and an iPhone 17 simulator (iOS 26.4). A scripted probe in the example app (behind a launch argument, not committed) drove the SDK; every result below was checked in the ingested data with SQL, not just in the app log.

Area What was checked Result
Upgrade from 3.93.6 The 3.93.6 example app identified a user and queued 21 events against an unreachable host. 4.0 installed over it on the same storage. All 21 events arrived with their 3.x session ID, distinct ID and super property. The distinct and anonymous IDs carried over. Application Updated has previous_version 3.93. A 3.x event with $process_person_profile: false arrived as full, because 3.93.6 had already stored true for an identified user.
Capture v1 capture with properties, timestamp: (−1 h), options: ["process_person_profile": false], the legacy $process_person_profile property, screen, identify, alias, group, setPersonProperties, register/unregister, a 300 KB event, a 120-event burst All arrived. The backdated timestamp is stored, both personless forms are stored as propertyless, nested number and bool keys arrive as strings, super properties apply and stop after unregister.
Dropped events beforeSend returning nil, a 250-byte distinct ID, capture while opted out None arrived. PostHog reported distinct_id_too_large: 1 in the per-event results. A beforeSend edit arrived.
captureAi $ai_generation on /i/v1/ai/events Arrived; the stored UUID matches the one captureAi returned.
$locale / $app_language Default, setAppLanguage("fr-CA"), setAppLanguage(nil) $locale is en-US (3.x sent en). $app_language is en, fr-CA after the override, and en after the reset.
Feature flags Boolean and multivariate flags with payloads, a missing flag, isFeatureEnabled(_:defaultValue:), setPersonPropertiesForFlags with reloadFeatureFlags { result in }, onFeatureFlags Values and payloads correct. A missing flag returns the default passed. The reload callback reports the new flag set, and a person-property-gated flag turns on. $feature_flag_called and $experiment_exposure arrived.
Lifecycle Install, update, open, background, foreground Application Installed, Updated, Opened and Backgrounded arrived, without version and build.
Error tracking captureException (handled) and two Swift runtime traps, one of them after optOut()/optIn() The handled error arrived as error. Each crash arrived as a fatal, unhandled $exception with the Swift message on the next launch.
Logs captureLog Arrived in Logs with its attributes, distinct ID and screen name.
Surveys An event-triggered popover survey survey shown arrived for the survey on device and simulator.
Session replay Recording through a screen with a plain label, a ph-no-capture label, a text field, a secure field and an image; the uploads were captured through a local proxy and decoded Recordings ingested (mobile, posthog-ios). Text, both text fields and the masked label are masked; the SF Symbol stays visible, which is intended. Network and console plugins start from remote config.
Reachability (NWPathMonitor) Device only, toggling Airplane Mode and Wi-Fi: going offline in the foreground, offline in the background with the reconnect while backgrounded, and launching while offline The queue pauses while unreachable and sends the backlog once the path is satisfied. 40/40, 12/12 and 47 queued events arrived without gaps.

Not run: make test locally (CI covers it on this head), the macOS, tvOS, watchOS and visionOS apps on devices (CI builds them; #938 ran macOS end to end), and touch autocapture ($autocapture) on device.

Not re-run on device since: #1071 (captureMethod), #1087 (in-app default), #1080 and #1074. CI was green on 066e517ec (48 checks), before the 3.98.0 merge.

Before that: CI is green on 06d91a9e8 (48 checks), which adds #1061 (docs), #1067 (registered personless setting off identity events), main up to 3.96.2 (#1059, #1063, #1042, #1043) and the experimental GPU capture (#911, #966). The device runs weren't repeated on it.

📝 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

The changeset is major and was written by hand. Its 3.x-only entries were released from main, so they aren't repeated. The release workflow runs on main, so merging this PR publishes 4.0.0.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Claude Code (Opus 5.5) wrote the stacked PRs and ran the release reviews and device tests above. The end-to-end probe and the decoded replay frames stay local and aren't committed.

🤖 Generated with Claude Code

@turnipdabeets turnipdabeets self-assigned this Sep 30, 2026

@greptile-apps greptile-apps 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.

This review was skipped because it would exceed your organization's monthly flex usage limit. Raise the limit in billing settings or wait until the next billing period resets limits.

@github-actions

github-actions Bot commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

posthog-ios Compliance Report

Date: 2026-11-17T17:41:24.161579+00:00
Duration: 966310ms

✅ All Tests Passed!

234/234 tests passed


Capture_V1 Tests

✅ 106/106 tests passed

View Details
Test Status Duration
Endpoint And Method.Targets V1 Endpoint ✅ 3026ms
Endpoint And Method.Does Not Use Legacy Endpoints ✅ 2905ms
Required Headers.Has Authorization Bearer Header ✅ 2878ms
Required Headers.Has Content Type Json ✅ 2851ms
Required Headers.Has Posthog Sdk Info Format ✅ 2820ms
Required Headers.Has Posthog Attempt Header ✅ 2796ms
Required Headers.Has Posthog Request Id ✅ 378ms
Required Headers.Has Posthog Request Timestamp ✅ 498ms
Required Headers.Has User Agent ✅ 2832ms
Body Format.Body Has Created At And Batch ✅ 2844ms
Body Format.No Api Key In Body ✅ 2901ms
Body Format.No Sent At In Body ✅ 367ms
Event Format.Event Has Required Root Fields ✅ 2896ms
Event Format.Event Uuid Is Valid ✅ 2866ms
Event Format.Event Timestamp Is Rfc3339 ✅ 2858ms
Event Format.Non Utc Event Timestamp Is Converted To Utc ✅ 2786ms
Event Format.Distinct Id Is String ✅ 2822ms
Event Format.Distinct Id At Root Not Properties ✅ 2794ms
Event Format.Custom Properties Preserved ✅ 2891ms
Event Format.Set Properties Preserved ✅ 2842ms
Event Format.Set Once Properties Preserved ✅ 446ms
Event Format.Groups Properties Preserved ✅ 2816ms
Event Format.Sdk Generates Uuid If Not Provided ✅ 446ms
Event Format.Event Has Required Root Fields Batch ✅ 2955ms
Event Format.Event Uuid Is Valid Batch ✅ 2887ms
Event Format.Event Timestamp Is Rfc3339 Batch ✅ 2871ms
Event Format.Distinct Id Is String Batch ✅ 2956ms
Event Format.Distinct Id At Root Not Properties Batch ✅ 623ms
Event Format.Custom Properties Preserved Batch ✅ 2947ms
Event Format.Set Properties Preserved Batch ✅ 429ms
Event Format.Set Once Properties Preserved Batch ✅ 2933ms
Event Format.Groups Properties Preserved Batch ✅ 2968ms
Event Format.Sdk Generates Uuid If Not Provided Batch ✅ 2906ms
Batch Behavior.Multiple Events In Single Batch ✅ 3022ms
Batch Behavior.Batch Envelope Smoke ✅ 543ms
Batch Behavior.Flush With No Events Sends Nothing ✅ 326ms
Batch Behavior.Flush At Triggers Batch ✅ 1215ms
Batch Behavior.Created At Reflects Batch Creation Time ✅ 2908ms
Deduplication.Generates Unique Uuids ✅ 3058ms
Deduplication.Different Events Same Content Different Uuids ✅ 2941ms
Deduplication.Preserves Uuid On Retry ✅ 9420ms
Deduplication.Preserves Timestamp On Retry ✅ 9297ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 7899ms
Deduplication.No Duplicate Events In Batch ✅ 2927ms
Header Behavior On Retry.Attempt Header Starts At One ✅ 444ms
Header Behavior On Retry.Attempt Header Increments On Retry ✅ 16785ms
Header Behavior On Retry.Request Id Preserved On Retry ✅ 9279ms
Header Behavior On Retry.Different Requests Have Different Request Ids ✅ 7530ms
Header Behavior On Retry.Request Timestamp Changes On Retry ✅ 5460ms
Response Format Validation.Success Response Has Uuid Keyed Results ✅ 2813ms
Response Format Validation.Success Response Has Ok For Each Event ✅ 2820ms
Response Format Validation.Success No Retry After When All Ok ✅ 2833ms
Response Format Validation.Success Retry After Present When Retry Events ✅ 2901ms
Response Format Validation.Success No Retry After When Drop Only ✅ 2941ms
Response Format Validation.Response Echoes Request Id ✅ 2750ms
Retry Behavior.Retries On 408 ✅ 9316ms
Retry Behavior.Retries On 500 ✅ 9345ms
Retry Behavior.Retries On 503 ✅ 11867ms
Retry Behavior.Retries On 504 ✅ 9258ms
Retry Behavior.Retries On 404 ✅ 9332ms
Retry Behavior.Retries On 429 ✅ 9296ms
Retry Behavior.Retries On 502 ✅ 9271ms
Retry Behavior.Retryable Errors Have Retry After ✅ 2422ms
Retry Behavior.Respects Retry After On Retryable Error ✅ 10813ms
Retry Behavior.Does Not Retry On 400 ✅ 4814ms
Retry Behavior.Does Not Retry On 401 ✅ 4776ms
Retry Behavior.Does Not Retry On 402 ✅ 2475ms
Retry Behavior.Does Not Retry On 413 ✅ 4852ms
Retry Behavior.Does Not Retry On 415 ✅ 4885ms
Retry Behavior.Non Retryable Errors Have No Retry After ✅ 2461ms
Retry Behavior.Implements Backoff ✅ 12435ms
Partial Batch Handling.Handles 200 Full Success ✅ 4754ms
Partial Batch Handling.Handles 200 With All Ok ✅ 5859ms
Partial Batch Handling.Does Not Retry Dropped Events ✅ 5833ms
Partial Batch Handling.Does Not Retry Warning Events ✅ 5781ms
Partial Batch Handling.Prunes Ok Events On Partial Retry ✅ 7926ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry ✅ 7906ms
Partial Batch Handling.Retries Only Retry Events From Partial ✅ 7933ms
Partial Batch Handling.Partial Retry Preserves Uuids ✅ 7901ms
Partial Batch Handling.Partial Retry Attempt Header Increments ✅ 7818ms
Partial Batch Handling.Partial Retry Request Id Preserved ✅ 7901ms
Partial Batch Handling.Respects Retry After On Partial ✅ 7835ms
Partial Batch Handling.Unknown Result Treated As Terminal ✅ 6005ms
Partial Batch Handling.Mixed Ok Drop Warning No Retry ✅ 5802ms
Compression.Sends Gzip Content Encoding ✅ 409ms
Compression.No Content Encoding When Disabled ✅ 354ms
Compression.Compressed Body Is Decompressible ✅ 2667ms
Error Handling.Does Not Retry On Unknown 4Xx ✅ 4735ms
Event Options.Cookieless Mode Override ✅ 2793ms
Event Options.Disable Skew Correction Override ✅ 2885ms
Event Options.Process Person Profile Override ✅ 2698ms
Event Options.Product Tour Id Override ✅ 2918ms
Event Options.Unset Options Omitted ✅ 2669ms
Event Options.Options Override In Batch ✅ 2826ms
Event Options.Unknown Option Passes Through ✅ 373ms
Event Options.Option Value Is Not Converted ✅ 394ms
Event Options.Lenient Bool Option Values Are Not Converted ✅ 264ms
Event Options.Option Wins Over Legacy Property ✅ 2717ms
Event Options.Legacy Property Fills Unset Option ✅ 2792ms
Event Options.Null Option Falls Back To Legacy Property ✅ 2802ms
Property Layers.Caller Property Beats Registered Property ✅ 2801ms
Property Layers.Before Send Runs Last ✅ 2731ms
Fail Open.Empty Api Key Sends Nothing ✅ 1304ms
Fail Open.Personal Api Key Sends Nothing ✅ 1374ms
Geoip And Historical Migration.Geoip Disable Injected Into Properties ✅ 2807ms
Geoip And Historical Migration.Historical Migration Absent By Default ✅ 417ms

Capture_Ai_V1 Tests

✅ 111/111 tests passed

View Details
Test Status Duration
Endpoint And Method.Targets V1 Endpoint ✅ 2861ms
Endpoint And Method.Does Not Use Legacy Endpoints ✅ 2901ms
Endpoint And Method.Capture Does Not Reroute Ai Named Events ✅ 2868ms
Endpoint And Method.Capture Ai Does Not Reroute Non Ai Events ✅ 2762ms
Lane Isolation.Failing Ai Lane Does Not Delay Analytics ✅ 11338ms
Required Headers.Has Authorization Bearer Header ✅ 2863ms
Required Headers.Has Content Type Json ✅ 2813ms
Required Headers.Has Posthog Sdk Info Format ✅ 2865ms
Required Headers.Has Posthog Attempt Header ✅ 2756ms
Required Headers.Has Posthog Request Id ✅ 2812ms
Required Headers.Has Posthog Request Timestamp ✅ 2759ms
Required Headers.Has User Agent ✅ 2923ms
Body Format.Body Has Created At And Batch ✅ 318ms
Body Format.No Api Key In Body ✅ 2785ms
Body Format.No Sent At In Body ✅ 2803ms
Event Format.Event Has Required Root Fields ✅ 2766ms
Event Format.Event Uuid Is Valid ✅ 2859ms
Event Format.Event Timestamp Is Rfc3339 ✅ 2805ms
Event Format.Non Utc Event Timestamp Is Converted To Utc ✅ 2878ms
Event Format.Distinct Id Is String ✅ 2823ms
Event Format.Distinct Id At Root Not Properties ✅ 418ms
Event Format.Custom Properties Preserved ✅ 2763ms
Event Format.Set Properties Preserved ✅ 2706ms
Event Format.Set Once Properties Preserved ✅ 2776ms
Event Format.Groups Properties Preserved ✅ 2667ms
Event Format.Sdk Generates Uuid If Not Provided ✅ 2865ms
Event Format.Event Has Required Root Fields Batch ✅ 2867ms
Event Format.Event Uuid Is Valid Batch ✅ 2838ms
Event Format.Event Timestamp Is Rfc3339 Batch ✅ 2865ms
Event Format.Distinct Id Is String Batch ✅ 511ms
Event Format.Distinct Id At Root Not Properties Batch ✅ 2876ms
Event Format.Custom Properties Preserved Batch ✅ 2911ms
Event Format.Set Properties Preserved Batch ✅ 2850ms
Event Format.Set Once Properties Preserved Batch ✅ 518ms
Event Format.Groups Properties Preserved Batch ✅ 526ms
Event Format.Sdk Generates Uuid If Not Provided Batch ✅ 542ms
Batch Behavior.Multiple Events In Single Batch ✅ 2962ms
Batch Behavior.Batch Envelope Smoke ✅ 2951ms
Batch Behavior.Flush At Triggers Batch ✅ 1408ms
Batch Behavior.Created At Reflects Batch Creation Time ✅ 2809ms
Deduplication.Generates Unique Uuids ✅ 3032ms
Deduplication.Different Events Same Content Different Uuids ✅ 2860ms
Deduplication.Preserves Uuid On Retry ✅ 5478ms
Deduplication.Preserves Timestamp On Retry ✅ 9332ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 7929ms
Deduplication.No Duplicate Events In Batch ✅ 2987ms
Header Behavior On Retry.Attempt Header Starts At One ✅ 2707ms
Header Behavior On Retry.Attempt Header Increments On Retry ✅ 16816ms
Header Behavior On Retry.Request Id Preserved On Retry ✅ 9227ms
Header Behavior On Retry.Different Requests Have Different Request Ids ✅ 7365ms
Header Behavior On Retry.Request Timestamp Changes On Retry ✅ 9338ms
Response Format Validation.Success Response Has Uuid Keyed Results ✅ 2742ms
Response Format Validation.Success Response Has Ok For Each Event ✅ 2953ms
Response Format Validation.Success No Retry After When All Ok ✅ 2905ms
Response Format Validation.Success Retry After Present When Retry Events ✅ 2850ms
Response Format Validation.Success No Retry After When Drop Only ✅ 2860ms
Response Format Validation.Response Echoes Request Id ✅ 2830ms
Retry Behavior.Retries On 408 ✅ 9206ms
Retry Behavior.Retries On 500 ✅ 9360ms
Retry Behavior.Retries On 503 ✅ 11391ms
Retry Behavior.Retries On 504 ✅ 9280ms
Retry Behavior.Retries On 404 ✅ 9288ms
Retry Behavior.Retries On 429 ✅ 8792ms
Retry Behavior.Retries On 502 ✅ 9288ms
Retry Behavior.Retryable Errors Have Retry After ✅ 6253ms
Retry Behavior.Respects Retry After On Retryable Error ✅ 10843ms
Retry Behavior.Does Not Retry On 400 ✅ 4759ms
Retry Behavior.Does Not Retry On 401 ✅ 4833ms
Retry Behavior.Does Not Retry On 402 ✅ 4834ms
Retry Behavior.Does Not Retry On 413 ✅ 4699ms
Retry Behavior.Does Not Retry On 415 ✅ 4816ms
Retry Behavior.Non Retryable Errors Have No Retry After ✅ 4827ms
Retry Behavior.Implements Backoff ✅ 12418ms
Partial Batch Handling.Handles 200 Full Success ✅ 4797ms
Partial Batch Handling.Handles 200 With All Ok ✅ 5958ms
Partial Batch Handling.Does Not Retry Dropped Events ✅ 5918ms
Partial Batch Handling.Does Not Retry Warning Events ✅ 5897ms
Partial Batch Handling.Prunes Ok Events On Partial Retry ✅ 7909ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry ✅ 7832ms
Partial Batch Handling.Retries Only Retry Events From Partial ✅ 7796ms
Partial Batch Handling.Partial Retry Preserves Uuids ✅ 7966ms
Partial Batch Handling.Partial Retry Attempt Header Increments ✅ 7801ms
Partial Batch Handling.Partial Retry Request Id Preserved ✅ 7905ms
Partial Batch Handling.Respects Retry After On Partial ✅ 7902ms
Partial Batch Handling.Unknown Result Treated As Terminal ✅ 5891ms
Partial Batch Handling.Mixed Ok Drop Warning No Retry ✅ 5907ms
Compression.Sends Gzip Content Encoding ✅ 2885ms
Compression.No Content Encoding When Disabled ✅ 2718ms
Compression.Compressed Body Is Decompressible ✅ 2849ms
Error Handling.Does Not Retry On Unknown 4Xx ✅ 4729ms
Event Options.Cookieless Mode Override ✅ 2866ms
Event Options.Disable Skew Correction Override ✅ 2871ms
Event Options.Process Person Profile Override ✅ 483ms
Event Options.Product Tour Id Override ✅ 2840ms
Event Options.Unset Options Omitted ✅ 430ms
Event Options.Options Override In Batch ✅ 2771ms
Event Options.Unknown Option Passes Through ✅ 2864ms
Event Options.Option Value Is Not Converted ✅ 2777ms
Event Options.Lenient Bool Option Values Are Not Converted ✅ 2849ms
Event Options.Option Wins Over Legacy Property ✅ 313ms
Event Options.Legacy Property Fills Unset Option ✅ 2818ms
Event Options.Null Option Falls Back To Legacy Property ✅ 2874ms
Event Size.Event Over Ceiling Is Not Sent ✅ 6933ms
Event Size.Over Ceiling Drop Is Reported Or Logged Without Content ✅ 2734ms
Event Size.Batches Close Before Byte Target ✅ 8591ms
Geoip And Historical Migration.Geoip Disable Injected Into Properties ✅ 2863ms
Geoip And Historical Migration.Historical Migration Absent By Default ✅ 329ms
Property Layers.Caller Property Beats Registered Property ✅ 2761ms
Property Layers.Before Send Runs Last ✅ 2800ms
Fail Open.Empty Api Key Sends Nothing ✅ 1290ms
Fail Open.Personal Api Key Sends Nothing ✅ 1254ms

Feature_Flags Tests

✅ 17/17 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id ✅ 2827ms
Request Payload.Flags Request Uses V2 Query Param ✅ 2859ms
Request Payload.Flags Request Hits Flags Path Not Decide ✅ 2923ms
Request Payload.Flags Request Omits Authorization Header ✅ 2813ms
Request Payload.Token In Flags Body Matches Init ✅ 2744ms
Request Payload.Groups Round Trip ✅ 2898ms
Request Payload.Groups Default To Empty Object ✅ 2855ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False ✅ 2769ms
Request Payload.Disable Geoip Omitted Defaults To False ✅ 2908ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key ✅ 2875ms
Request Lifecycle.No Flags Request On Init Alone ✅ 114ms
Request Lifecycle.No Flags Request On Normal Capture ✅ 2861ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests ✅ 5569ms
Request Lifecycle.Mock Response Value Is Returned To Caller ✅ 2733ms
Retry Behavior.Retries Flags On 502 ✅ 2840ms
Retry Behavior.Retries Flags On 504 ✅ 2862ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event ✅ 3079ms

@greptile-apps

greptile-apps Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Retrigger

[High risk] Removes public API surface for iOS SDK major version.

The PR appears safe to merge; no actionable regression was identified.

Reviews (1) · Last reviewed commit: "chore!: remove deprecated public APIs fo..."

@eli-r-ph

Copy link
Copy Markdown

#if os(iOS) || TESTING
// A survey still waiting out its popup delay belongs to the previous user.
let surveyIntegrations = setupLock.withLock { installedIntegrations.compactMap { $0 as? PostHogSurveyIntegration } }
surveyIntegrations.forEach { $0.cancelPendingSurvey() }

Merging main brought in the survey reset code from #1049 under #if os(iOS) || TESTING. On 4.0, PostHogSurveyIntegration is only built with the Surveys trait (#if os(iOS) && (!SWIFT_PACKAGE || Surveys)), so builds without that trait fail with cannot find type 'PostHogSurveyIntegration'. The guard needs to match.

turnipdabeets and others added 3 commits November 10, 2026 08:58
… fill $lib as a pair (#1050)

* fix: skip the person-properties hash for maybe-personless updates and fill $lib as a pair

The hash guard read only the process_person_profile option, but a registered
or legacy $process_person_profile false is hoisted into options later, at send.
Such a $set recorded a hash it couldn't apply, so the same update sent after
unregistering was dropped as a duplicate. Resolve the setting the way it's sent
(non-null option, then the legacy property) and record a hash only when it's
missing or a Boolean true.

Fill the SDK's $lib and $lib_version as a pair after the caller's properties,
per sdk-specs #146: another library's $lib never gets this SDK's version, and a
$lib_version without a $lib is replaced.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: clear the person-properties hash when queueing a maybe-personful update

An update whose setting isn't a clear Boolean, such as the string "true",
skipped the hash but left the previous one in place. PostHog may still apply
it, so a later update back to the previous properties was dropped as a
duplicate. Clear the stored hash instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…cated

Brings in #1048 (drop flag loads in flight across reset()). PostHogRemoteConfig.swift
and its tests take the 4.0 resolution from #1044 (fix/v4-drop-flag-loads-across-reset),
which keeps 4.0's FeatureFlagsLoadResult callback and the removed didReceiveFeatureFlags.
PostHog.podspec stays deleted.
@turnipdabeets

Copy link
Copy Markdown
Contributor Author

Fixed in e27cbe4, the reset now uses the Surveys trait guard.

eli-r-ph and others added 7 commits November 10, 2026 17:10
…etting (#1053)

* docs: show how to keep identity calls under a registered personless setting

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: point registered personless users to identifiedOnly and note billing

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Anna Garcia <anna.g@posthog.com>
* feat: keep screenshotModeBackgroundCapture in 4.0

Reverts #937. GPU capture (#911) stays experimental and off by default,
so the main-thread drawHierarchy path remains the default in 4.0 and
background capture is the only off-main option. It unblocks the
main-thread hangs reported in #1035.

Drops the removed-API stub, the migration-guide row and the changeset
mention, and restores the public API snapshot line.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(replay): skip hidden or transitioning windows before background capture

Background capture walked the hierarchy twice and rendered the window
before prepareScreenshotWireframe discarded the frame during a view
controller transition. Check visibility and transition state first, as
scheduleSettledCapture already does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore: order the restored screenshotModeBackgroundCapture snapshot line

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(replay): release background-capture mask samples on the main thread

MaskedRegion retains its view, so the before sample could hold the last
reference to a view and release it on the replay queue, running UIKit
teardown off main. Drop it inside the second main.sync instead.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
RRWireframe only builds with SessionReplay in 4.0, so the no-traits test build failed on the tests main added in #1028.
4.0 renamed RRWireframe to RRScreenshotFrame, so the iOS test build failed on the tests from #1028. This replaces the trait gating from the previous two commits, which was the wrong fix: the type is not trait-gated.
Capture v1 moved to /docs/api/capture-v1 (posthog.com#21385). The masking table marks all three options as defaults, and the generated references copy is refreshed so it no longer says screenshotModeBackgroundCapture was removed.
turnipdabeets and others added 3 commits November 13, 2026 14:31
* 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 and capture

* docs: keep the $set and $set_once distinction in the migration guide

* test: cover $set_once, $merge_dangerously, a call property and beforeSend
…#1061)

* docs: sort the iOS 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 iOS SDK pages into the reference

The posthog.com iOS SDK pages redirect to this reference once 4.0.0
ships, so their 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 4f8c153)

* Revert "docs: move the posthog.com iOS SDK pages into the reference"

This reverts commit 0740925.

* docs: add the iOS facts from the retired posthog.com pages that no other page has

Drop the CocoaPods install line, since 4.x.x isn't published to
CocoaPods.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: move the iOS one-API facts from getting-started into doc comments

The sampling note moves to setBeforeSend. The surveys swizzling note is
dropped, since 4.x.x surveys don't need swizzling.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: preserve ios reference details

* 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 iOS 4.0 migration guide

- Say 4.x.x sends analytics and AI events to capture v1, not every event
- Say follow ups can wait because 4.x.x still accepts the old names and options
- Add a checklist item for filters on a null `$feature_flag_response`
- Say what `$ai_*` events sent with `capture` still do, and what `captureAi` adds
- Say AI events queued by 4.x.x are sent again after a re-upgrade
- Reword the retry rules intro, since not all of them are about failures
- Regenerate references/posthog-ios-migration.md

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>
…cated

Brings in 3.95.0-3.96.2 and GPU screenshot capture (#911, #966).
Resolved for 4.0: screenshot capture always on (screenshotMode stays
removed, GPU capture docs no longer reference it), RRWireframe ->
RRScreenshotFrame, PostHog.podspec stays deleted, new GPU/replay
sources and tests gated on the SessionReplay trait, survey cancel
events gated on Surveys.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
turnipdabeets and others added 4 commits November 13, 2026 15:53
The tests main added in #1059 expect NSNull, but 4.0 omits null
properties, and the feature-flag-called spec allows an omitted response
as the missing sentinel.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
# Conflicts:
#	PostHog.podspec
#	PostHog/PostHogVersion.swift
…cated

Brings in #1054 (cleared labels and replaced images stay masked, and the
app-defined CALayer presentation guard from #1064).

- isLabelSensitive keeps 4.0's image-attachment check alongside #1054's
  cleared-text check.
- toWireframe stays removed (4.0 has no wireframe mode); main's
  hasSensitiveImageAttachment is dropped for 4.0's existing one.
- #1054's wireframe-only test is dropped, its fixture uses
  RRScreenshotFrame, and the new replay test files are gated on the
  SessionReplay trait like the other replay suites.
turnipdabeets and others added 7 commits November 16, 2026 10:26
* feat!: replace replay capture flags with captureMethod

screenshotModeBackgroundCapture and screenshotModeGPUCapture become one
PostHogSessionReplayConfig.captureMethod (.standard, .background, .gpu),
so there's no precedence rule between two flags. screenshotScale and
.background are no longer experimental; .gpu stays experimental.

screenshotModeBackgroundCapture gets an unavailable stub pointing at
captureMethod = .background. screenshotModeGPUCapture was never released.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* docs: rewrap the .gpu capture method doc comment

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix: add an unavailable stub for screenshotModeGPUCapture

3.97.0 shipped screenshotModeGPUCapture, so 4.0 replaces it with
captureMethod = .gpu like screenshotModeBackgroundCapture.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…4.0) (#1080)

* fix(error-tracking): start handled-error stack traces at the caller

Port of #1079 to 4.0. When the SDK is statically linked into the app
(the SwiftPM default, and the only option in 4.0), its frames share the
app's binary, so the module-name check never stripped them and every
handled error's top in-app frame was the SDK's own code. Release builds
are stripped, so symbol names can't identify SDK frames either.

Each of the six public captureException/captureExceptionObjC overloads
now checks isEnabled(), reads the stack in its own body and drops its
own frame, and the processor uses that caller stack. Overloads no longer
call each other. The @objc thunk left above Objective-C callers is
matched by its local symbol, now including the captureExceptionObjC
wrappers, which stripping removes, so it can't mislabel an app frame.

Fixes #1077

* chore: drop the duplicate changeset; #1079's 3.x entry covers this fix

* fix(error-tracking): keep SDK frames in handled-error stacks, marked not in-app

Port of #1084 to 4.0. Instead of removing the SDK's own frames from the
top of `captureException` stack traces, keep them and mark them
in_app: false, so the trace still shows how the error was reported while
the first in-app frame is the app's call site.

The processor captures the full stack and lines it up with the caller's
stack the public entry point read, so it works in stripped builds. The
@objc thunk check keeps both the captureException and
captureExceptionObjC prefixes. No changeset: #1084's entry on main
covers it.

* Revert "fix(error-tracking): keep SDK frames in handled-error stacks, marked not in-app"

This reverts commit b95b15f. Back to stripping the SDK's reporting
frames, matching #1079 on main, which Manoel and error tracking agreed on.

* docs(error-tracking): say captureCurrentStackTraceWithMetadata only strips a PostHog framework's frames
)

Change errorTrackingConfig.inAppByDefault to false, so only frames from the
app's executable and inAppIncludes are in-app. Third-party dynamic
frameworks no longer show up as app code. Matches Android, which only marks
the app's own package as in-app.
Conflict resolutions:
- release.yml: drop both main's old post-release reference jobs (main moved
  them before version-bump) and the publish-cocoapods job (removed in 4.0)
- PostHog.podspec: stays deleted (CocoaPods dropped in 4.0)
- PostHogSDK.swift, PostHogStackTraceProcessor.swift,
  PostHogCaptureExceptionStackTest.swift: keep 4.0's port of the caller-stack
  fix (#1080), which also covers options and the captureExceptionObjC overloads
- PostHogVersion.swift: keep 4.0's @_spi declaration at 3.97.2

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…eplay trait

The suite came in from main and uses replay internals that 4.0 compiles out
without the SessionReplay trait, breaking the spm-no-traits test build.
Brings in the 3.98.0 release (#1074, #1086) and #1089. Keeps the podspec deleted and postHogVersion behind @_spi(PostHogInternal).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The SDK seeds inAppIncludes with the app's bundle ID and executable name.
Assigning the list drops them, which was harmless with 3.x's
inAppByDefault = true but leaves the app's own frames not in-app in 4.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

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.

Next iOS major version plan Deprecate CocoaPods support and remove from release pipeline $locale collected different from iOS

6 participants