Skip to content

chore!: adopt posthog-ios 4.0 and posthog-android 4.0 - #649

Open
turnipdabeets wants to merge 7 commits into
chore/v6-posthog-ios-4from
chore/v6-adopt-posthog-ios-4
Open

turnipdabeets wants to merge 7 commits into
chore/v6-posthog-ios-4from
chore/v6-adopt-posthog-ios-4

Conversation

@turnipdabeets

@turnipdabeets turnipdabeets commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

Stacked on #637. This is the part of v6 that needs the posthog-ios 4.0 and posthog-android 4.0 majors, split out so #637 can pass CI against the 3.x SDKs. Merge this once both are released.

💚 How did you test 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

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

🤖 Generated with Claude Code

@turnipdabeets turnipdabeets self-assigned this Oct 7, 2026
@turnipdabeets
turnipdabeets force-pushed the chore/v6-adopt-posthog-ios-4 branch from f4edb3d to 2e699ad Compare October 7, 2026 20:05
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

posthog-flutter Compliance Report

Date: 2026-10-30 16:31:06 UTC
Duration: 96320ms

✅ All Tests Passed!

45/45 tests passed


Capture Tests

✅ 29/29 tests passed

View Details
Test Status Duration
Format Validation.Event Has Required Fields ✅ 122ms
Format Validation.Event Has Uuid ✅ 110ms
Format Validation.Event Has Lib Properties ✅ 108ms
Format Validation.Distinct Id Is String ✅ 107ms
Format Validation.Token Is Present ✅ 108ms
Format Validation.Custom Properties Preserved ✅ 108ms
Format Validation.Event Has Timestamp ✅ 109ms
Retry Behavior.Retries On 503 ✅ 5315ms
Retry Behavior.Does Not Retry On 400 ✅ 2111ms
Retry Behavior.Does Not Retry On 401 ✅ 2110ms
Retry Behavior.Respects Retry After Header ✅ 8115ms
Retry Behavior.Implements Backoff ✅ 15417ms
Retry Behavior.Retries On 500 ✅ 5216ms
Retry Behavior.Retries On 502 ✅ 5216ms
Retry Behavior.Retries On 504 ✅ 5215ms
Retry Behavior.Max Retries Respected ✅ 15429ms
Deduplication.Generates Unique Uuids ✅ 115ms
Deduplication.Preserves Uuid On Retry ✅ 5209ms
Deduplication.Preserves Uuid And Timestamp On Retry ✅ 10320ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 5219ms
Deduplication.No Duplicate Events In Batch ✅ 114ms
Deduplication.Different Events Have Different Uuids ✅ 110ms
Compression.Sends Gzip When Enabled ✅ 110ms
Batch Format.Uses Proper Batch Structure ✅ 109ms
Batch Format.Flush With No Events Sends Nothing ✅ 105ms
Batch Format.Multiple Events Batched Together ✅ 114ms
Error Handling.Does Not Retry On 403 ✅ 2111ms
Error Handling.Does Not Retry On 413 ✅ 2111ms
Error Handling.Retries On 408 ✅ 5217ms

Feature_Flags Tests

✅ 16/16 tests passed

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

@turnipdabeets
turnipdabeets force-pushed the chore/v6-posthog-ios-4 branch from e1927f4 to a700edb Compare October 8, 2026 15:45
@turnipdabeets
turnipdabeets force-pushed the chore/v6-adopt-posthog-ios-4 branch from 2bf1608 to 7c1826e Compare October 8, 2026 15:45
@github-actions

Copy link
Copy Markdown
Contributor

This PR hasn't seen activity in a week! Should it be merged, closed, or further worked on? If you want to keep it open, post a comment or remove the stale label – otherwise this will be closed in another week.

@github-actions github-actions Bot added the stale label Oct 16, 2026
@eli-r-ph

Copy link
Copy Markdown

Adopting posthog-ios 4.0 moves Flutter's iOS events to capture v1, but the Dart API doesn't expose options or captureAi yet, so Flutter users get v1's stricter rules without its new APIs, and $ai_* events stay on the analytics endpoint. Could Flutter 6 add options (including on PostHogEvent for beforeSend) and captureAi, passing them to native on iOS and mapping them to legacy properties and a plain capture on Android and web? If that's too much for 6.0, I wonder if we should hold on shipping the partial v1 implementation just for Flutter/iOS now? I'm concerned that another breaking-change upgrade after the release to get in parity with the public release docs and features of the other v1 SDKs may be too confusing for end users? I'm also open to just converting all these related SDKs/plugins at once instead so they can all be consistent now? What do you think we should do?

@github-actions github-actions Bot removed the stale label Oct 22, 2026
"posthog_flutter": major
---

- **Breaking:** adopt `posthog-ios` 4.x, which requires Xcode 26

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Adopting posthog-ios 4 moves iOS and macOS events to capture v1, while Android stays on /batch. Can the changeset say so and link the iOS 4.0 migration guide? Proxy users need to forward /i/v1/analytics/events, stop putting their proxy auth in the Authorization header, and know that distinct IDs over 200 bytes are dropped on iOS only.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Adopting posthog-ios 4.0 moves iOS and macOS events to capture v1 (/i/v1/analytics/events). A reverse proxy must forward the new path and the Authorization header, or events are dropped. Could the changeset say so and link the posthog-ios 4.0 migration guide, as the Windows and Linux changeset does?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🤔 I think this was all addressed elsewhere but let me know if not - I made managed proxy cfg changes for prod, but SDK migration guides will need to call out new required header allowances, req size caps etc. suitable for capture v1 analytics and AI shaped events as prep work for users on DIY proxies

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks! Flutter 6.0 adopts posthog-ios 4.0 (this PR) and posthog-android 4.0 (#663), and #673 moves Windows and Linux, so every platform moves to capture v1. I've updated the capture v1 changeset in #673 (cdaefeb) to cover all platforms. It lists what a DIY proxy needs: forward /i/v1/analytics/events and /i/v1/ai/events, pass Authorization, the PostHog-* headers, Content-Type, Content-Encoding and User-Agent through unchanged, and accept request bodies up to 20 MB. It also links the native migration guides, which are still in review:

@turnipdabeets

turnipdabeets commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor Author

@eli-r-ph Thanks, agreed that we shouldn't ship v1 without its APIs. #674 adds them in 6.0: options on capture/screen/identify/setPersonProperties/alias/group/captureException and on PostHogEvent for beforeSend, plus captureAi, both passed to native on iOS, macOS and Android (Android now has native captureAi via posthog-android 4.0 in #663). Now that Windows and Linux send through capture v1 (#673), I'm adding a real /i/v1/ai/events route to the Dart desktop sender for captureAi, rather than a plain-capture fallback. Web is the one gap: posthog-js has no AI capture, so captureAi there sends nothing and returns null. I can make web fall back to a plain capture instead if you think keeping those events is worth sending them through the analytics endpoint. 6.0 ships with #674 and the desktop AI route.

@turnipdabeets turnipdabeets changed the title chore!: adopt posthog-ios 4.0 chore!: adopt posthog-ios 4.0 and posthog-android 4.0 Oct 29, 2026
turnipdabeets and others added 3 commits October 29, 2026 15:07
- Require posthog-ios 4.x.
- Adapt to the reloadFeatureFlags(_:) callback that now passes a
  PostHogFeatureFlagsLoaded (PostHog/posthog-ios#913).
- Note the payload decoding changes from PostHog/posthog-ios#903.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
PostHog/posthog-ios#905 removes the legacy version/build properties from
lifecycle events in 4.0, so Flutter iOS and macOS apps stop sending them.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…listener

posthog-ios 4.0 removes the didReceiveFeatureFlags notification.
turnipdabeets and others added 2 commits October 29, 2026 15:07
* chore!: adopt posthog-android 4.0

* chore!: pass the loaded flags to onFeatureFlags and reloadFeatureFlags (#664)

* chore!: pass the loaded flags to onFeatureFlags and reloadFeatureFlags

onFeatureFlags and reloadFeatureFlags now carry a PostHogFeatureFlagsLoaded with the enabled flags, their values and whether loading failed, matching posthog-ios 4.0 and posthog-android 4.0. On web, reloadFeatureFlags completes right away with the flags loaded so far, because posthog-js doesn't report when a reload finishes.

* fix: complete the web reloadFeatureFlags with the reloaded flags

Wait for the next posthog-js onFeatureFlags call instead of returning the flags already loaded, so a failed reload reports errorsLoading. Complete right away when flags are disabled, and after twice the flags request timeout when posthog-js skips the request without calling back.

* chore: use PostHogFeatureFlagsCallback from posthog-android 4.0

* chore: fix ktlint function-signature

* fix: await posthog-js reloadFeatureFlagsAsync on web

The next onFeatureFlags callback can carry a response from a request already in flight, so reloadFeatureFlags() could complete with flags from before the reload. posthog-js 1.438.2+ settles reloadFeatureFlagsAsync() after this reload's own request; use it when present and keep the callback path for older posthog-js.

* docs: pass the loaded flags in the setup example

* docs: drop best-effort web note from the person and group property methods

* fix(web): wait for posthog-js flags retries before reporting a reload failure

posthog-js retries a timed-out /flags request once by default, 500 ms later, inside the same reload. The older-JS deadline of twice the request timeout reported cached flags with errorsLoading set before a successful retry landed.

* docs: note where onFeatureFlags and errorsLoading differ on Android and web

* docs: describe the older posthog-js reload timeout as the full retry budget

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

---------

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

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
…s into one changeset

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@turnipdabeets
turnipdabeets force-pushed the chore/v6-adopt-posthog-ios-4 branch from fd88c7e to 7eebbca Compare October 29, 2026 19:10
posthog-android 4.0 drops RRStyle and the wireframe tree fields from the
internal RRWireframe; screenshot frames don't need a style.

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.

3 participants