fix: omit null object properties when serializing events - #810
Draft
marandaneto wants to merge 2 commits into
Draft
fix: omit null object properties when serializing events#810marandaneto wants to merge 2 commits into
marandaneto wants to merge 2 commits into
Conversation
Contributor
posthog-ios Compliance ReportDate: 2026-09-09 09:05:55 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
|
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
Custom event properties containing
NSNull()currently retain null object members in serialized events. This implements the recursive serialization rule in sdk-specs PR #60 at the shared native event serializer, without requiring callers or wrappers to filter inputs.PostHogEvent.toJSON()now omits null-valued custom object members, including nested objects inside arrays. Null array entries keep their positions. Empty objects, other scalar values, caller-owned data and existing public input types remain unchanged. The same serializer serves event queues and final batch/snapshot delivery, including restored events. Legacy queue rewrites also clean custom properties and the old envelope-level$setfield.Typed replay, exception and feature-flag metadata retain their existing event-specific null semantics. Generic storage and OTLP serialization are unchanged. This change belongs in the native SDK rather than an additional Flutter serialization pass.
💚 How did you test it?
git diff --checkpassed.Remaining validation gates: Full SDK/example builds, the full test suite, Objective-C callers, public capture-to-hook integration, replay-buffer integration and the Apple simulator/platform matrix were not run locally. Existing broad tests use shared application-support storage, so they were not rerun in this environment. Public signatures were source-checked, not validated through the full compiled API check. Hosted CI at commit
c391c7e941633a1f920d5205a4d23c30ee424e9ehad 38 passing checks, one neutral check and six pending checks at 2026-09-09 08:59 UTC. SDK platform builds, example builds, downgrade compatibility, lint and the public API snapshot passed. The main test job, iOS simulator tests, replay masking snapshots, CocoaPods lint, Swift CodeQL and compliance tests were still running after a bounded watch. CI is not yet fully green. This is a draft for human review, not merge or release approval.📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset file.A patch changeset for
posthog-ioswas added by hand. No package manager command, release or manual version bump was performed.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Pi assisted with the implementation and publication using Git, GitHub CLI, make, SwiftFormat, SwiftLint and the isolated autoreview helper. The human-directed scope keeps null cleanup in the native event serializer and preserves typed metadata semantics. No public session transcript is available. Human review and the remaining platform validation are required before merging.