Skip to content

refactor(javascript): name heap and deadline flags from the bound limit, not remediation text - #11448

Merged
morluto merged 3 commits into
mainfrom
refactor/javascript-heap-control-limit
Nov 15, 2026
Merged

morluto merged 3 commits into
mainfrom
refactor/javascript-heap-control-limit

Conversation

@morluto

@morluto morluto commented Nov 15, 2026 •

Copy link
Copy Markdown
Owner

Summary

JavaScript application and web bundle failures now name their per-call heap and deadline controls only through details.limit, and the CLI renders the flag. projectCliInputFields (#11413) also names the flag of a registered setting limit that carries a request parameter (such as javascript.max_heap_mb → max_heap_mb, javascript.analysis_timeout_ms → analysis_timeout_ms). Structural audit plan W1, item 4, group 1, JavaScript analysis family (analyze_javascript_application, analyze_web_bundle). Follows #11413 (merged).

Problem and expected behavior

The worker heap and timeout remediation and the web bundle heap remediation wrote rea analyze-javascript-application <input_path> --max-heap-mb ..., --analysis-timeout-ms and --max-heap-mb text into output MCP clients receive. The JavaScript worker already bound registered setting limits with parameter, but #11413's renderer only handled control_kind: "parameter" limits, so removing the text would have dropped the CLI flag. A web bundle heap exhaustion carried no limit at all.

Change and scope

  • projectCliAnalysisResult.ts: flaggedLimit accepts a parameter control or a registered setting limit that names a parameter; other limits (environment controls, setting limits without a parameter, non-limit objects) are unchanged.
  • javascriptAnalysisResourceControls.ts, JavaScriptAnalysisWorker.ts: remediation names max_heap_mb / analysis_timeout_ms only.
  • webBundleAnalysis.ts: new webBundleHeapLimit(exhaustion) binds max_heap_mb (control_kind: "parameter", web bundle range and default) when a larger value raises the exhausted allowance (V8 heap, Windows Bun commit limit) and nothing for a Bun allocation exit, which max_heap_mb does not change. WebBundleAnalysisWorker attaches it; remediation drops the CLI sentence.
  • cli-option-text-outside-cli baseline: javascriptAnalysisResourceControls.ts 5 → 4, webBundleAnalysis.ts 1 → 0.
  • Not included: the semantic retention limitation text (group 2: a result, not an error), --semantic-precision, the source_paths selection hint in the timeout remediation (group 3), and the browser deadline helper (browserDeadlineIncrease, browser family).

Ordinary refactor within existing boundaries; maintainer scope decision not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: the JavaScript and web bundle workers produce the limit facts; projectCliInputFields renders the flag for both limit kinds that name a parameter.
  • Contribution scope fit and linked maintainer decision: not applicable.
  • CLI and MCP/tool-catalog contract: CLI details.limit of a parameter-selectable setting gains cli_flag; a web bundle heap exhaustion gains details.limit (additive); remediation prose no longer names CLI flags.
  • Provider, bridge, target-format, or platform compatibility: none; Bun allocation exits still bind no heap limit.
  • Evidence, artifact, provenance, or reconstruction contract: unchanged.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): unchanged.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated:
    • javascriptAnalysisLimits.test.ts (acceptance, built CLI): rea analyze-javascript-application <root> --analysis-timeout-ms 1 now asserts details.limit {setting: "javascript.analysis_timeout_ms", parameter: "analysis_timeout_ms", cli_flag: "--analysis-timeout-ms"} and that the remediation no longer names the flag.
    • cliControlFlag.test.ts: a setting limit with a parameter gains the flag; a bare {parameter} object still does not.
    • webDeadlineControls.test.ts, WebBundleAnalysisWorker.test.ts: the web bundle heap limit for V8 and Windows commit exhaustion, none for a Bun allocation exit, and no -- in remediation.
    • javascriptAnalysisResourceControls.test.ts: heap remediation names no flag.
  • Base reproduction or other evidence: executed; suites below pass.
  • User-visible CLI/MCP output (if applicable): CLI timeout details.limit = {setting: "javascript.analysis_timeout_ms", effective_value: 1, unit: "ms", ..., update_mode: "parameter", parameter: "analysis_timeout_ms", cli_flag: "--analysis-timeout-ms"}; MCP the same without cli_flag.
  • Remaining proof gaps: no real heap exhaustion run.

Validation performed

  • npm run test:focused -- javascriptAnalysisLimits (acceptance), cliControlFlag, projectCliAnalysisResult, webBundleContainmentCli, webDeadlineControls, WebBundleAnalysisWorker, javascriptAnalysisResourceControls — all passed.
  • node scripts/verify/architecture-guards.mjs --shrink-baselines and npm run check:fast — passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none (additive cli_flag / details.limit; remediation prose changes).
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: no new effects.

Author readiness

Human owner:

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

@chatgpt-codex-connector

Copy link
Copy Markdown
Codex Review Summary: ❌ Failed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ❌ Failed 2026-11-15T20:17:54.012358Z
We couldn’t complete this review. Comment @codex review to try again.
16c7e77 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@greptile-apps

greptile-apps Bot commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5 Tier: plus

[Medium impact] The PR appears safe to merge, with the existing non-blocking comparison flag-hint issue still open.

Fix All in CodexFindings

  1. P2 Comparison errors lose flag guidance ▶
Fix with agent prompt
### Issue 1
src/dotnet/ManagedSnapshot.ts:undefined-81
`compare-managed-members` no longer names `--max-snapshot-bytes` when either file exceeds the snapshot budget. Removing the flag text here relies on `details.limit.cli_flag`, but `runOnEvidenceTargets` uses `flags: {}` for source failures. The outer flag binding also excludes `evidenceTargets.options`, where this command defines `max_snapshot_bytes`.

This is non-blocking, but users lose the flag hint needed to retry. Include the source options in the shared flag binding and test a refused comparison.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

This PR moves heap, deadline and managed snapshot flag guidance from shared error prose into structured limits that the CLI can render.

  • CLI errors show the option that changes a reported limit.
  • Web-bundle heap failures report the limit callers can raise.

Reviews (5) · Last reviewed commit: "refactor(managed): bind max_snapshot_byt..." · Reviewed by Greptile

Comment thread src/browser/WebBundleAnalysisWorker.ts Resolved
…from the limit, not remediation text

The CLI projection now also names the flag of a registered setting limit that carries a request parameter (javascript.max_heap_mb, javascript.analysis_timeout_ms). The JavaScript worker heap and timeout remediation and the web bundle heap remediation no longer name CLI flags; a web bundle heap exhaustion that a larger max_heap_mb raises now binds max_heap_mb as its per-call control.
@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

@greptileai review

Comment thread src/dotnet/ManagedSnapshot.ts Resolved
@morluto

morluto commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

@greptileai review

@morluto
morluto merged commit 8c9ccec into main Nov 15, 2026
7 checks passed
@morluto
morluto deleted the refactor/javascript-heap-control-limit branch November 15, 2026 21:24
@morluto morluto added the area: cli CLI adapter and one-shot commands label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant