Repository navigation
fix: serialize non-finite event properties as null - #150
Merged
Merged
Conversation
Contributor
posthog-unity Compliance ReportDate: 2026-10-22 11:57:10 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
|
turnipdabeets
approved these changes
Oct 22, 2026
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
Numeric NaN and infinities currently produce invalid JSON in queued analytics events. Reloading those events can truncate following properties or stall on arrays, preventing a healthy neighboring event from flushing.
Serialize non-finite float and double values as JSON null, preserving object members and array positions. Finite values, literal strings, caller input, and existing null behavior remain unchanged. The fix stays in the numeric writer, without changing parser or queue policy.
Related Python work: PostHog/posthog-python#1081. The shared capture, HTTP-client, and event-batcher specs do not explicitly define non-finite handling.
💚 How did you test it?
Regression tests failed before the fix and pass afterward for float/double NaN and both infinities, nested dictionaries, arrays, and objects inside arrays. They check strict persisted JSON, actual queue reload, and a batch containing a healthy event.
Focused neighboring tests: 146 passed. Full managed-code suite: 540 passed, 3 existing skips. Formatting, netstandard2.1 Unity-stub build, and public API checks passed. Final signed-commit branch autoreview passed without actionable findings. Real Unity/platform execution was not performed.
📝 Checklist
If releasing new changes
pnpm changesetto generate a changeset fileA patch changeset was written directly in the documented format.
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Human DRI: @marandaneto.
A coding agent used local bash/.NET tooling and the pr, karpathy-guidelines, test-audit, and autoreview skills for a maintainer-directed fix. The serializer substitutes null only for numeric non-finite values. Parser hardening, historical malformed-record repair, and unrelated null behavior are outside this change. Human review is required.