Skip to content

chore(ios): map PostHogDataMode.cellular to .any - #634

Merged
turnipdabeets merged 1 commit into
mainfrom
chore/ios-cellular-to-any
Oct 5, 2026
Merged

turnipdabeets merged 1 commit into
mainfrom
chore/ios-cellular-to-any

Conversation

@turnipdabeets

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

posthog-ios 4.0 removes PostHogDataMode.cellular (PostHog/posthog-ios#890), and posthog-ios 3.x deprecates it (PostHog/posthog-ios#891), because it has always behaved exactly like .any. Our iOS/macOS plugin sets config.dataMode = .cellular, so it won't compile against posthog-ios 4.0.

This PR unblocks posthog-ios 4.0 with no behavior change:

  • The plugin now maps the "cellular" string from Dart to .any, which is what .cellular already did at runtime.
  • PostHogDataMode.cellular in Dart is marked @Deprecated, with a corrected doc comment. The old one said "Send data only on cellular connections", which was never true. The value stays, so this isn't breaking. We can remove it in the next major.
  • Android doesn't read dataMode, so nothing changes there.
  • The public API snapshot is updated (isDeprecated: true), and there's a patch changeset.

💚 How did you test it?

  • flutter analyze and flutter test in posthog_flutter: no issues, all tests pass.
  • flutter build ios --simulator --no-codesign and flutter build macos in example: both build (against the current posthog-ios 3.x).
  • scripts/check-api-dart.sh, dart format, and swiftformat --lint: clean.
  • I didn't add a test. Runtime behavior is the same, and the mapping sits inside the private setupPostHog, so testing it would need a new seam.

📝 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)

Written with Claude Code. We kept the Dart enum value and only deprecated it, so 5.x stays non-breaking.

🤖 Generated with Claude Code

posthog-ios 4.0 removes PostHogDataMode.cellular, which always behaved like .any. Map the Dart "cellular" value to .any in the plugin and deprecate PostHogDataMode.cellular in Dart.
@turnipdabeets turnipdabeets self-assigned this Oct 2, 2026
@greptile-apps

greptile-apps Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Retrigger

[Medium risk] Deprecates a data mode enum value used in analytics configuration.

The PR is not ready to merge as a posthog-ios 4.0 compatibility change because neither Apple dependency declaration permits 4.0.

Reviews (1) · Last reviewed commit: "chore(ios): map PostHogDataMode.cellular..."

Comment on lines +238 to 239
case "any", "cellular":
config.dataMode = .any

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Version 4 remains excluded The new mapping removes the .cellular reference, but the CocoaPods and Swift Package Manager dependencies both require posthog-ios versions below 4.0.0. Neither can select 4.0, so this change does not yet unblock it. Widen both dependency ranges and build against 4.0 to verify compatibility.

Knowledge Base Used: SDK configuration and platform integrations

Prompt To Fix With AI
This is a comment left during a code review.
Path: posthog_flutter/darwin/posthog_flutter/Sources/posthog_flutter/PosthogFlutterPlugin.swift
Line: 238-239

Comment:
**Version 4 remains excluded** The new mapping removes the `.cellular` reference, but the CocoaPods and Swift Package Manager dependencies both require posthog-ios versions below 4.0.0. Neither can select 4.0, so this change does not yet unblock it. Widen both dependency ranges and build against 4.0 to verify compatibility.

**Knowledge Base Used:** [SDK configuration and platform integrations](https://app.greptile.com/posthog-org-19734/-/custom-context/knowledge-base/posthog/posthog-flutter/-/docs/sdk-configuration-and-platforms.md)

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@github-actions

github-actions Bot commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

posthog-flutter Compliance Report

Date: 2026-10-02 16:15:29 UTC
Duration: 96584ms

✅ All Tests Passed!

45/45 tests passed


Capture Tests

✅ 29/29 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields ✅ 132ms
Format Validation.Event Has Uuid ✅ 115ms
Format Validation.Event Has Lib Properties ✅ 113ms
Format Validation.Distinct Id Is String ✅ 112ms
Format Validation.Token Is Present ✅ 113ms
Format Validation.Custom Properties Preserved ✅ 114ms
Format Validation.Event Has Timestamp ✅ 114ms
Retry Behavior.Retries On 503 ✅ 5326ms
Retry Behavior.Does Not Retry On 400 ✅ 2115ms
Retry Behavior.Does Not Retry On 401 ✅ 2114ms
Retry Behavior.Respects Retry After Header ✅ 8122ms
Retry Behavior.Implements Backoff ✅ 15435ms
Retry Behavior.Retries On 500 ✅ 5221ms
Retry Behavior.Retries On 502 ✅ 5223ms
Retry Behavior.Retries On 504 ✅ 5221ms
Retry Behavior.Max Retries Respected ✅ 15439ms
Deduplication.Generates Unique Uuids ✅ 118ms
Deduplication.Preserves Uuid On Retry ✅ 5220ms
Deduplication.Preserves Uuid And Timestamp On Retry ✅ 10333ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 5226ms
Deduplication.No Duplicate Events In Batch ✅ 117ms
Deduplication.Different Events Have Different Uuids ✅ 112ms
Compression.Sends Gzip When Enabled ✅ 113ms
Batch Format.Uses Proper Batch Structure ✅ 112ms
Batch Format.Flush With No Events Sends Nothing ✅ 107ms
Batch Format.Multiple Events Batched Together ✅ 119ms
Error Handling.Does Not Retry On 403 ✅ 2114ms
Error Handling.Does Not Retry On 413 ✅ 2114ms
Error Handling.Retries On 408 ✅ 5221ms

Feature_Flags Tests

✅ 16/16 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id ✅ 10ms
Request Payload.Flags Request Uses V2 Query Param ✅ 7ms
Request Payload.Flags Request Hits Flags Path Not Decide ✅ 7ms
Request Payload.Flags Request Omits Authorization Header ✅ 7ms
Request Payload.Token In Flags Body Matches Init ✅ 6ms
Request Payload.Groups Round Trip ✅ 7ms
Request Payload.Groups Default To Empty Object ✅ 7ms
Request Payload.Person Properties Distinct Id Auto Populated When Caller Omits It ✅ 10ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False ✅ 6ms
Request Payload.Disable Geoip Omitted Defaults To False ✅ 7ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key ✅ 6ms
Request Lifecycle.No Flags Request On Init Alone ✅ 3ms
Request Lifecycle.No Flags Request On Normal Capture ✅ 109ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests ✅ 12ms
Request Lifecycle.Mock Response Value Is Returned To Caller ✅ 6ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event ✅ 111ms

@turnipdabeets
turnipdabeets marked this pull request as ready for review October 2, 2026 17:25
@turnipdabeets
turnipdabeets requested a review from a team as a code owner October 2, 2026 17:25

@dustinbyrne dustinbyrne 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.

Review recommendation: approve. Mapping both channel values to native .any preserves the existing queue policy, while retaining Dart enum and serialization compatibility. The current native dependency ranges correctly remain unchanged; adopting native 4.0 is separate work. No findings.

Static source review and existing CI only; no tests run locally. Human-driven, agent-assisted review.

@dustinbyrne dustinbyrne 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.

Approved following the completed source review.

Human-driven, agent-assisted review.

@turnipdabeets
turnipdabeets merged commit e0a5f8f into main Oct 5, 2026
28 checks passed
@turnipdabeets
turnipdabeets deleted the chore/ios-cellular-to-any branch October 5, 2026 15:32
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