Skip to content

chore!: remove PostHogDataMode.cellular for v4 - #890

Merged
turnipdabeets merged 1 commit into
chore/v4-remove-deprecatedfrom
chore/v4-remove-datamode-cellular
Oct 5, 2026
Merged

turnipdabeets merged 1 commit into
chore/v4-remove-deprecatedfrom
chore/v4-remove-datamode-cellular

Conversation

@turnipdabeets

@turnipdabeets turnipdabeets commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Part of the 4.0 stack, on top of #873.

Removes PostHogDataMode.cellular. It was deprecated in 3.x by #891 (merged) because it has never done anything different from .any:

  • dataMode is only read in PostHogQueue.updatePauseState. The queue pauses when there is no connection, or when dataMode == .wifi and the device isn't on Wi-Fi. Every other case sends, so .cellular falls through exactly like .any.
  • That's been true since the v3 rewrite (iOS SDK v3 #75, Nov 2023). The 2.x Objective-C SDK had no data mode at all.
  • No other PostHog SDK (Android, React Native, KMP) has a data-mode setting, and no sdk-specs spec covers it.
  • The name suggests "send only on cellular", which it never did. Keeping it misleads people, and a major release is the only time it can go.

Nothing changes at runtime. Anyone using .cellular switches to .any and gets identical behavior.

Migration: replace .cellular with .any (PostHogDataModeCellular with PostHogDataModeAny in Objective-C).

Raw values

PostHogDataMode is an @objc Int enum. Without explicit raw values, removing the middle case would renumber .any from 2 to 1. This PR pins them: case wifi = 0, case any = 2. The generated header now has PostHogDataModeWifi = 0 and PostHogDataModeAny = 2, the same as 3.x.

Why keep .any at 2:

  • Objective-C code compiled against a 3.x header has 2 baked in for PostHogDataModeAny. It keeps meaning "any".
  • Any wrapper or app that stored or passed rawValue keeps working. A stale 1 (the old .cellular) still behaves like .any, because the queue only checks == .wifi. PostHogDataMode(rawValue: 1) returns nil.
  • Renumbering gains nothing, and the gap at 1 is harmless.

Changes

  • PostHogDataMode.cellular removed. .wifi and .any get explicit raw values 0 and 2.
  • Public API snapshot updated.
  • Changeset: posthog-ios major.

API snapshot diff:

-PostHog | PostHogConfig.PostHogDataMode.cellular | enum.case | case cellular | s:7PostHog0aB6ConfigC0aB8DataModeO8cellularyA2EmF
-PostHog | PostHogDataMode.cellular | enum.case | case cellular | c:@M@PostHog@E@PostHogDataMode@PostHogDataModeCellular

No tests or example apps referenced PostHogDataMode.cellular. Reachability.Connection.cellular and $network_cellular are separate and untouched.

Wrapper SDKs

Wrapper Needs a change?
posthog-flutter Compiles against 4.0: PostHog/posthog-flutter#634 (merged) maps "cellular" to .any and deprecates the Dart PostHogDataMode.cellular. PostHog/posthog-flutter#637 (v6, draft) removes the Dart value; it currently conflicts with main on that same switch and needs a rebase.
React Native plugin No: PosthogReactNativePlugin.swift never sets dataMode.
posthog-kmp No: it doesn't expose or set dataMode.

💚 How did you test it?

  • make test: passed (XCTest: 169 tests, 0 failures; Swift Testing: 909 tests in 147 suites)
  • make buildSdk: succeeded for iOS, macOS, tvOS, watchOS and visionOS
  • make apiCheck: showed only the two removed cellular lines above. Snapshot updated with make apiUpdate.
  • Built the PostHog scheme for iOS and checked the generated PostHog-Swift.h for PostHogDataModeWifi = 0 and PostHogDataModeAny = 2.
  • No new test. The flush behavior of .wifi and .any is unchanged, and the existing dataMode default check in PostHogConfigTest still passes.

📝 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 made the change, ran make format, make test, make buildSdk and make apiCheck/apiUpdate, and checked the generated Objective-C header. The main decision was pinning raw values so .any stays 2 (see above), rather than letting it renumber to 1.

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

posthog-ios Compliance Report

Date: 2026-10-05 16:59:23 UTC
Duration: 222219ms

⚠️ Some Tests Failed

44/45 tests passed, 1 failed


Capture Tests

⚠️ 28/29 tests passed, 1 failed

