fix: omit null object properties when serializing events - #204
Draft
marandaneto wants to merge 2 commits into
Draft
fix: omit null object properties when serializing events#204marandaneto wants to merge 2 commits into
marandaneto wants to merge 2 commits into
Conversation
Contributor
posthog-elixir Compliance ReportDate: 2026-09-09 10:41:49 UTC ✅ All Tests Passed!46/46 tests passed Capture Tests✅ 29/29 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
Event properties currently keep null object members on the wire. This implements the capture contract in sdk-specs #60 at the shared batch boundary, after enrichment and
before_send.Null object members are omitted recursively. Array positions, empty objects, false, zero, strings, and nullable envelope fields stay intact. Jason encoder output keeps duplicate members and precise numeric tokens. Only event-specific exception metadata and generated feature-flag response fields retain their intentional nulls. Privacy-filtered fields are not recreated. Flags requests are unchanged.
💚 How did you test it?
1e400without Decimal. No dependencies changed.34f0aa9bd9aef03b48e2c4e3bf5512400013a951against0208567b4790f51be431af23b22241a0d83446b3, with TruffleHog clean and no findings.Local validation used Elixir 1.20.4, OTP 29, and Jason 1.4.5 with existing offline dependencies. SDK requests terminate at Req adapters or API mocks with fake keys. The test application was disabled and integration config absent. This is not system-wide DNS/socket denial, live-backend testing, a full suite, minimum-runtime coverage, or a performance benchmark. This SDK has no event disk queue. Shared compliance harness gaps remain outside this change. Hosted CI reached 28 passing checks at the same head, including the supported runtime matrix and compliance workflow. The compliance harness has known null-policy fixture and assertion gaps, so its success is not independent proof of this contract.
The first CI attempt failed in Elixir 1.17/OTP 26 with two
Logger.flush/ExUnit.CaptureLogerrors about a missing default logger handler. Five sibling jobs were cancelled by fail-fast. After inspecting the logs, one failed-jobs rerun was approved for a suspected logger-handler race. Attempt 2 passed at the unchanged SHA, including all six failed or cancelled jobs. No source or test changes were made for the rerun. The race classification is suspected, not a proven baseline defect.📝 Checklist
If releasing new changes
sampo addto generate a changeset fileThe existing repository-native Sampo patch entry uses
hex/posthog: patch. It was authored directly without installing or running Sampo. No release is requested.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Pi assisted with implementation, local validation, and this draft under marandaneto's direction. Tools included Git, Mix, Jason, GitHub CLI, and the installed isolated Pi autoreview helper. Session reference:
09dfe7ee-3109-49db-82c8-ae60d5a5b2af(local session, no public transcript).The change stays at the shared API.batch boundary. It does not add a blanket reserved-property exemption, Decimal dependency, or wrapper-specific serializer. Human review is required before merging. This PR remains a draft.