Repository navigation
fix: preserve caller properties during event serialization - #81
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.
Summary
Calling
get_event_body()currently edits dictionaries supplied to a public event: it removesNoneentries, converts enum values, and recursively truncates strings in nested dictionaries/lists. For example, serializingBaseEvent("example", event_properties=properties)removesproperties["empty"]when its value isNone. Returned nested containers also alias the original event data.Copy dictionary-valued fields before payload normalization. This preserves the existing outgoing payload format while leaving caller-owned and stored event properties intact. Other field types keep their existing handling.
Add seven public serialization tests covering event/user/group properties, groups, nested containers, returned-body independence, repeated serialization, and falsy-value controls. Five tests fail before the change, while two controls pass.
Validation: the repository's full unittest command passes all 125 tests on Python 3.12. Changed files compile and
git diff --checkpasses. No hosted Amplitude requests or full Python-version matrix run. No repository lint configuration was found.AI-assisted contribution; maintainer review pending.
Checklist