fix: omit null object properties when serializing events - #935
Draft
marandaneto wants to merge 2 commits into
Draft
fix: omit null object properties when serializing events#935marandaneto wants to merge 2 commits into
marandaneto wants to merge 2 commits into
Conversation
Contributor
posthog-python Compliance ReportDate: 2026-09-09 09:37:47 UTC ✅ All Tests Passed!111/111 tests passed Capture_V1 Tests✅ 94/94 tests passed View Details
Feature_Flags Tests✅ 17/17 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
Nonecurrently reach ingestion as JSON null object members. This implements the recursive serialization rule in PostHog/sdk-specs#60 without restricting existing public inputs.A shared private helper removes null object members at event sizing and wire boundaries for synchronous, threaded, and native async delivery across v0/v1. Manual AI capture keeps its existing delivery route. Null array slots, newly empty objects, other scalar values, caller inputs, and hook-driven drops remain unchanged. Existing typed exception metadata and nullable generated feature-flag response metadata keep their field-specific semantics. Non-event requests are unchanged.
💚 How did you test it?
e50a4f6b650772f30a4d11a49e0920585d921d08against maine823b3e557e666fda72516d8ed75630ceb758559, with no actionable findings.e50a4f6b650772f30a4d11a49e0920585d921d08, including Python 3.10-3.14 tests/imports, package build, MCP/OpenFeature/Django jobs, and capture v0/v1 compliance jobs. Hosted compliance success does not establish null-policy harness coverage or clear the local limitations below.Not validated locally: the full suite, minimum Python runtime matrix, generated
posthoganalyticsmirror, provider/framework/MCP/OpenFeature integrations, deflate/zstd-specific null wire cases, performance, live backend, or every flag HTTP-error permutation. Disk persistence is not applicable. These remain human merge/release gates, not passed checks.📝 Checklist
If releasing new changes
sampo addto generate a changeset fileAn equivalent
pypi/posthog: patchentry was written directly under.sampo/changesets/. No package-manager or release command was run.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Implemented and prepared with Pi, Git, GitHub CLI, pytest, Ruff, mypy, and the isolated autoreview helper. The human-directed scope keeps normalization in the shared Python SDK, preserves typed metadata and supported inputs, and does not provision example dependencies or generate the mirror package. The private agent session is not shared. Human review is required. This PR remains a draft and will not be auto-merged.