[GH-ISSUE #2618] fix(wasm): relative secondary paths blame the primary path #935

Closed
opened 2026-10-15 18:29:42 +00:00 by bsakaguchi · 0 comments
Owner

Originally created by @coygeek on GitHub (Oct 13, 2026).
Original GitHub issue: https://github.com/morluto/rea/issues/2618

Summary

A relative glue or candidate path is rejected with correction metadata naming the primary WASM path, even when that primary path is already absolute. MCP and direct service callers therefore receive the wrong argument to correct. CLI resolves its selected paths before this validation and does not trigger the same rejection.

Steps to reproduce

  1. On the source baseline below, construct WasmArtifactService with a provider stub that records whether inspect is called. Call the service with this input:
{
  "path": "/artifacts/module.wasm",
  "glue_paths": ["relative-glue.js"]
}
  1. Inspect the returned AnalysisInputError.issues[0].path. Repeat with candidate_paths: ["relative-module.wasm"] instead of the glue selection.
  2. For controls, use a relative primary path with absolute secondary paths, then an input where every path is absolute. Observe provider invocation and the forwarded input.

Expected behavior

Correction metadata must name the rejected caller argument. The glue case should identify ["glue_paths", 0], the candidate case ["candidate_paths", 0], and the primary-path case ["path"].

Actual behavior

The focused test observed ["path"] with invalid_format and the message Expected an absolute filesystem path on this host. for both secondary-path failures. The provider was not invoked. The relative-primary control correctly named path, and the all-absolute control reached the provider with unchanged input.

Evidence

  • Expected source: src/domain/analysisErrorCore.ts:69 defines correction metadata for one rejected argument; src/domain/localPath.ts:19 accepts relative nonempty names, leaving absolute-path checks to callers.
  • Failure source: src/application/wasm/WasmArtifactService.ts:44 checks all path selections together but hard-codes the primary issue path at line 54. src/server/registerWasmTools.ts:29 validates the MCP schema and forwards these strings without normalization.
  • Evidence provenance: observed
  • Local verification: reproduced
  • Reproduction completeness: complete

One focused test checked both secondary-path failures, absence of provider calls on rejection, primary-path attribution, and exact forwarding of all-absolute input. WABT was not executed. The CLI's path-resolution behavior was established from source.

Runtime or environment

Source revision 8b181716ac, Node.js v26.10.0, npm 11.19.1, installed locked dependencies, and Vitest 5.0.3 on a POSIX host.

Restoration check

Repeat each relative-path case and require the issue path to identify the actual field and array index. Keep primary-path rejection correctly attributed, prevent provider invocation on invalid input, and preserve all-absolute forwarding unchanged.

Triage assessment

  • Impact level: P2
  • Assessment status: supported
  • Impact basis: Incorrect machine-readable correction names an already-valid primary argument instead of the rejected secondary selection, obstructing input correction. Rejection remains typed and no incorrect analysis result is returned.
  • Workaround status: available
  • Workaround basis: Callers can check all selected paths and make each absolute. The focused all-absolute control directly confirmed that such input reaches the provider unchanged.
Originally created by @coygeek on GitHub (Oct 13, 2026). Original GitHub issue: https://github.com/morluto/rea/issues/2618 ## Summary A relative glue or candidate path is rejected with correction metadata naming the primary WASM `path`, even when that primary path is already absolute. MCP and direct service callers therefore receive the wrong argument to correct. CLI resolves its selected paths before this validation and does not trigger the same rejection. ## Steps to reproduce 1. On the source baseline below, construct `WasmArtifactService` with a provider stub that records whether `inspect` is called. Call the service with this input: ```json { "path": "/artifacts/module.wasm", "glue_paths": ["relative-glue.js"] } ``` 2. Inspect the returned `AnalysisInputError.issues[0].path`. Repeat with `candidate_paths: ["relative-module.wasm"]` instead of the glue selection. 3. For controls, use a relative primary path with absolute secondary paths, then an input where every path is absolute. Observe provider invocation and the forwarded input. ## Expected behavior Correction metadata must name the rejected caller argument. The glue case should identify `["glue_paths", 0]`, the candidate case `["candidate_paths", 0]`, and the primary-path case `["path"]`. ## Actual behavior The focused test observed `["path"]` with `invalid_format` and the message `Expected an absolute filesystem path on this host.` for both secondary-path failures. The provider was not invoked. The relative-primary control correctly named `path`, and the all-absolute control reached the provider with unchanged input. ## Evidence - Expected source: `src/domain/analysisErrorCore.ts:69` defines correction metadata for one rejected argument; `src/domain/localPath.ts:19` accepts relative nonempty names, leaving absolute-path checks to callers. - Failure source: `src/application/wasm/WasmArtifactService.ts:44` checks all path selections together but hard-codes the primary issue path at line 54. `src/server/registerWasmTools.ts:29` validates the MCP schema and forwards these strings without normalization. - Evidence provenance: observed - Local verification: reproduced - Reproduction completeness: complete One focused test checked both secondary-path failures, absence of provider calls on rejection, primary-path attribution, and exact forwarding of all-absolute input. WABT was not executed. The CLI's path-resolution behavior was established from source. ## Runtime or environment Source revision 8b181716aca2cb467be499cba226abfb5ae19141, Node.js v26.10.0, npm 11.19.1, installed locked dependencies, and Vitest 5.0.3 on a POSIX host. ## Restoration check Repeat each relative-path case and require the issue path to identify the actual field and array index. Keep primary-path rejection correctly attributed, prevent provider invocation on invalid input, and preserve all-absolute forwarding unchanged. ## Triage assessment - Impact level: P2 - Assessment status: supported - Impact basis: Incorrect machine-readable correction names an already-valid primary argument instead of the rejected secondary selection, obstructing input correction. Rejection remains typed and no incorrect analysis result is returned. - Workaround status: available - Workaround basis: Callers can check all selected paths and make each absolute. The focused all-absolute control directly confirmed that such input reaches the provider unchanged.
bsakaguchi 2026-10-15 18:29:42 +00:00
  • closed this issue
  • added the
    bug
    label
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#935
No description provided.