[PR #3039] [CLOSED] fix(javascript): report a worker resource constraint once #5574

Closed
opened 2026-10-31 01:07:41 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3039
Author: @balkan16
Created: 10/13/2026
Status: ❌ Closed

Base: main ← Head: fix/javascript-resource-message-prefix


📝 Commits (1)

  • 0f4bfec fix(javascript): report a worker resource constraint once

📊 Changes

3 files changed (+57 additions, -2 deletions)

View changed files

📝 src/javascript/analysis/JavaScriptAnalysisWorker.ts (+1 -1)
📝 src/javascript/analysis/JavaScriptAnalysisWorkerServer.ts (+7 -1)
📝 tests/boundary/javascript/javascriptSourceAnalysisWorker.test.ts (+49 -0)

📄 Description

Summary

analyze-javascript-application limitations repeated the resource-constraint prefix for every file the parent declined:

main.js: Resource constraint during analyze_javascript_application: main.js: Resource constraint during analyze_javascript_application: The parent reserved its remaining result capacity for static observations; semantic analysis of main.js was not started

The worker now sends only the constraint reason, so the message is formatted once:

main.js: Resource constraint during analyze_javascript_application: The parent reserved its remaining result capacity for static observations; semantic analysis of main.js was not started

No separate issue: found while running the tool on a real app, and the fix is small and self-contained.

Problem and expected behavior

  • JavaScriptAnalysisWorkerServer.ts serialized cause.message for an AnalysisResourceConstraintError, which is already formatted as Resource constraint during <operation>: <reason>.
  • JavaScriptAnalysisWorker.ts wrapped that text in a second AnalysisResourceConstraintError with a ${file.path}: prefix.
  • JavaScriptArtifactAnalysis.ts, the only consumer, prefixes ${file.path}: again.

Observed on a real Electron app (Postman desktop): every declined file produced the doubled text. Expected: the operation and path appear once.

Change and scope

  • Worker server: send cause.reason for a resource constraint; other failures unchanged.
  • Parent: stop adding the path to the resource reason; the application consumer remains the single owner of the path prefix.

Not included: how the parent allocates the semantic budget across files.

Contribution scope: an ordinary fix within existing boundaries; a maintainer scope decision is not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: worker failure frame (JavaScriptAnalysisWorkerServer.ts)
  • Contribution scope fit and linked maintainer decision: ordinary fix; not applicable
  • CLI and MCP/tool-catalog contract: no schema change; limitation and error text lose the duplicated prefix
  • Provider, bridge, target-format, or platform compatibility: none
  • Evidence, artifact, provenance, or reconstruction contract: reportedLimits and error tags unchanged
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable; worker lifecycle and cleanup unchanged
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none

Expected effects:

  • 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: tests/boundary/javascript/javascriptSourceAnalysisWorker.test.ts, "formats a real worker's declined semantic budget once". It runs the real owned worker process and declines its semantic budget at the admission frame, as an exhausted parent does, then checks the reason and that the message names the constraint once.
  • Base reproduction or other evidence: executed. Fails on base with the exact doubled text above; passes with the change.
  • User-visible CLI/MCP output: shown in the summary
  • Remaining proof gaps: the Postman observation was on macOS; the fix and test ran on Linux only.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

  • npm run test:focused -- tests/boundary/javascript/javascriptSourceAnalysisWorker.test.ts — 10 passed (1 new)
  • Same file with the source change reverted — the new test fails with the doubled text above, 9 others pass
  • npm run check:fast — pass
  • npm run verify:test-discovery — pass (1181 files)

Compatibility, safety, and release

  • Breaking changes or migration steps: none
  • Real Hopper/Ghidra, browser, or OS coverage: Linux; original observation on macOS
  • Package or release metadata impact: none
  • Security, privacy, process, or containment review: message text only

Before merge

  • 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.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Q3rXQaLacJ7gNBRkp7DovF


🔄 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/3039 **Author:** [@balkan16](https://github.com/balkan16) **Created:** 10/13/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/javascript-resource-message-prefix` --- ### 📝 Commits (1) - [`0f4bfec`](https://github.com/morluto/rea/commit/0f4bfec1d7bdbea577fec66aaa5cfafd903e3be7) fix(javascript): report a worker resource constraint once ### 📊 Changes **3 files changed** (+57 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `src/javascript/analysis/JavaScriptAnalysisWorker.ts` (+1 -1) 📝 `src/javascript/analysis/JavaScriptAnalysisWorkerServer.ts` (+7 -1) 📝 `tests/boundary/javascript/javascriptSourceAnalysisWorker.test.ts` (+49 -0) </details> ### 📄 Description ## Summary `analyze-javascript-application` limitations repeated the resource-constraint prefix for every file the parent declined: ``` main.js: Resource constraint during analyze_javascript_application: main.js: Resource constraint during analyze_javascript_application: The parent reserved its remaining result capacity for static observations; semantic analysis of main.js was not started ``` The worker now sends only the constraint reason, so the message is formatted once: ``` main.js: Resource constraint during analyze_javascript_application: The parent reserved its remaining result capacity for static observations; semantic analysis of main.js was not started ``` No separate issue: found while running the tool on a real app, and the fix is small and self-contained. ## Problem and expected behavior - `JavaScriptAnalysisWorkerServer.ts` serialized `cause.message` for an `AnalysisResourceConstraintError`, which is already formatted as `Resource constraint during <operation>: <reason>`. - `JavaScriptAnalysisWorker.ts` wrapped that text in a second `AnalysisResourceConstraintError` with a `${file.path}: ` prefix. - `JavaScriptArtifactAnalysis.ts`, the only consumer, prefixes `${file.path}: ` again. Observed on a real Electron app (Postman desktop): every declined file produced the doubled text. Expected: the operation and path appear once. ## Change and scope - Worker server: send `cause.reason` for a resource constraint; other failures unchanged. - Parent: stop adding the path to the resource reason; the application consumer remains the single owner of the path prefix. Not included: how the parent allocates the semantic budget across files. Contribution scope: an ordinary fix within existing boundaries; a maintainer scope decision is not applicable. ## Contract and boundary impact - Semantic owner and earliest changed stage: worker failure frame (`JavaScriptAnalysisWorkerServer.ts`) - Contribution scope fit and linked maintainer decision: ordinary fix; not applicable - CLI and MCP/tool-catalog contract: no schema change; limitation and error text lose the duplicated prefix - Provider, bridge, target-format, or platform compatibility: none - Evidence, artifact, provenance, or reconstruction contract: `reportedLimits` and error tags unchanged - Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable; worker lifecycle and cleanup unchanged - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact: none Expected effects: - [ ] 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. - [x] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: `tests/boundary/javascript/javascriptSourceAnalysisWorker.test.ts`, "formats a real worker's declined semantic budget once". It runs the real owned worker process and declines its semantic budget at the admission frame, as an exhausted parent does, then checks the reason and that the message names the constraint once. - Base reproduction or other evidence: executed. Fails on base with the exact doubled text above; passes with the change. - User-visible CLI/MCP output: shown in the summary - Remaining proof gaps: the Postman observation was on macOS; the fix and test ran on Linux only. For evidence-bearing changes: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - `npm run test:focused -- tests/boundary/javascript/javascriptSourceAnalysisWorker.test.ts` — 10 passed (1 new) - Same file with the source change reverted — the new test fails with the doubled text above, 9 others pass - `npm run check:fast` — pass - `npm run verify:test-discovery` — pass (1181 files) ## Compatibility, safety, and release - Breaking changes or migration steps: none - Real Hopper/Ghidra, browser, or OS coverage: Linux; original observation on macOS - Package or release metadata impact: none - Security, privacy, process, or containment review: message text only ## Before merge - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01Q3rXQaLacJ7gNBRkp7DovF --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:07:41 +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#5574
No description provided.