You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Port the excessive sequence length guardrail from the JS reference implementation: a new optional sequence option caps the length of any sequence created during evaluation, including intermediate sequences, raising D2015 when exceeded. The range operator and $append also check the size of their result up front. Also update the D2014 message to match the 1e7 limit that is already enforced.
Port the excessive sequence length guardrail from the JS reference
implementation: a new optional `sequence` option caps the length of any
sequence created during evaluation, including intermediate sequences,
raising D2015 when exceeded. The range operator and $append also check
the size of their result up front. Also update the D2014 message to
match the 1e7 limit that is already enforced.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Sequence-limit enforcement remains incorrect: wildcard results can bypass the limit after a bounded accumulator becomes an unbounded list, while an off-by-one range length rejects valid exact-limit results.
Address review comments:
- $append returned an unbounded copy, so callers that keep growing the
result, such as evaluate_wildcard, bypassed the max sequence length.
- RangeList reported one more item than it holds, so a range of exactly
the max sequence length raised D2015.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Sequence-limit errors report the attempted length instead of the configured maximum, and returned lists retain bounds that incorrectly restrict caller mutations after evaluation.
This passes the attempted length into D2015, but its message describes that value as the configured maximum. For example, [0..1001] with sequence=1000 reports “The maximum sequence length of 1002 was exceeded,” and $append has the same problem. Pass max_length instead so the message and JException.current agree with the configured limit and with BoundedJList._check.
Address review comment: a BoundedJList kept enforcing the max sequence
length it was created with, so a returned result raised D2015 when the
caller grew it after evaluate() finished. It now checks the max sequence
length of the evaluation in progress on the thread, if any.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The sequence limit is checked only after wildcard flattening copies the entire array, so intermediate allocations can still exhaust memory.
No open issues 🎉
1 previously missed issue
In code that hasn't changed since last review
Bound flattening accumulator to prevent oversized intermediate allocations
src/jsonata/functions.py:2055
This check runs after evaluate_wildcard has flattened each array into an ordinary list (src/jsonata/jsonata.py:709–710, 717–718). With sequence=2, a large input array is therefore copied in full before D2015 is raised, so the intermediate allocation can still exhaust memory. Make the accumulator in Jsonata.flatten bounded so it checks the limit as it grows.
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
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.
Port the excessive sequence length guardrail from the JS reference implementation: a new optional
sequenceoption caps the length of any sequence created during evaluation, including intermediate sequences, raising D2015 when exceeded. The range operator and $append also check the size of their result up front. Also update the D2014 message to match the 1e7 limit that is already enforced.