@@ -142,18 +142,16 @@ void shouldHandleNestedArrayExpressionFromIssue40() throws Exception {
142142 // expression overflows the JVM thread stack before maxDepth fires.
143143 //
144144 // Production crash: Windows worker default stack ~256 KB, crashed at depth=999.
145- // Linux default stack is ~512 KB–1 MB; higher depth is needed to reproduce.
146- // Depths below are chosen to reliably overflow any default JVM thread stack up to ~1 MB
147- // without requiring -Xss flags (which OpenJDK on Linux 64-bit silently rounds up past 256 KB) .
145+ // Test JVM is pinned to -Xss512k (see build.gradle) to reproduce on Linux CI .
146+ // "+ 0" makes the expression non-tail-recursive, preventing jsonata-java TCO and forcing
147+ // each frame to stay live on the JVM stack so the overflow actually happens .
148148 //
149- // Once dashjoin/jsonata-java#107 is merged and the dependency is bumped, both assertions
150- // should flip from isInstanceOf(StackOverflowError.class) to not throwing at all.
149+ // These tests currently FAIL (StackOverflowError thrown = bug present).
150+ // They will PASS once dashjoin/jsonata-java#107 is merged and the dependency is bumped
151+ // (iterative lookup = no stack growth = no overflow = permanent regression guard).
151152
152153 @ Test
153154 void shouldThrowStackOverflowWithDeepRecursionOnWindowsStack () throws Exception {
154- // Windows default ~320 KB: historically crashed at depth=999 with recursive Frame.lookup().
155- // "+ 0" after the recursive call makes it non-tail-recursive, preventing TCO and forcing
156- // each frame to stay live on the JVM stack. depth=4999 × min 16 bytes/frame > 512k.
157155 RunContext runContext = runContextFactory .of ();
158156 TransformValue task = TransformValue .builder ()
159157 .from (Property .ofValue ("{}" ))
@@ -169,8 +167,6 @@ void shouldThrowStackOverflowWithDeepRecursionOnWindowsStack() throws Exception
169167
170168 @ Test
171169 void shouldThrowStackOverflowWithDeepRecursionOnLinuxStack () throws Exception {
172- // Linux default stack ~8 MB without -Xss; test JVM is pinned to 512k (see build.gradle).
173- // Non-tail-recursive (+ 0) prevents TCO. depth=4999 × min 16 bytes/frame > 512k.
174170 RunContext runContext = runContextFactory .of ();
175171 TransformValue task = TransformValue .builder ()
176172 .from (Property .ofValue ("{}" ))
0 commit comments