Repository navigation
Fix Timebox depth leak on array/object constructors #120 - #121
Open
lawrencej004 wants to merge 2 commits into
Open
lawrencej004 wants to merge 2 commits into
lawrencej004 wants to merge 2 commits into
Conversation
The array constructor and evaluateGroupExpression set environment.isParallelCall for every item after the first but never reset it, so the exit callback for the constructor itself was skipped and Timebox depth grew by one per evaluation. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
lawrencej004
marked this pull request as ready for review
October 6, 2026 10:50
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Fixes #120
Problem
With
Frame.setRuntimeBounds(timeout, maxDepth)set, evaluating an array constructor with 2+ items, or an object constructor with 2+ keys, inside a loop fails withStack overflow error ... Depth=N+1 max=Nonce the loop runs more thanmaxDepthtimes, even though nothing recurses.The array constructor and
evaluateGroupExpressionsetisParallelCall = idx > 0on the environment for each item but never reset it. Whenevaluatethen fires the exit callback for the constructor itself, the flag is stilltrue, soTimeboxskips the decrement for an entry it counted. Depth grows by one each time the constructor is evaluated.Fix
Save
isParallelCallbefore each loop and restore it afterwards. It's restored to the previous value rather than set tofalse, so a constructor nested as a non-first item of another constructor (e.g.[$i, [$i, $i]]) still has its skipped entry matched by a skipped exit.Tests
New tests in
RuntimeTest, all withmaxDepth=10and a 30-iteration$map:testRuntimeBoundsArrayConstructorInLoop:[$i, $i]testRuntimeBoundsNestedArrayConstructorInLoop:[$i, [$i, $i], $i]testRuntimeBoundsObjectConstructorInLoop:{'a': $i, 'b': $i}testRuntimeBoundsRecursionWithArrayConstructor: real recursion through an array constructor still throwstestRuntimeBoundsDepthBalancedAfterConstructors: Timebox depth is back to 0 after a loop over nested array/object constructors. This fails if the flag is reset tofalseinstead of restored (depth goes to -90), not just onmainThe loop tests fail on
mainwithDepth=11 max=10and pass with the fix. The full suite, including the generated JSONata test suite, passes locally: 1772 tests, 0 failures, 3 skipped.🤖 Generated with Claude Code