[PR #1368] [MERGED] fix(javascript): scan direct returns without recursive stack growth #2831

Closed
opened 2026-10-17 21:10:47 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1368
Author: @rudycelekli
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/10/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/javascript-return-deep-scan


📝 Commits (3)

  • ef6988e fix(javascript): scan direct returns without recursive stack growth
  • 4040ab6 chore: integrate latest main for direct-return review
  • 917e3cf test(javascript): bound deep-return regression child heap

📊 Changes

2 files changed (+52 additions, -6 deletions)

View changed files

📝 src/domain/javascript/javascriptSemanticReturns.ts (+8 -6)
➕ tests/boundary/filesystem/javascriptApplicationDeepReturns.test.ts (+44 -0)

📄 Description

Valid generated JavaScript with a deep member expression inside a function causes application analysis to fail with RangeError: Maximum call stack size exceeded. Scan direct returns with an explicit stack, preserving source order, nested function/class boundaries, and exclusion of return arguments. The implementation reuses the shared AST child enumeration and adds no depth cap or evidence truncation.

Preserves the contributor's implementation and regression, integrates main at 81cdafc132c7ba3bd6e12b1169f9e3687025d07b, and bounds the regression child heap at 768 MiB while retaining Node's default stack.

Validation:

  • Built latest main and the candidate separately, then ran the same public CLI against an inert, source-owned directory with a 180 KB file containing 20,000 chained member accesses. Main failed with the stack overflow; the candidate succeeded and retained three distinct return owners. No target code was executed.
  • Ran the compiled public stdio MCP with the actual SDK and advertised output validation against the same target. The response matched the CLI Evidence ID, preserved text/structured parity, passed ping, and completed a subsequent two-function analysis with the unchanged baseline Evidence ID. Input SHA-256 remained unchanged. Deep analysis took approximately 2.08 seconds; the complete guarded MCP process family peaked at 739 MiB. This is a robustness fix, not a claim of lower default response size or provider certification.
  • All 202 tests in eight affected semantic/boundary suites passed, including the compiled application API regression in an owned child process with default stack size.
  • Full runtime compilation, full typechecking, lint, formatting, and whitespace checks passed. Used npm run compile -- --singleThreaded and npm run typecheck -- --singleThreaded serially, then the exact focused Vitest files and npm run lint, under the local two-CPU/process-family memory budget. Full CI must pass on the final published head before merge.

Refs #1065. Prepared with AI assistance.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/1368 **Author:** [@rudycelekli](https://github.com/rudycelekli) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/10/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/javascript-return-deep-scan` --- ### 📝 Commits (3) - [`ef6988e`](https://github.com/morluto/rea/commit/ef6988eadfd46be8254f4a284374cdee26a15654) fix(javascript): scan direct returns without recursive stack growth - [`4040ab6`](https://github.com/morluto/rea/commit/4040ab604e9cb48a928ec9582f9b969ecf454699) chore: integrate latest main for direct-return review - [`917e3cf`](https://github.com/morluto/rea/commit/917e3cfbf92007980e5b19efbbf591d59b02d5cd) test(javascript): bound deep-return regression child heap ### 📊 Changes **2 files changed** (+52 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/javascript/javascriptSemanticReturns.ts` (+8 -6) ➕ `tests/boundary/filesystem/javascriptApplicationDeepReturns.test.ts` (+44 -0) </details> ### 📄 Description Valid generated JavaScript with a deep member expression inside a function causes application analysis to fail with `RangeError: Maximum call stack size exceeded`. Scan direct returns with an explicit stack, preserving source order, nested function/class boundaries, and exclusion of return arguments. The implementation reuses the shared AST child enumeration and adds no depth cap or evidence truncation. Preserves the contributor's implementation and regression, integrates main at `81cdafc132c7ba3bd6e12b1169f9e3687025d07b`, and bounds the regression child heap at 768 MiB while retaining Node's default stack. Validation: - Built latest main and the candidate separately, then ran the same public CLI against an inert, source-owned directory with a 180 KB file containing 20,000 chained member accesses. Main failed with the stack overflow; the candidate succeeded and retained three distinct return owners. No target code was executed. - Ran the compiled public stdio MCP with the actual SDK and advertised output validation against the same target. The response matched the CLI Evidence ID, preserved text/structured parity, passed ping, and completed a subsequent two-function analysis with the unchanged baseline Evidence ID. Input SHA-256 remained unchanged. Deep analysis took approximately 2.08 seconds; the complete guarded MCP process family peaked at 739 MiB. This is a robustness fix, not a claim of lower default response size or provider certification. - All 202 tests in eight affected semantic/boundary suites passed, including the compiled application API regression in an owned child process with default stack size. - Full runtime compilation, full typechecking, lint, formatting, and whitespace checks passed. Used `npm run compile -- --singleThreaded` and `npm run typecheck -- --singleThreaded` serially, then the exact focused Vitest files and `npm run lint`, under the local two-CPU/process-family memory budget. Full CI must pass on the final published head before merge. Refs #1065. Prepared with AI assistance. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:10:47 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2831
No description provided.