View Details
Test Status Duration
Format Validation.Event Has Required Fields ✅ 2991ms
Format Validation.Event Has Uuid ✅ 3237ms
Format Validation.Event Has Lib Properties ✅ 460ms
Format Validation.Distinct Id Is String ✅ 3107ms
Format Validation.Token Is Present ✅ 3020ms
Format Validation.Custom Properties Preserved ✅ 2830ms
Format Validation.Event Has Timestamp ✅ 2778ms
Retry Behavior.Retries On 503 ✅ 11734ms
Retry Behavior.Does Not Retry On 400 ✅ 4806ms
Retry Behavior.Does Not Retry On 401 ✅ 5095ms
Retry Behavior.Respects Retry After Header ✅ 7832ms
Retry Behavior.Implements Backoff ✅ 21725ms
Retry Behavior.Retries On 500 ✅ 9632ms
Retry Behavior.Retries On 502 ✅ 6136ms
Retry Behavior.Retries On 504 ✅ 9308ms
Retry Behavior.Max Retries Respected ❌ 15592ms
Deduplication.Generates Unique Uuids ✅ 3151ms
Deduplication.Preserves Uuid On Retry ✅ 9278ms
Deduplication.Preserves Uuid And Timestamp On Retry ✅ 16349ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 7911ms
Deduplication.No Duplicate Events In Batch ✅ 2884ms
Deduplication.Different Events Have Different Uuids ✅ 2788ms
Compression.Sends Gzip When Enabled ✅ 2943ms
Batch Format.Uses Proper Batch Structure ✅ 2844ms
Batch Format.Flush With No Events Sends Nothing ✅ 208ms
Batch Format.Multiple Events Batched Together ✅ 2966ms
Error Handling.Does Not Retry On 403 ✅ 4828ms
Error Handling.Does Not Retry On 413 ✅ 4771ms
Error Handling.Retries On 408 ✅ 5440ms

Failures

retry_behavior.max_retries_respected

Expected 4 requests, got 5

Feature_Flags Tests

✅ 16/16 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id ✅ 2992ms
Request Payload.Flags Request Uses V2 Query Param ✅ 2777ms
Request Payload.Flags Request Hits Flags Path Not Decide ✅ 2858ms
Request Payload.Flags Request Omits Authorization Header ✅ 2937ms
Request Payload.Token In Flags Body Matches Init ✅ 2865ms
Request Payload.Groups Round Trip ✅ 2926ms
Request Payload.Groups Default To Empty Object ✅ 2897ms
Request Payload.Person Properties Distinct Id Auto Populated When Caller Omits It ✅ 2941ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False ✅ 2840ms
Request Payload.Disable Geoip Omitted Defaults To False ✅ 2955ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key ✅ 3004ms
Request Lifecycle.No Flags Request On Init Alone ✅ 215ms
Request Lifecycle.No Flags Request On Normal Capture ✅ 471ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests ✅ 5808ms
Request Lifecycle.Mock Response Value Is Returned To Caller ✅ 2893ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event ✅ 3178ms

PostHogDataMode.cellular has always behaved the same as .any. Remove it;
callers switch to .any with identical flushing behavior.

.wifi and .any keep explicit raw values 0 and 2 so the Objective-C
constants and any stored raw values stay the same as in 3.x.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@turnipdabeets
turnipdabeets force-pushed the chore/v4-remove-datamode-cellular branch from d9bb4e9 to 56834d2 Compare October 5, 2026 16:42
@turnipdabeets
turnipdabeets marked this pull request as ready for review October 5, 2026 17:13
@turnipdabeets
turnipdabeets requested a review from a team as a code owner October 5, 2026 17:13
@greptile-apps

greptile-apps Bot commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Retrigger

[High risk] Removes a public API enum case in a major version.

The PR appears safe to merge as part of the planned v4 API removal.

Reviews (1) · Last reviewed commit: "chore!: remove PostHogDataMode.cellular ..."

@turnipdabeets
turnipdabeets merged commit 7c2ab1a into chore/v4-remove-deprecated Oct 5, 2026
48 checks passed
@turnipdabeets
turnipdabeets deleted the chore/v4-remove-datamode-cellular branch October 5, 2026 22:50
turnipdabeets added a commit that referenced this pull request Oct 7, 2026
PostHogDataMode.cellular has always behaved the same as .any. Remove it;
callers switch to .any with identical flushing behavior.

.wifi and .any keep explicit raw values 0 and 2 so the Objective-C
constants and any stored raw values stay the same as in 3.x.

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
turnipdabeets added a commit that referenced this pull request Oct 9, 2026
PostHogDataMode.cellular has always behaved the same as .any. Remove it;
callers switch to .any with identical flushing behavior.

.wifi and .any keep explicit raw values 0 and 2 so the Objective-C
constants and any stored raw values stay the same as in 3.x.

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
turnipdabeets added a commit that referenced this pull request Oct 20, 2026
PostHogDataMode.cellular has always behaved the same as .any. Remove it;
callers switch to .any with identical flushing behavior.

.wifi and .any keep explicit raw values 0 and 2 so the Objective-C
constants and any stored raw values stay the same as in 3.x.

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
@turnipdabeets turnipdabeets mentioned this pull request Oct 20, 2026
1 of 5 tasks
turnipdabeets added a commit that referenced this pull request Oct 23, 2026
PostHogDataMode.cellular has always behaved the same as .any. Remove it;
callers switch to .any with identical flushing behavior.

.wifi and .any keep explicit raw values 0 and 2 so the Objective-C
constants and any stored raw values stay the same as in 3.x.

Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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