Skip to content

fix(javascript): scan direct returns without recursive stack growth - #1368

Merged
N0zoM1z0 merged 3 commits into
morluto:mainfrom
rudycelekli:fix/javascript-return-deep-scan
Oct 10, 2026
Merged

N0zoM1z0 merged 3 commits into
morluto:mainfrom
rudycelekli:fix/javascript-return-deep-scan

Conversation

@rudycelekli

@rudycelekli rudycelekli commented Oct 9, 2026 •

Copy link
Copy Markdown

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.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@N0zoM1z0
N0zoM1z0 merged commit c29931c into morluto:main Oct 10, 2026
20 checks passed
@morluto

morluto commented Oct 11, 2026

Copy link
Copy Markdown
Owner

That deep-return failure is a good one to pin down, @rudycelekli. Switching to an explicit node stack lets REA walk long member chains without consuming the JavaScript call stack, while preserving nested function and class boundaries. Thanks for keeping the 20,000-property regression and public CLI/MCP coverage.

@morluto morluto added bug Something isn't working area: domain Domain logic, errors, and pure functions labels Oct 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: domain Domain logic, errors, and pure functions bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants