fix: warn about off-main view layout in debug mode - #815
Merged
Conversation
Contributor
|
Reviews (1): Last reviewed commit: "fix: warn about off-main view layout in ..." | Re-trigger Greptile |
Contributor
posthog-ios Compliance ReportDate: 2026-09-10 08:10:31 UTC ✅ All Tests Passed!45/45 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 16/16 tests passed View Details
|
ioannisj
approved these changes
Sep 10, 2026
ioannisj
left a comment
Contributor
There was a problem hiding this comment.
Not sure if warning about misuse of main thread should be this SDK's responsibility tbh. Esp since Main Thread checker is on by default for debug builds? Harmless change though so up to you
Member
Author
only with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
💡 Motivation and Context
Related to #806. The layout hook forwards to UIKit before notifying PostHog, so an exception in UIKit can occur before the existing notification thread check. The investigation reproduced the crash path with and without the hook. The customer's production trigger remains unproven.
This adds a debug-gated warning before forwarding an off-main layout call. A dedicated lock makes the warning once per process. Calls while debug logging is disabled do not consume it, and restarting the layout subscription does not reset it.
UIKit forwarding remains synchronous on the calling thread. PostHog notifications still run on main. There is no layout suppression, new public option, or scheduler redesign. The lifecycle reproductions in #814 and the architecture proposal in #813 remain separate work.
💚 How did you test it?
make test,make format, andmake lintpass after syncing with main.make buildpasses all SDK platforms and platform examples, then fails in the external-SDK client example because its package reference assumes the checkout directory is namedposthog-ios. The worktree is namedposthog-ios-issue-806. CocoaPods examples were not reached.origin/mainpassed for88a4f5d0cfd80df9bf3d1c2bf9333aea8338d58fwith no actionable findings.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file. A patch changeset was added directly.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Manoel directed the scope. Pi used file read/edit tools, shell commands, GitHub CLI, make-based validation, and isolated Pi autoreview. Investigation details are in #806.
The chosen change is diagnostic only. We explicitly rejected changing UIKit layout timing, adding a suppression flag, or claiming that the SDK's presence in the crash stack proves causation. A separate draft contains the lifecycle reproductions. Human review is required.