Skip to content

chore!: Flutter Major Release v6 - #637

Open
turnipdabeets wants to merge 69 commits into
mainfrom
chore/v6-posthog-ios-4
Open

turnipdabeets wants to merge 69 commits into
mainfrom
chore/v6-posthog-ios-4

Conversation

@turnipdabeets

@turnipdabeets turnipdabeets commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Important

This is the posthog_flutter 6.0 release PR. Don't merge it until every item under "Before release" is done. publish.yml releases on every changeset push to main, so merging it publishes 6.0.0. "Release day" and "After release" items don't block the merge. Every stacked 6.0 PR is merged into this branch (chore/v6-posthog-ios-4), and the single changeset is .changeset/v6-major-release.md.

💡 Motivation and Context

posthog_flutter 6.0 wraps posthog-ios 4.0 and posthog-android 4.0:

  • Events go to capture v1 (/i/v1/analytics/events) on iOS, macOS, Android, Windows and Linux. The new captureAi() sends AI events to /i/v1/ai/events. Web keeps posthog-js and doesn't change transport.
  • Per-event capture options, registerOptions(), and one property precedence everywhere: SDK-set, then registered, then event properties, then beforeSend.
  • beforeSend is synchronous and runs on the event the native SDK built.
  • APIs deprecated in 5.x are removed, onFeatureFlags becomes a listener you can unsubscribe, CocoaPods is gone (SPM only), and Flutter 3.41, iOS 15, macOS 12 and Xcode 26 are the new floors.

The upgrade guide is posthog_flutter/MIGRATION.md.

Docs and onboarding that ship with this release (merge once 6.0.0 is on pub.dev):

What gets released

