Repository navigation
Fix 1DS serialization of frozen event data - #2805
Jackson Weber (JacksonWeber) merged 5 commits into
Conversation
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
Frozen class instances can still cause events to be dropped because recursive serialization writes into them, requiring writable output targets and a regression test.
1 open issue
What changed in this PR
This PR updates the 1DS post channel serializer to handle frozen nested event data and report serialization failures without interrupting the rest of a batch.
Changes:
- Copy nested records before sanitization and compound-key processing.
- Pass the channel diagnostic logger into the serializer for failure reporting.
- Add regression tests for deeply frozen input and mixed successful/failed events.
| File | Description |
|---|---|
channels/1ds-post-js/test/Unit/src/SerializerTest.ts |
Adds frozen-input and batch-failure regression tests. |
channels/1ds-post-js/src/Serializer.ts |
Copies nested values and safely logs serialization errors. |
channels/1ds-post-js/src/HttpManager.ts |
Supplies the channel logger to the serializer. |
Review effort: Balanced
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
| } | ||
|
|
||
| function _copyEventValue(value: any) { | ||
| return objDeepCopy(value, (details) => { |
There was a problem hiding this comment.
Can we preserve toJSON on nested values too? objDeepCopy drops a nested record's non-enumerable toJSON, so a value that previously serialized to a custom string now sends its raw fields instead. The guard only protects the root of the copied branch.
There was a problem hiding this comment.
The copy now preserves nested toJSON methods. I added a test that checks the same value as both an object property and an array item, so we know each gets the right key.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

The 1DS post channel could drop an event when serialization tried to write sanitized fields back into frozen input. The serializer now copies nested records before processing them. When a different serialization error occurs, it reports the exception through the channel's diagnostic logger and drops only the affected event.
Added regression tests for deeply frozen input and for a batch containing both a readable and an unreadable event. All 17 serializer tests passed in headless Chrome (147 assertions), and the post channel compiled to ES5. The full Grunt suite and repository lint were not run successfully because dependency restore failed during a TLS handshake.