Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bound maximum serialization depth to < 128, similar to serde_json #1757

Merged
merged 2 commits into from
Nov 5, 2024

Conversation

jgraettinger
Copy link
Member

@jgraettinger jgraettinger commented Nov 4, 2024

Restrict the maximum serialization depth of documents to < 128, which guarantees they can be parsed by serde_json and other tools like jq which limit maximum recursion.

We want this to be universal, because we never want serde_json to be unable to parse collection documents or loaded flow_document columns, and its limit on maximum depth has well-founded motivations: it would be inappropriate to, for example, completely disable limits on recursion, so we follow serde_json's lead in this regard.

Workflow steps:

(How does one use this feature, and how has it changed)

Documentation links affected:

(list any documentation links that you created, or existing ones that you've identified as needing updates, along with a brief description)

Notes for reviewers:

(anything that might help someone review this PR)


This change is Reviewable

SerPolicy now tracks node depth and omits array items or object
properties which would violate a bound on maximum document depth.

This is largely motivated by serde_json: in all conditions,
we never want to emit a document which cannot be parsed by serde_json.

The serde_json limit of 128 is generous so we follow their lead.
When these occur, it can be tedious to track down which binding caused
the failure. Adding the source or target collection name is key
debugging info to aide in investigations.
Copy link
Member

@psFried psFried left a comment

Choose a reason for hiding this comment

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

LGTM

@jgraettinger jgraettinger merged commit 440f0a3 into master Nov 5, 2024
3 checks passed
@jgraettinger jgraettinger deleted the johnny/depth-truncate branch November 5, 2024 15:31
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.

2 participants