fix: omit null object properties from serialized events - #319
Draft
marandaneto wants to merge 1 commit into
Draft
Conversation
Contributor
posthog-dotnet Compliance ReportDate: 2026-09-09 08:56:51 UTC ✅ All Tests Passed!17/17 tests passed 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 retain null-valued object members on the wire. This implements the recursive omission rule in sdk-specs PR #60 without narrowing supported public inputs.
The core event serializer and immediate capture boundary now omit those members after enrichment and hooks. Arrays keep their null positions. Empty objects, other scalar values, ordered duplicate and case-distinct property names, and caller-owned data are preserved. Generic JSON serialization for flags and caches is unchanged. Only the root
$exception_liston$exceptionkeeps its existing typed metadata semantics.AI events use the same core serializer, with no AI-specific cleanup. A patch changeset selects only
PostHog, where the production change lives. No versions or dependencies are changed.💚 How did you test it?
1886b0f5d701982624d5a2fd57111318a2d7ada8againsteadb15eaa78ee86469f9841eb23b8b14770b9e96, with no findings.Validation limits: Tests ran on .NET 9.0.19 with major-version roll-forward, not actual .NET 3.1/8 runtimes. netstandard2.0 has build-only evidence. The preexisting ReadOnlyDictionary converter stack overflow remains deferred and is not newly declared unsupported. The full suite, minimum-runtime matrix, AI streaming/error paths, retries, every immediate API and performance were not validated locally. This SDK has no disk-backed event queue. These gaps remain open for human review and are not cleared merge or release gates.
📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset fileA core-only patch changeset was written directly. The package-manager command was not run.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Pi agents assisted with implementation, focused validation and review using Git, the .NET CLI, the isolated autoreview helper and GitHub CLI. @marandaneto directed the work and is the DRI. Session details remain private.
The change stays in the shared core serializer rather than duplicating policy in AI. Ordered JsonElement traversal replaced an earlier mutable-object approach that rejected supported duplicate/case-distinct keys. This is a draft for human review, not release approval.