Skip to content

test: an event JSON cannot serialize is dropped alone - #1138

Draft
eli-r-ph wants to merge 1 commit into
v1from
eli/v1-circular-reference-test
Draft

eli-r-ph wants to merge 1 commit into
v1from
eli/v1-circular-reference-test

Conversation

@eli-r-ph

Copy link
Copy Markdown
Contributor

💡 Motivation and Context

The 8.0 migration guide says an event that can't be serialized to JSON, such as one with a circular reference, is dropped and logged. Since #1120 removed the non-finite case, no test checks that such an event costs only itself and not its batch.

  • Add a circular-reference case to test_malformed_before_send_event_does_not_stop_consumer_or_shutdown: the bad event is dropped, the valid event in the same batch is sent, and the consumer and shutdown still finish.

💚 How did you test it?

pytest posthog/test/test_before_send.py -k malformed: 2 passed. Without the per-event serialization guard, the whole batch fails to serialize and the valid event is never sent, so the case fails.

📝 Checklist

  • I reviewed the submitted code.
  • I added tests to verify the changes.
  • I updated the docs if needed.
  • No breaking change or entry added to the changelog.

🤖 Agent context

Autonomy: Human-driven (agent-assisted)

Claude Code (Claude Opus 5.5) added this test in response to a review comment on #1120.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@eli-r-ph eli-r-ph self-assigned this Oct 28, 2026

This branch has not been deployed

No deployments
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.

1 participant