Artifact Bump Why
posthog_flutter 5.61.0 → 6.0.0 Removed APIs, platform interface changes, new native majors, new floors.
posthog-ios dependency 3.x → 4.0.0 ..< 5.0.0 (SPM only) Capture v1, iOS 15 / macOS 12, Xcode 26. The podspec is removed (#697).
posthog-android dependency [3.75.0, 4.0.0) → [4.0.0, 5.0.0), strict (#729) Capture v1. A dependency that pulls posthog-android 5.x fails the build instead of crashing at runtime.
Flutter SDK any → 3.41 or later on every platform (#713) SPM for plugins. Add-to-app modules on iOS need 3.50 (flutter/flutter#184590).

Merged into this branch

PR Change
#638 Remove 5.x-deprecated names (apiKey, enable/disable, sendFeatureFlagEvents, getFeatureFlagPayload, debouncerDelay, PostHogDataMode.cellular, widget states)
#645, #646, #647 Platform enable/disable → optIn/optOut; toMap/fromMap out of the public API; getFeatureFlagResult(sendEvent:) → sendFeatureFlagEvent:
#643, #649 (with #663) Adopt posthog-ios 4.0 and posthog-android 4.0
#662, #694 getFeatureFlagResult() follows config.sendFeatureFlagEvent; isFeatureEnabled(defaultValue:)
#670 (with #695) Posthog().onFeatureFlags() listener with unsubscribe() replaces PostHogConfig.onFeatureFlags
#673 Capture v1 on every platform, per-event options, captureAi. Landed with #678, #679, #681, #682, #686, #688, #690, #698, #699, #701, #703, #704 merged into it (see the landing order in #673)
#697 Remove the podspec and CocoaPods CI
#711 An empty-string variant reads as disabled on every platform
#712 Web doesn't send $app_language until posthog-js supports it
#713 Require Flutter 3.41 or later
#715 registerOptions() / unregisterOptions()
#716, #718, #730 Desktop: false-like process_person_profile kept out of $set dedup; a registered personless setting stays off identity events; docs for identity calls under it
#729 Strict posthog-android 4.x range

main is merged in up to 5.61.2 (19ff2be), including #721 (exclude failed Dart flag values on Windows and Linux; its test was adapted to the capture v1 sender), #720 (disableGeoIp), #732 (AGP 9 KGP warning) and #736 ($sdk_debug_pending_queue_size only once the queue reaches flushAt).

Release review changes in this PR

2026-11-20

  • E2E re-run against the published natives only (posthog-ios from GitHub, posthog-android 4.0.0 / core 7.0.0 from Maven Central; no mavenLocal or path packages, versions checked in the built binaries). Review suite (15) and survey test: iOS Simulator 15/15 + 1/1 on posthog-ios 4.0.0 and again on 4.0.2; Android emulator 15/15 + 1/1; macOS 14/15, where the push test and the survey test don't apply (macOS has no push registration or surveys), a gap in the harness. No /batch requests; AI events on /i/v1/ai/events. The 5.61.2 ↔ 6.0 upgrade/rollback check passed on the iOS Simulator and Android: queued events, identity, super properties, cached flags, opt-out and registered options carry over. No physical device this time.
  • 5e5e582: the iOS test simulator's first boot on the macos-26 runner image takes about 4 minutes, so build-apple (ios, spm) hit the 5-minute boot timeout twice; raised to 10. Same fix for main in ci: give the iOS test simulator 10 minutes to boot #737.
  • d139300: docs/capabilities.json still mapped the removed getFeatureFlagPayload, so the release's reference generation would have failed and left the 5.x reference for posthog.com. Fixed and verified with the generator at 6.0.0. docs/getting-started.md lists Windows, Linux and the 6.0 requirements.
  • 314f256 resolves the example apps' SPM pins to the released posthog-ios 4.0.0 and points the native migration guide links at the 4.0.0 / android-v4.0.0 tags. Gradle resolves posthog-android:4.0.0 and posthog:7.0.0 from Maven Central; no SNAPSHOT, mavenLocal or branch pins remain. ci: [do not merge] build v6 against unreleased native 4.0 #709 is closed.
  • 6005788 syncs references/posthog-flutter-migration.md with MIGRATION.md (macOS 12.0, posthog-server 2.26.0).
  • 19ff2be merges main (5.61.2). Conflicts: fix: only attach $sdk_debug_pending_queue_size once the queue reaches flushAt #736's backedUpQueueLength reads the analytics lane's flushAt, since 6.0 has per-lane capture v1 queues. fix: only attach $sdk_debug_pending_queue_size once the queue reaches flushAt #736's test asserted that SDK debug values win over registered and caller properties, which 6.0 reverses (Check property precedence), so the ported test checks the flushAt threshold and keeps 6.0's precedence. flutter test: 1,594 pass; flutter analyze, dart format and scripts/check-api-dart.sh clean; example flutter build apk --debug, flutter build ios --no-codesign and flutter build macos --debug build against the released natives.

2026-11-17

  • 50d0a89 merges main (5.61.0, feat: add disableGeoip config #720 disableGeoIp). Conflicts: Android keeps the strict [4.0.0, 5.0.0) range and sets PostHogConfig.disableGeoIp, which posthog-android 4.0 has; PostHogConfig.toMap() stays removed and disableGeoIp goes through channel_serialization.dart; the compliance adapter keeps its capture v1 client path. ci.yml auto-merged feat: add disableGeoip config #720's simulator boot step gated on the cocoapods leg, which 6.0 removed, so the iOS plugin tests would have run with an empty simulator id; it now runs on every iOS leg. posthog-ios 4.0 sets $geoip_disable as an event property, like the desktop core. flutter test: 1,593 pass; flutter analyze, dart format and scripts/check-api-dart.sh clean; compliance adapter tests (CI's list): 36 pass; Kotlin plugin tests against a local posthog-android 4.0.0: 84/84, including the three disableGeoIp tests.
  • posthog.com#20924 and posthog#128557 re-checked: no conflicts with their base branches, no 5.x leftovers in the Flutter pages and onboarding they don't touch.

2026-11-13

2026-11-05 / 2026-11-06

  • d824b45 merges main (5.60.0). featureFlagRequestMaxRetries (feat(flags): add featureFlagRequestMaxRetries config #702) goes through channel_serialization.dart, and the desktop /flags retry count reads it.
  • e1463a3 runs the SDK compliance harness 1.28.0.
  • aa2cdd2: with beforeSend set, capture, screen, captureException and captureAi threw Binding has not yet been initialized before WidgetsFlutterBinding.ensureInitialized() instead of being skipped with a warning. Fixed, regression test extended.
  • 580fc7f completes the changeset and migration guide (property precedence on iOS, macOS and Android, platform interface changes, iOS reachability, Android JSON null payload, iOS empty-variant isFeatureEnabled()).
  • c5a7956 keeps $lib and $lib_version on Windows and Linux capture v1 events, matching posthog-ios#1036 and posthog-android#942.

Before release

Release day, after 6.0.0 is on pub.dev

These pin ^6.0.0, so they can't merge earlier.

After release

Follow-ups found during the review

No blocking issues.

  • Failed flags on Windows and Linux keep $feature_flag_response: null on $feature_flag_called (fix: exclude failed Dart flag values on Windows and Linux #721, already in 5.60.3), while iOS, macOS and Android 4.0 leave the key out for a failed or missing flag. Small parity fix for a minor.
  • frontend/src/scenes/feature-flags/FeatureFlagSnippets.tsx:578 in the posthog monorepo (remote-config snippet) reads result.payload on a nullable PostHogFeatureFlagResult?, which doesn't compile in Dart. Pre-existing, not 6.0-specific.

Deliberately excluded

💚 How did you test it?

How to build and test this branch

posthog-ios 4.0.0 and posthog-android 4.0.0 are published, so no native setup is needed.

Run:

cd example
flutter pub get
flutter run -d <device>          # iOS, macOS or Android
flutter test integration_test    # optional

Automated

  • flutter analyze, dart format, scripts/check-api-dart.sh: clean.
  • flutter test: 1,593 VM tests pass (2026-11-17, after the 5.61.0 merge). Chrome tests pass (the 3 app-version tests need the FLUTTER_BUILD_NAME define that CI's Flutter injects).
  • Compliance adapter unit tests: 36 pass (2026-11-17). Compliance harness 1.28.0 in CI: passes.
  • Kotlin plugin unit tests (:posthog_flutter:testDebugUnitTest, not run by CI) against posthog-android 4.0: 84/84 (2026-11-17).
  • Example app debug builds for Android, iOS (no codesign) and macOS against the released posthog-ios 4.0.0 and posthog-android 4.0.0 (2026-11-20).

On devices, against unreleased native 4.0

Native: posthog-ios and posthog-android chore/v4-remove-deprecated (capture v1 included), wired through a local SPM path package and mavenLocal (version checked in the built APK).

1. Scenario suite against a local capture server (58 scenarios, flutter test integration_test, events checked from the decoded request bodies)

Platform Device Result
Android Pixel 10a, Android 16 58/58
iOS iPhone 14 Pro Max, iOS 26.5.2 (profile build, results posted to the server) 58/58
iOS Simulator, iOS 26.4 58/58
macOS this Mac 58/58

What the scenarios cover:

  • New in 6.0:
    • capture v1: endpoint, PostHog-Sdk-Info header, gzip, root session_id/uuid/timestamp
    • options: per-event options, the legacy $process_person_profile property moved into options, options set in beforeSend
    • captureAi: AI endpoint, returned uuid, beforeSend drop returns null; capture('$ai_…') stays on analytics
    • $locale and $app_language: normalization (pt_BR → pt-BR), kept across reset(), cleared by setAppLanguage(null)
    • onFeatureFlags: loads, unsubscribe()
    • reloadFeatureFlags(): result, and errorsLoading with last-known flags on a 502
    • isFeatureEnabled(defaultValue:): only for unknown flags
    • getFeatureFlagResult: $feature_flag_called by default, sendFeatureFlagEvent: false, config.sendFeatureFlagEvent = false with per-call override, JSON payload, malformed payload → null
    • featureFlagRequestMaxRetries: 0, default and 3 (1, 2 and 4 /flags requests against a 502, with exponential backoff)
  • beforeSend: the 38 scenarios from the feat!: make beforeSend callbacks synchronous #686/fix: keep events and user properties through beforeSend #698 work, now on the final API:
    • ordering against reset/identify/alias/group/register/optOut
    • drop, throw, mutate, rename once
    • hooks that capture, call getters, reset, optOut, setup, identify
    • the built event (uuid, distinct ID, super properties) and close()/setup() right after a capture
    • observer screens, zoned errors, log redaction and drop
    • a 30-cycle identify/capture/reset burst and a 200 ms hook
  • Regression: identify → $identify with $set, group → $groupidentify, optOut/isOptOut/optIn, setPersonPropertiesForFlags reaching /flags, exception steps, getAllFeatureFlags, logs on /i/v1/logs.

Measurements were identical on Android and iOS for retries, defaultValue and payloads. A sync capture() hand-off took 10–154 µs.

2. The example app against real PostHog Cloud (project 381971, through a recording forward proxy, so each request's real response was checked)

Platform Events (capture v1 per-event result) Replay Other
Android, Pixel 10a 19 events, all ok 102 snapshot requests, recording native crash captured and sent on relaunch; Flutter, Dart and isolate errors captured; logs 200; flags and remote config 200
iPhone 14 Pro Max, cold launch Application Opened ok replay snapshot uploaded (200) flags and remote config 200
iOS Simulator 26.4 13 events, all ok 17 snapshot requests, recording logs 200; flags and remote config 200

Events included lifecycle, $screen, custom events, $identify, $create_alias, $groupidentify, $exception, $feature_flag_called, and the beforeSend "modify me" event. The dropped "drop me" event never left the device.

Not tested on a device

  • Windows (CI desktop job only) and Linux (CI and unit tests; not re-run on a device in this review).
  • Surveys and push notifications.
  • Web beyond the Chrome unit tests: web doesn't use capture v1 in 6.0.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed. posthog.com#20924 and posthog#128557 (drafts, merge at release)
  • 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)

  • Made with Claude Code. The 2026-11-05 release review merged main, bumped the compliance harness, fixed one bug, completed the docs and ran the device tests above. The 2026-11-13 review merged main (5.60.3), updated the add-to-app guidance for Flutter 3.50 and reviewed the docs PRs. The device test harness isn't committed.

🤖 Generated with Claude Code

@turnipdabeets turnipdabeets self-assigned this Oct 3, 2026
@greptile-apps

greptile-apps Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Retrigger

[High risk] Upgrades PostHog iOS SDK and removes deprecated APIs.

The reviewed changes appear safe to merge, with one non-blocking release-note correction.

Reviews (1) · Last reviewed commit: "chore!: adopt posthog-ios 4.0 and remove..."

Comment thread .changeset/v6-posthog-ios-4.md Resolved
@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

posthog-flutter Compliance Report

Date: 2026-11-20T22:00:38.413003+00:00
Duration: 371107ms

✅ All Tests Passed!

232/232 tests passed


Capture_V1 Tests

✅ 105/105 tests passed

View Details
Test Status Duration
Endpoint And Method.Targets V1 Endpoint ✅ 238ms
Endpoint And Method.Does Not Use Legacy Endpoints ✅ 128ms
Required Headers.Has Authorization Bearer Header ✅ 124ms
Required Headers.Has Content Type Json ✅ 124ms
Required Headers.Has Posthog Sdk Info Format ✅ 121ms
Required Headers.Has Posthog Attempt Header ✅ 120ms
Required Headers.Has Posthog Request Id ✅ 120ms
Required Headers.Has Posthog Request Timestamp ✅ 120ms
Required Headers.Has User Agent ✅ 123ms
Body Format.Body Has Created At And Batch ✅ 120ms
Body Format.No Api Key In Body ✅ 119ms
Body Format.No Sent At In Body ✅ 119ms
Event Format.Event Has Required Root Fields ✅ 119ms
Event Format.Event Uuid Is Valid ✅ 119ms
Event Format.Event Timestamp Is Rfc3339 ✅ 120ms
Event Format.Non Utc Event Timestamp Is Converted To Utc ✅ 119ms
Event Format.Distinct Id Is String ✅ 121ms
Event Format.Distinct Id At Root Not Properties ✅ 119ms
Event Format.Custom Properties Preserved ✅ 118ms
Event Format.Set Properties Preserved ✅ 124ms
Event Format.Set Once Properties Preserved ✅ 118ms
Event Format.Groups Properties Preserved ✅ 118ms
Event Format.Sdk Generates Uuid If Not Provided ✅ 117ms
Event Format.Event Has Required Root Fields Batch ✅ 125ms
Event Format.Event Uuid Is Valid Batch ✅ 125ms
Event Format.Event Timestamp Is Rfc3339 Batch ✅ 123ms
Event Format.Distinct Id Is String Batch ✅ 123ms
Event Format.Distinct Id At Root Not Properties Batch ✅ 123ms
Event Format.Custom Properties Preserved Batch ✅ 124ms
Event Format.Set Properties Preserved Batch ✅ 129ms
Event Format.Set Once Properties Preserved Batch ✅ 124ms
Event Format.Groups Properties Preserved Batch ✅ 124ms
Event Format.Sdk Generates Uuid If Not Provided Batch ✅ 124ms
Batch Behavior.Multiple Events In Single Batch ✅ 130ms
Batch Behavior.Batch Envelope Smoke ✅ 127ms
Batch Behavior.Flush With No Events Sends Nothing ✅ 109ms
Batch Behavior.Flush At Triggers Batch ✅ 1016ms
Batch Behavior.Created At Reflects Batch Creation Time ✅ 119ms
Deduplication.Generates Unique Uuids ✅ 129ms
Deduplication.Different Events Same Content Different Uuids ✅ 122ms
Deduplication.Preserves Uuid On Retry ✅ 5129ms
Deduplication.Preserves Timestamp On Retry ✅ 5122ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 5129ms
Deduplication.No Duplicate Events In Batch ✅ 129ms
Header Behavior On Retry.Attempt Header Starts At One ✅ 120ms
Header Behavior On Retry.Attempt Header Increments On Retry ✅ 10128ms
Header Behavior On Retry.Request Id Preserved On Retry ✅ 5123ms
Header Behavior On Retry.Different Requests Have Different Request Ids ✅ 2232ms
Header Behavior On Retry.Request Timestamp Changes On Retry ✅ 5124ms
Response Format Validation.Success Response Has Uuid Keyed Results ✅ 117ms
Response Format Validation.Success Response Has Ok For Each Event ✅ 122ms
Response Format Validation.Success No Retry After When All Ok ✅ 119ms
Response Format Validation.Success Retry After Present When Retry Events ✅ 120ms
Response Format Validation.Success No Retry After When Drop Only ✅ 122ms
Response Format Validation.Response Echoes Request Id ✅ 116ms
Retry Behavior.Retries On 408 ✅ 5122ms
Retry Behavior.Retries On 500 ✅ 5123ms
Retry Behavior.Retries On 503 ✅ 5123ms
Retry Behavior.Retries On 504 ✅ 5123ms
Retry Behavior.Retries On 404 ✅ 5127ms
Retry Behavior.Retries On 429 ✅ 5124ms
Retry Behavior.Retries On 502 ✅ 5122ms
Retry Behavior.Retryable Errors Have Retry After ✅ 2120ms
Retry Behavior.Respects Retry After On Retryable Error ✅ 8126ms
Retry Behavior.Does Not Retry On 400 ✅ 2120ms
Retry Behavior.Does Not Retry On 401 ✅ 2119ms
Retry Behavior.Does Not Retry On 402 ✅ 2121ms
Retry Behavior.Does Not Retry On 413 ✅ 2120ms
Retry Behavior.Does Not Retry On 415 ✅ 2120ms
Retry Behavior.Non Retryable Errors Have No Retry After ✅ 2120ms
Retry Behavior.Implements Backoff ✅ 12129ms
Partial Batch Handling.Handles 200 Full Success ✅ 2119ms
Partial Batch Handling.Handles 200 With All Ok ✅ 3125ms
Partial Batch Handling.Does Not Retry Dropped Events ✅ 3123ms
Partial Batch Handling.Does Not Retry Warning Events ✅ 3120ms
Partial Batch Handling.Prunes Ok Events On Partial Retry ✅ 5126ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry ✅ 5125ms
Partial Batch Handling.Retries Only Retry Events From Partial ✅ 5130ms
Partial Batch Handling.Partial Retry Preserves Uuids ✅ 5126ms
Partial Batch Handling.Partial Retry Attempt Header Increments ✅ 5125ms
Partial Batch Handling.Partial Retry Request Id Preserved ✅ 5125ms
Partial Batch Handling.Respects Retry After On Partial ✅ 5126ms
Partial Batch Handling.Unknown Result Treated As Terminal ✅ 3123ms
Partial Batch Handling.Mixed Ok Drop Warning No Retry ✅ 3128ms
Compression.Sends Gzip Content Encoding ✅ 120ms
Compression.No Content Encoding When Disabled ✅ 116ms
Compression.Compressed Body Is Decompressible ✅ 116ms
Error Handling.Does Not Retry On Unknown 4Xx ✅ 2119ms
Event Options.Cookieless Mode Override ✅ 117ms
Event Options.Disable Skew Correction Override ✅ 117ms
Event Options.Process Person Profile Override ✅ 117ms
Event Options.Product Tour Id Override ✅ 116ms
Event Options.Unset Options Omitted ✅ 116ms
Event Options.Options Override In Batch ✅ 123ms
Event Options.Unknown Option Passes Through ✅ 118ms
Event Options.Option Value Is Not Converted ✅ 115ms
Event Options.Lenient Bool Option Values Are Not Converted ✅ 116ms
Event Options.Option Wins Over Legacy Property ✅ 116ms
Event Options.Legacy Property Fills Unset Option ✅ 117ms
Event Options.Null Option Falls Back To Legacy Property ✅ 116ms
Property Layers.Caller Property Beats Registered Property ✅ 117ms
Property Layers.Before Send Runs Last ✅ 116ms
Fail Open.Empty Api Key Sends Nothing ✅ 1111ms
Fail Open.Personal Api Key Sends Nothing ✅ 1111ms
Geoip And Historical Migration.Historical Migration Absent By Default ✅ 116ms

Capture_Ai_V1 Tests

✅ 110/110 tests passed

View Details
Test Status Duration
Endpoint And Method.Targets V1 Endpoint ✅ 118ms
Endpoint And Method.Does Not Use Legacy Endpoints ✅ 116ms
Endpoint And Method.Capture Does Not Reroute Ai Named Events ✅ 117ms
Endpoint And Method.Capture Ai Does Not Reroute Non Ai Events ✅ 116ms
Lane Isolation.Failing Ai Lane Does Not Delay Analytics ✅ 5129ms
Required Headers.Has Authorization Bearer Header ✅ 118ms
Required Headers.Has Content Type Json ✅ 116ms
Required Headers.Has Posthog Sdk Info Format ✅ 116ms
Required Headers.Has Posthog Attempt Header ✅ 116ms
Required Headers.Has Posthog Request Id ✅ 115ms
Required Headers.Has Posthog Request Timestamp ✅ 115ms
Required Headers.Has User Agent ✅ 115ms
Body Format.Body Has Created At And Batch ✅ 116ms
Body Format.No Api Key In Body ✅ 116ms
Body Format.No Sent At In Body ✅ 116ms
Event Format.Event Has Required Root Fields ✅ 115ms
Event Format.Event Uuid Is Valid ✅ 115ms
Event Format.Event Timestamp Is Rfc3339 ✅ 116ms
Event Format.Non Utc Event Timestamp Is Converted To Utc ✅ 116ms
Event Format.Distinct Id Is String ✅ 115ms
Event Format.Distinct Id At Root Not Properties ✅ 115ms
Event Format.Custom Properties Preserved ✅ 115ms
Event Format.Set Properties Preserved ✅ 116ms
Event Format.Set Once Properties Preserved ✅ 115ms
Event Format.Groups Properties Preserved ✅ 116ms
Event Format.Sdk Generates Uuid If Not Provided ✅ 115ms
Event Format.Event Has Required Root Fields Batch ✅ 120ms
Event Format.Event Uuid Is Valid Batch ✅ 120ms
Event Format.Event Timestamp Is Rfc3339 Batch ✅ 120ms
Event Format.Distinct Id Is String Batch ✅ 121ms
Event Format.Distinct Id At Root Not Properties Batch ✅ 119ms
Event Format.Custom Properties Preserved Batch ✅ 121ms
Event Format.Set Properties Preserved Batch ✅ 120ms
Event Format.Set Once Properties Preserved Batch ✅ 121ms
Event Format.Groups Properties Preserved Batch ✅ 120ms
Event Format.Sdk Generates Uuid If Not Provided Batch ✅ 120ms
Batch Behavior.Multiple Events In Single Batch ✅ 125ms
Batch Behavior.Batch Envelope Smoke ✅ 123ms
Batch Behavior.Flush At Triggers Batch ✅ 1013ms
Batch Behavior.Created At Reflects Batch Creation Time ✅ 116ms
Deduplication.Generates Unique Uuids ✅ 126ms
Deduplication.Different Events Same Content Different Uuids ✅ 118ms
Deduplication.Preserves Uuid On Retry ✅ 5122ms
Deduplication.Preserves Timestamp On Retry ✅ 5122ms
Deduplication.Preserves Uuid And Timestamp On Batch Retry ✅ 5125ms
Deduplication.No Duplicate Events In Batch ✅ 126ms
Header Behavior On Retry.Attempt Header Starts At One ✅ 118ms
Header Behavior On Retry.Attempt Header Increments On Retry ✅ 10126ms
Header Behavior On Retry.Request Id Preserved On Retry ✅ 5118ms
Header Behavior On Retry.Different Requests Have Different Request Ids ✅ 2229ms
Header Behavior On Retry.Request Timestamp Changes On Retry ✅ 5122ms
Response Format Validation.Success Response Has Uuid Keyed Results ✅ 116ms
Response Format Validation.Success Response Has Ok For Each Event ✅ 120ms
Response Format Validation.Success No Retry After When All Ok ✅ 119ms
Response Format Validation.Success Retry After Present When Retry Events ✅ 119ms
Response Format Validation.Success No Retry After When Drop Only ✅ 118ms
Response Format Validation.Response Echoes Request Id ✅ 115ms
Retry Behavior.Retries On 408 ✅ 5121ms
Retry Behavior.Retries On 500 ✅ 5122ms
Retry Behavior.Retries On 503 ✅ 5121ms
Retry Behavior.Retries On 504 ✅ 5121ms
Retry Behavior.Retries On 404 ✅ 5121ms
Retry Behavior.Retries On 429 ✅ 5121ms
Retry Behavior.Retries On 502 ✅ 5122ms
Retry Behavior.Retryable Errors Have Retry After ✅ 2119ms
Retry Behavior.Respects Retry After On Retryable Error ✅ 8118ms
Retry Behavior.Does Not Retry On 400 ✅ 2117ms
Retry Behavior.Does Not Retry On 401 ✅ 2120ms
Retry Behavior.Does Not Retry On 402 ✅ 2119ms
Retry Behavior.Does Not Retry On 413 ✅ 2119ms
Retry Behavior.Does Not Retry On 415 ✅ 2119ms
Retry Behavior.Non Retryable Errors Have No Retry After ✅ 2119ms
Retry Behavior.Implements Backoff ✅ 12129ms
Partial Batch Handling.Handles 200 Full Success ✅ 2118ms
Partial Batch Handling.Handles 200 With All Ok ✅ 3124ms
Partial Batch Handling.Does Not Retry Dropped Events ✅ 3123ms
Partial Batch Handling.Does Not Retry Warning Events ✅ 3122ms
Partial Batch Handling.Prunes Ok Events On Partial Retry ✅ 5124ms
Partial Batch Handling.Prunes Dropped Events On Partial Retry ✅ 5124ms
Partial Batch Handling.Retries Only Retry Events From Partial ✅ 5127ms
Partial Batch Handling.Partial Retry Preserves Uuids ✅ 5124ms
Partial Batch Handling.Partial Retry Attempt Header Increments ✅ 5125ms
Partial Batch Handling.Partial Retry Request Id Preserved ✅ 5122ms
Partial Batch Handling.Respects Retry After On Partial ✅ 5124ms
Partial Batch Handling.Unknown Result Treated As Terminal ✅ 3121ms
Partial Batch Handling.Mixed Ok Drop Warning No Retry ✅ 3128ms
Compression.Sends Gzip Content Encoding ✅ 116ms
Compression.No Content Encoding When Disabled ✅ 114ms
Compression.Compressed Body Is Decompressible ✅ 115ms
Error Handling.Does Not Retry On Unknown 4Xx ✅ 2118ms
Event Options.Cookieless Mode Override ✅ 116ms
Event Options.Disable Skew Correction Override ✅ 115ms
Event Options.Process Person Profile Override ✅ 115ms
Event Options.Product Tour Id Override ✅ 115ms
Event Options.Unset Options Omitted ✅ 115ms
Event Options.Options Override In Batch ✅ 120ms
Event Options.Unknown Option Passes Through ✅ 115ms
Event Options.Option Value Is Not Converted ✅ 115ms
Event Options.Lenient Bool Option Values Are Not Converted ✅ 114ms
Event Options.Option Wins Over Legacy Property ✅ 115ms
Event Options.Legacy Property Fills Unset Option ✅ 115ms
Event Options.Null Option Falls Back To Legacy Property ✅ 117ms
Event Size.Event Over Ceiling Is Not Sent ✅ 4234ms
Event Size.Over Ceiling Drop Is Reported Or Logged Without Content ✅ 2190ms
Event Size.Batches Close Before Byte Target ✅ 6279ms
Geoip And Historical Migration.Historical Migration Absent By Default ✅ 118ms
Property Layers.Caller Property Beats Registered Property ✅ 115ms
Property Layers.Before Send Runs Last ✅ 114ms
Fail Open.Empty Api Key Sends Nothing ✅ 1111ms
Fail Open.Personal Api Key Sends Nothing ✅ 1111ms

Feature_Flags Tests

✅ 17/17 tests passed

View Details
Test Status Duration
Request Payload.Request With Person Properties Device Id ✅ 32ms
Request Payload.Flags Request Uses V2 Query Param ✅ 17ms
Request Payload.Flags Request Hits Flags Path Not Decide ✅ 14ms
Request Payload.Flags Request Omits Authorization Header ✅ 13ms
Request Payload.Token In Flags Body Matches Init ✅ 13ms
Request Payload.Groups Round Trip ✅ 12ms
Request Payload.Groups Default To Empty Object ✅ 13ms
Request Payload.Disable Geoip False Propagates As Geoip Disable False ✅ 13ms
Request Payload.Disable Geoip Omitted Defaults To False ✅ 12ms
Request Payload.Flag Keys To Evaluate Contains Only Requested Key ✅ 13ms
Request Lifecycle.No Flags Request On Init Alone ✅ 5ms
Request Lifecycle.No Flags Request On Normal Capture ✅ 115ms
Request Lifecycle.Two Flag Calls Produce Two Remote Requests ✅ 21ms
Request Lifecycle.Mock Response Value Is Returned To Caller ✅ 14ms
Retry Behavior.Retries Flags On 502 ✅ 320ms
Retry Behavior.Retries Flags On 504 ✅ 321ms
Side Effect Events.Get Feature Flag Captures Feature Flag Called Event ✅ 122ms

@turnipdabeets
turnipdabeets force-pushed the chore/v6-posthog-ios-4 branch 3 times, most recently from b996dea to 047d564 Compare October 5, 2026 17:19
@turnipdabeets
turnipdabeets marked this pull request as ready for review October 6, 2026 22:09
@turnipdabeets
turnipdabeets requested a review from a team as a code owner October 6, 2026 22:09
@turnipdabeets turnipdabeets changed the title chore!: adopt posthog-ios 4.0 and remove deprecated APIs for v6 chore!: Flutter Major Release v6 Oct 7, 2026
@turnipdabeets
turnipdabeets force-pushed the chore/v6-posthog-ios-4 branch from 0ae4f04 to 9279d41 Compare October 7, 2026 00:31
@turnipdabeets
turnipdabeets force-pushed the chore/v6-posthog-ios-4 branch from 5fced53 to 5022778 Compare October 7, 2026 20:01
@turnipdabeets
turnipdabeets force-pushed the chore/v6-posthog-ios-4 branch from e1927f4 to a700edb 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
Comment thread .changeset/v6-hide-serialization.md Resolved
@marandaneto
marandaneto requested a review from a team October 21, 2026 11:49
turnipdabeets and others added 2 commits November 13, 2026 12:58
A plain range lets Gradle raise posthog-android past 4.x when something else
in the app asks for a newer major, and the plugin, compiled against 4.x, would
crash at runtime instead of failing the build.

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

Copy link
Copy Markdown

The Dart test jobs fail on posthog_core_failed_flags_test.dart, which #721 added to main. It runs here through the PR merge with main and fails against the capture v1 sender. Merging main and adapting that test should clear it.

#721's failed-flags test answered every request with a /flags body,
which the capture v1 sender reads as a 2xx without per-event results.
Answer only /flags with it so capture gets its default results.

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

Copy link
Copy Markdown
Contributor Author

Merged main (5.60.3) in 0cbea71. #721's test answered every request with the /flags body, so the capture v1 sender got a 2xx without per-event results; it now answers only /flags with it. flutter test passes locally (1,587), API snapshot unchanged.

Flutter 3.50.0 stable (2026-11-11) ships flutter/flutter#184590, so
`flutter build swift-package` no longer needs a podspec for a module's
plugins. Verified: a 3.50 module with posthog_flutter 6 generates and
compiles its Swift package for the iOS simulator. Modules don't target
macOS, so the module text covers iOS only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
turnipdabeets added a commit that referenced this pull request Nov 13, 2026
Keeps this branch's restructured MIGRATION.md and changeset, and carries
over what changed on #637 since the last merge:
- #730: a registered process_person_profile no longer applies to
  identity events, so "Fix identity calls" becomes "Check registered
  person processing" and the identify example goes away
- #729: Android build fails instead of crashing past posthog-android 4.x
- e1178f8: iOS add-to-app modules work on Flutter 3.50.0
- 862cdd3: capture v1 link points at /docs/api/capture-v1

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
gewenyu99 and others added 3 commits November 13, 2026 18:24
…ange (#726)

* docs: sort the Flutter 6.0.0 migration guide by when you make each change

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

* docs: keep the 6.0.0 guide's table cells to one value

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

* docs: name the platforms that move to capture v1 in the 6.0.0 guide

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

* docs: move the posthog.com Flutter SDK page into the reference

The posthog.com Flutter SDK page redirects to this reference once
6.0.0 ships, so its setup, how-to, and product 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 efbeb50)

* Revert "docs: move the posthog.com Flutter SDK page into the reference"

This reverts commit 5a477a6.

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

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

* docs: preserve flutter 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 sorted 6.0.0 migration guide

- Intro: only analytics and AI events move to capture v1; replay, logs,
  flags and web keep their endpoints
- Follow ups: say why they can wait (6.x.x still accepts the old names)
- Redirects: iOS, macOS and Android follow the same same-origin 307/308
  rule; in 5.x.x they followed redirects to any host
- Native guide links point at #prepare-your-proxy and the native
  long-ID sections, which now exist there
- Send AI events: $ai_* events sent with capture still arrive, so the
  move to captureAi stays a follow up
- Checklist items for the six sections that had none (flag values,
  batch sizes, timestamps and IDs, queued events, reachability, rollback)
- Regenerate references/posthog-flutter-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>
Brings in disableGeoIp (#720). Conflict resolutions:
- Android keeps the strict posthog-android [4.0.0, 5.0.0) range; 4.0 has
  PostHogConfig.disableGeoIp, so the plugin sets it next to the native
  beforeSend hooks.
- PostHogConfig.toMap() stays removed; disableGeoIp goes through
  channel_serialization.dart.
- The compliance adapter keeps the capture v1 client path, with the
  parameter renamed to disableGeoIp.
- ci.yml: the iOS simulator boot step from main was gated on the
  cocoapods matrix leg, which 6.0 removed, so the plugin tests would have
  run without a simulator id. It now runs for every iOS leg.

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

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

🤖 An AI agent wrote this on behalf of @ioannisj.

Nothing blocking from my side. The one thing I'd look at is the desktop beforeSend shape for a legacy $set: it doesn't match what the new PostHogEvent doc says, so a redaction written against the doc misses the value on Windows and Linux.

gewenyu99 and others added 7 commits November 19, 2026 19:10
… offline docs (#735)

* chore(flutter): bump macOS minimum to 12.0, posthog-server to 2.26.0, and add offline queue docs

* docs(surveys): fix broken Flutter and Web surveys installation links in PostHogConfig
Resolve the example apps' SwiftPM pins to posthog-ios 4.0.0 and point the
native migration guide links at the released 4.0.0 / android-v4.0.0 tags.
Windows and Linux left a legacy properties[$set] in PostHogEvent.properties,
so a beforeSend redacting via event.userProperties worked on iOS, macOS and
Android but not on desktop. Desktop now moves $set/$set_once into
userProperties/userPropertiesSetOnce like the native platforms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts: #736's backedUpQueueLength reads the analytics lane's flushAt,
since 6.0 replaced the single _flushAt with per-lane capture v1 queues; the
HTTP client keeps its connection timeout. #736's test asserted that SDK debug
values win over registered and caller properties, which 6.0 reverses (see
"Check property precedence" in MIGRATION.md), so the ported test checks the
flushAt threshold and keeps 6.0's precedence.
docs/capabilities.json still mapped the removed Posthog.getFeatureFlagPayload,
so generate_markdown_reference.py exits at 6.0.0 and publish.yml (best-effort)
would leave the 5.x reference in place for posthog.com. Promote the `next`
entries (captureAi, onFeatureFlags) and drop enable/disable. Verified by
running the generator with pubspec at 6.0.0: exit 0, no removed APIs.

getting-started.md now lists Windows and Linux and the 6.0 requirements.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@turnipdabeets
turnipdabeets marked this pull request as ready for review November 20, 2026 21:20
@veria-ai

veria-ai Bot commented Nov 20, 2026 •

Copy link
Copy Markdown

Reviews

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

PostHog Review · Standard · reviewed 9855b30: 4 Should fix. This pull request is large, so the review ran in 4 parts with less depth than usual.

This is the last automatic review of this pull request. Comment @posthog review to review new changes.

See this review and its findings in PostHog Review. Comment @posthog review --deep for a Deep review. A Deep review takes longer and looks deeper than a Standard review.

Comment on lines +524 to 526
await for (final chunk in result) {
response.add(chunk);
}

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.

P2 · Bound response-body forwarding and cancel abandoned upstream requests

When the upstream sends headers and then stalls its body, _forward waits indefinitely: _upstreamTimeout covers only upstream.close(). The SDK times out downstream, but forwarding retains its upstream socket and request buffer; retries accumulate more abandoned connections until reset. Bound body reads and cancel upstream work when the SDK disconnects.

Comment on lines +810 to +813
static Map<String, Object>? _nonNull(Object? map) => map is Map
? Map<String, Object>.from(PropertyNormalizer.normalize({
for (final MapEntry(:key, :value) in map.entries) '$key': value,
}))

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.

P2 · Preserve property types when copying desktop events

On Windows/Linux, _nonNull now normalizes properties before beforeSend. It converts List<Map<String, dynamic>> into List<Object?>, so hooks casting $exception_list throw and drop exceptions. It also stringifies objects with toJson(), replacing previously supported JSON objects with strings. Deep-copy without changing supported property representations.

properties: eventProperties,
userProperties: set,
userPropertiesSetOnce: setOnce,
options: preparedOptions == null ? null : {...preparedOptions},

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.

P2 · Deep-copy registered options before invoking callbacks

When registered options contain a nested map or list, this shallow copy retains references to the values in FileStorage. A beforeSend callback editing a nested option therefore changes subsequent events and the cached registration, violating the contract that callback changes affect only their event. Deep-copy the options before exposing them to callbacks.

Comment on lines +147 to +154
if (isUsableProjectToken(config.projectToken)) {
await platform.configure(
config,
host: host,
superProperties: _readNullableObjectMap(body['super_properties']),
);
} else {
platform.disable();

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.

P2 · Exercise SDK initialization for fail-open compliance checks

With an empty or phx_ token, /init bypasses SDK setup and disables the adapter itself. The advertised fail_open checks therefore pass without exercising SDK credential validation, hiding regressions that send personal keys or throw during setup. Harness 1.28.0 requires passing these inputs to the SDK; route them through public setup.

On macos-26-arm64 (20261117.0516.1, iOS 26.5 runtime) a new simulator's
first boot spends about 4 minutes in CoreLocationMigrator. The last green
run took 3m51s and the next two hit the 5-minute timeout.

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

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

AI-assisted review.

Reviewed 9855b3035c0f68abdc72ba87cbe131c667ffd825 (and verified 5e5e58272247256151281d052376ea3810acd285 only raises the iOS simulator boot timeout in .github/workflows/ci.yml), covering native iOS/macOS/Android delegation, the desktop Dart core, web, migration docs, and the compliance adapter.

The v6 architecture, capture v1 / captureAi framing, native bridges, feature flag listener lifecycle, and earlier review fixes (including desktop $set dedup and legacy $set -> userProperties) look solid. One confirmed Breaking regression ($exception_list type erasure dropping $exception events in desktop beforeSend) and two Concern issues (shallow-copied desktop options leaking nested mutations into FileStorage, and the PostHogConfig.disableGeoIp Dartdoc/behavior mismatch under built-event beforeSend) are inline, along with four non-blocking suggestions.

Local Base (78c5a5d0) vs Head (9855b303) regression checks ran against exact Dart SDK source under Flutter 3.35.4 / Dart 3.9.2.

/// map. Registered properties share their nested maps and lists with
/// storage, so a callback editing them in place would change later events.
static Map<String, Object>? _nonNull(Object? map) => map is Map
? Map<String, Object>.from(PropertyNormalizer.normalize({

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.

Breaking: On Windows and Linux, PosthogFlutterDesktop._prepare normalizes properties with PropertyNormalizer.normalize twice before beforeSend runs — first via _mergeUserProps -> _normalize (posthog_flutter_desktop.dart:776-784, 889-895) and again in _nonNull (posthog_flutter_desktop.dart:788-790, 810-814). Because PropertyNormalizer._normalizeValue converts every List to List<Object?>, $exception_list loses its List<Map<String, dynamic>> runtime type before hooks see it (and objects with toJson() are stringified before hooks instead of after; wire stringification itself was pre-existing on 5.x).

Contract & comparison: PosthogFlutterIO._valueFromNative (posthog_flutter_io.dart:229-248) and MIGRATION.md:467 explicitly preserve List<Map<String, dynamic>> on iOS, macOS, and Android because callbacks commonly cast $exception_list to List<Map<String, dynamic>>? and a failed cast drops the event. Executed locally against Base (78c5a5d0) vs Head (9855b303): on origin/main, a desktop beforeSend callback casting event.properties?[r'$exception_list'] as List<Map<String, dynamic>>? passed (rawType=List<Map<String, Object?>>, $exception captured and scrubbed); on this PR, the same callback throws type 'List<Object?>' is not a subtype of type 'List<Map<String, dynamic>>?' in type cast and silently drops every $exception event.

Minimal caller:

config.beforeSend = [
  (event) {
    if (event.event == r'$exception') {
      final list = event.properties?[r'$exception_list'] as List<Map<String, dynamic>>?;
      list?.first['value'] = 'scrubbed';
    }
    return event;
  },
];
await Posthog().captureException(error: StateError('secret'));

Recommendation: Consider deferring PropertyNormalizer.normalize to _captureProcessed (after beforeSend) by removing _normalize from the pre-beforeSend _prepare path (lines 776–784) and replacing PropertyNormalizer.normalize in _nonNull (lines 810–814) with a type-preserving deep copy that strips null map entries, protects FileStorage references, and preserves/reconstructs List<Map<String, dynamic>> for lists of string-keyed maps (like PosthogFlutterIO._valueFromNative). Consider adding a desktop regression test for captureException with a List<Map<String, dynamic>>? cast in beforeSend.

properties: eventProperties,
userProperties: set,
userPropertiesSetOnce: setOnce,
options: preparedOptions == null ? null : {...preparedOptions},

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.

Concern: PosthogFlutterDesktop._prepare shallow-copies prepared.options ({...preparedOptions} at posthog_flutter_desktop.dart:798), retaining live references to nested Map/List values cached in FileStorage._cache. Unlike properties (which _nonNull deep-copies specifically to prevent storage mutation, lines 807–809), a beforeSend callback mutating a nested registered option in place corrupts the cached registration and leaks into subsequent events.

Impact & reachability: All four currently known capture v1 options are scalars, so this affects only custom/structured options passed to registerOptions() (which Posthog.registerOptions and Posthog.capture explicitly accept as Map<String, Object?> and forward unchanged). Verified locally on 9855b303: registering {'custom': {'tags': ['a']}} and mutating tags.add('mutated') only on 'first' caused 'second' to be sent with tags: ['a', 'mutated'] instead of ['a'].

Recommendation: Consider deep-copying preparedOptions here (reusing the same deep-copy helper used for eventProperties) and adding a regression test in posthog_flutter_desktop_test.dart.

r'$process_person_profile': _hasPersonProcessing(),
r'$session_id': managedSessionId,
r'$is_identified': _isIdentified(),
if (_disableGeoIp) r'$geoip_disable': true,

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.

Concern: PostHogConfig.disableGeoIp (posthog_config.dart:211-212) still guarantees: "The SDK adds the property after [beforeSend] runs, so a callback can't see or remove it." Under v6's built-event beforeSend, $geoip_disable: true is now added before beforeSend on all five non-web platforms (iOS, macOS, Android, Windows, Linux).

Observed Base vs Head comparison: Verified locally on Desktop (and by source inspection on iOS/Android buildEventForWrapper):

  • With config.disableGeoIp = true and a beforeSend returning PostHogEvent(event: e.event, properties: {'allowed': 'yes'}, options: e.options): on origin/main (78c5a5d0), beforeSend saw null and the wire event carried $geoip_disable: true; on this PR (9855b303), beforeSend sees true and $geoip_disable is stripped from the wire event (silently re-enabling GeoIP enrichment).
  • With config.disableGeoIp = true and caller properties: {r'$geoip_disable': false}: origin/main sent true, while 9855b303 sends false on Desktop (posthog_core.dart:200) and iOS (PostHogSDK.swift:869-871), whereas Android (PostHog.kt:1009-1012) explicitly stamps $geoip_disable = true after caller merge.

MIGRATION.md (Review beforeSend callbacks, lines 458–463) warns about dropping process_person_profile: false when replacing event.options, but doesn't warn about $geoip_disable: true when replacing event.properties.

Recommendation: Consider deciding between:

  1. Documenting the native 4.0 semantics (matching posthog-ios 4.0 and posthog-android 4.0, which don't promise beforeSend cannot see/remove $geoip_disable): update posthog_config.dart:211-212, add a disableGeoIp callout in MIGRATION.md under Review beforeSend callbacks, and decide whether Desktop (posthog_core.dart:200) should match Android (enforce after caller merge) or iOS (document the divergence / align cross-SDK).
  2. Keeping the Dartdoc privacy guarantee by re-applying $geoip_disable: true after beforeSend when config.disableGeoIp == true.

/// Callbacks can be synchronous or asynchronous (returning
/// `FutureOr<PostHogEvent?>`).
typedef BeforeSendCallback = FutureOr<PostHogEvent?> Function(
/// Callbacks are synchronous, as in the native SDKs, so the event is sent

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.

Suggestion: The Dartdoc for BeforeSendCallback (posthog_config.dart:13-14, just above) still says "The [event] argument contains the event name and user-provided properties that are about to be captured", which is stale after v6 switched iOS, macOS, Android, Windows, and Linux to pass the built event (system properties, registered properties, options, uuid, distinctId, timestamp) as documented on PostHogEvent (posthog_event.dart:6-8, 24-31) and PostHogConfig.beforeSend (posthog_config.dart:459-467).

Consider updating lines 13–15 to reflect the built-event contract on non-web platforms (and note that web still passes only user-provided properties) so IDE tooltips and the generated reference stay consistent.

timeout: lane.timeout);
if (response.status != 307 && response.status != 308) return response;
final location = response.location;
final target = location == null ? null : url.resolve(location);

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.

Suggestion: In _fetchCaptureV1 (posthog_core_stateless.dart:972), url.resolve(location) is unguarded. If a proxy returns a 307 or 308 with a malformed Location header (e.g. http://[::1), url.resolve throws FormatException instead of treating the redirect as unfollowable — skipping the redirect warning, leaving lane.pendingIdentity uncleared, and surfacing FormatException instead of PostHogFetchHttpError (unlike the contract at lines 869–870 and 953–956). Verified locally on 9855b303: a 307 with Location: http://[::1 caused DesktopPostHog.flush() to throw FormatException instead of PostHogFetchHttpError.

Consider wrapping url.resolve(location) in a try/on FormatException (falling back to target = null) so malformed redirects take the existing terminal-return path, and adding a test in capture_v1_test.dart.

}

await platform.resetAdapterState();
if (isUsableProjectToken(config.projectToken)) {

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.

Suggestion: In /init (adapter_server.dart:147-155), the compliance adapter calls isUsableProjectToken(config.projectToken) directly and branches to platform.disable(), bypassing Posthog().setup(config). Production Posthog().setup (posthog.dart:77) uses the same helper and is unit-tested in posthog_test.dart:58-72, 164-195, so production behavior is covered — however, the advertised fail_open compliance capability currently validates isUsableProjectToken rather than the public Posthog().setup entry point.

Consider routing /init through Posthog().setup(config) (by binding PosthogFlutterPlatformInterface.instance to the PosthogFlutterDesktop instance and treating created == null as disabled, with Posthog().close() in resetAdapterState()) so compliance runs exercise the real public setup path end-to-end.

});
headersSent = true;
// Not addStream: a failing body would take the response down with it.
await for (final chunk in result) {

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.

Suggestion: In _RecordingProxy._forward (adapter_server.dart:504-526), _upstreamTimeout bounds waiting for response headers (upstream.close()), but await for (final chunk in result) has no timeout. If the mock server sends headers and then stalls the body, the SDK times out and retries while _forward keeps the upstream connection and buffered request body alive until /reset force-closes _client.

Consider bounding body streaming with result.timeout(_upstreamTimeout) (aborting/closing on timeout or downstream close) so stalled-body scenarios don't accumulate abandoned sockets during compliance runs.

@dustinbyrne
dustinbyrne requested a review from a team November 20, 2026 22:13

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.

$locale collected different from iOS

6 participants