Repository navigation
fix: sanitize datetime and NaN values inside tuple payloads - #139
Draft
Kayvan-Zahiri wants to merge 1 commit into
Draft
Kayvan-Zahiri wants to merge 1 commit into
Kayvan-Zahiri wants to merge 1 commit into
Conversation
This branch has not been deployed
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.
The shared serializer recursively converts datetimes to timestamps and NaN to null inside dictionaries and lists, but skips tuples. Requests already accepts tuples as JSON arrays, so an otherwise accepted tuple fails JSON preparation as soon as it contains a datetime or NaN. This affects profile attributes, event data, Track v2 batch attributes, and transactional message data before any request is sent.
Treat tuples like lists during recursive sanitization. The original containers are not modified; JSON array output for native scalar tuples stays unchanged.
Five new unittest cases exercise 40 public-call combinations: identify, track, batch, and send_email, each with connection pooling enabled and disabled, across tuple datetimes, tuple NaN, deeply mixed containers, and native-tuple/list controls. A local recording requests adapter captures prepared request bodies without contacting the API. Before the fix, 24 combinations error during JSON preparation; 16 controls pass. Afterward, all new cases pass. Full repository unittest suite:65 tests pass using the existing local HTTPS test server. Repository-wide Ruff lint/format and git diff --check pass. No live Customer.io request or email was sent during testing.
Developed with Codex assistance; reproduced and verified locally.