Skip to content

Fix 1DS serialization of frozen event data - #2805

Merged
Jackson Weber (JacksonWeber) merged 5 commits into
microsoft:mainfrom
JacksonWeber:jacksonweber-frozen-event-serialization
Nov 26, 2026
Merged

Jackson Weber (JacksonWeber) merged 5 commits into
microsoft:mainfrom
JacksonWeber:jacksonweber-frozen-event-serialization

Conversation

@JacksonWeber

Copy link
Copy Markdown
Contributor

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.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 18, 2026 22:39

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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

Comment thread channels/1ds-post-js/src/Serializer.ts Resolved
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
}

function _copyEventValue(value: any) {
return objDeepCopy(value, (details) => {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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>
@JacksonWeber
Jackson Weber (JacksonWeber) merged commit 8b8939f into microsoft:main Nov 26, 2026
9 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.

3 participants