Skip to content

fix: accept non-finite typed event numbers as null - #5

Merged
marandaneto merged 3 commits into
mainfrom
fix/non-finite-event-properties-20261022
Oct 23, 2026
Merged

marandaneto merged 3 commits into
mainfrom
fix/non-finite-event-properties-20261022

Conversation

@marandaneto

@marandaneto marandaneto commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Motivation and context

Validated on UE 5.8.4 / macOS arm64.

Typed NaN and positive/negative infinity currently create invalid PostHog values. SetNumber refuses them, and one such array element makes the whole array unusable.

Normalize these numeric inputs to JSON null. Existing capture cleanup omits null object members and retains null array slots. Finite values and caller-supplied strings such as "NaN" stay unchanged. Related Python work: PostHog/posthog-python#1081. This does not imply that PR is merged.

SetNumber now succeeds for non-finite numbers and replaces an existing value with null. Callers relying on rejection should explicitly check finiteness. Public signatures are unchanged. Native-object import and dependency paths are not modified.

How did you test it?

Engine-backed validation now completed on UE 5.8.4, macOS arm64, Xcode 26.6, Rust 1.94.1, and Python 3.14.7:

  • Native bridge and example Editor Development builds succeed.
  • All 9 Python native integration tests pass, including 8 successful Unreal automation tests and the real Rust/HTTP wire assertions.
  • All 5 Rust bridge unit tests pass.
  • Direct, nested, array, and post-BeforeSend NaN/positive and negative infinity cases are covered, along with finite controls, explicit nulls, retained array positions, strings, booleans, caller-input preservation, redaction, and invalid-value rejection.
  • Negative control: temporarily removed only the post-hook cleanup, retained the regression tests, and rebuilt. The editor integration test failed at assertNotIn("computed", numeric), observing "computed": null, including inside nested/array objects. Restoring the cleanup and rebuilding made the full suite pass.
  • Python syntax and whitespace checks pass.

Review fix (c003382): clean null object members on a fresh native property copy after BeforeSend, immediately before serialization. Follow-up (67ad5ae): count Unreal's successful-with-warnings tests correctly without relaxing the zero-failure assertion. The engine emits an unrelated iOS device-discovery warning (idevice_id: Bad CPU type); its report contains seven plain successes, one success with warnings, and zero failures. All eight individual test states are Success.

Build/test commands:

export DEVELOPER_DIR=/Applications/Xcode-26.6.0.app/Contents/Developer
export UE_ROOT="/Users/Shared/Epic Games/UE_5.8"
export POSTHOG_RS_PATH="$PWD/artifacts/posthog-rs-embedding"
./scripts/build-native.sh aarch64-apple-darwin
./scripts/build-example.sh
python3 Tests/native_integration.py \
  --library rust/target/aarch64-apple-darwin/release/libposthog_unreal_ffi.dylib \
  --mock-server artifacts/server.py \
  --editor "$UE_ROOT/Engine/Binaries/Mac/UnrealEditor-Cmd"

The required development Rust embedding implementation was checked out at immutable PostHog/posthog-rs commit 9814a7035b8f47cf693bcc8e539ca27a80aab796; repository dependency pins and lockfile are unchanged. The maintained mock backend is PostHog/posthog-js's tooling/sdk-mock-server at 42bc585c68fade51403680b08af32f900a7b6db3, started through a launch-only Python-to-Node shim in ignored artifacts. No backend behavior was modified; its 25 unit tests also pass. Xcode 27.1 hit a Rust procedural-macro linker error, so these commands use the installed Xcode 26.6 without changing the global selection.

Logs and detailed reproduction notes are retained in the worktree's ignored artifacts/pr-5-validation.md. This validates the local development build, not distributed prebuilt-plugin installation, packaged games, other architectures/platforms, or other UE versions. Independent autoreview previously covered the original head (1d406fe); no new independent autoreview is claimed for the follow-ups.

Checklist

  • I reviewed the submitted code.
  • I added or updated tests where applicable.
  • I updated the documentation where needed.
  • I described any breaking changes and their migration path.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Human DRI: marandaneto. A Pi implementation worker used local file, shell, Git and direct HTTP/GitHub CLI tools under maintainer direction. It made a one-line typed Number fallback change with tests and documentation, deliberately leaving native import and dependencies alone. A separate isolated Pi autoreview checked the original commit. Review follow-ups added post-hook cleanup and tests, then were validated with actual UE 5.8.4 builds, regression negative-control execution, native/HTTP integration, and Rust tests. Human review is required.

@marandaneto marandaneto self-assigned this Oct 22, 2026
@marandaneto
marandaneto marked this pull request as ready for review October 22, 2026 14:39
@marandaneto
marandaneto requested a review from a team as a code owner October 22, 2026 14:39

@posthog posthog Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PostHog Review · Standard · reviewed 1d406fe: no findings.

This Standard review started from the posthog-review label. Comment @posthog review --deep for a Deep review, or @posthog help to see all commands.

@posthog posthog Bot removed the posthog-review label Oct 22, 2026
@marandaneto

Copy link
Copy Markdown
Member Author

@dustinbyrne or @ioannisj since you have the env. ready, its easier for you both review/test this

@dustinbyrne dustinbyrne left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The typed-number normalization is scoped, and UE-backed base/head regression checks confirm the intended behavior. One optional post-hook cleanup edge is noted inline. The pending full native/editor integration should still run before merge.

AI-assisted review.

Comment thread Source/PostHog/Private/PostHogProperties.cpp
@marandaneto
marandaneto merged commit 97d187e into main Oct 23, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants