[PR #1889] [CLOSED] fix(artifacts): identify WebAssembly module targets at native admission #4882

Closed
opened 2026-10-31 00:56:23 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1889
Author: @BaaRai
Created: 10/11/2026
Status: ❌ Closed

Base: main ← Head: fix/wasm-target-admission


📝 Commits (4)

  • dab6d8c fix(artifacts): identify WebAssembly module targets at native admission
  • 7b6db29 fix(artifacts): match the complete v1 WebAssembly preamble and name the CLI lane
  • c074a55 fix(artifacts): state the WASM inspection lane's 8 MiB module capacity
  • 1e1235c fix(artifacts): project the WebAssembly refusal as an unsupported target

📊 Changes

7 files changed (+104 additions, -5 deletions)

View changed files

📝 src/application/BinaryTargetResolver.ts (+11 -1)
📝 src/application/Doctor.ts (+2 -1)
📝 src/domain/analysisErrorPresentation.ts (+15 -1)
📝 src/domain/binaryTarget.test.ts (+16 -1)
📝 src/domain/binaryTarget.ts (+23 -0)
📝 src/domain/configurationErrors.ts (+1 -1)
📝 tests/boundary/filesystem/targetDiagnostics.test.ts (+36 -0)

📄 Description

Summary

Fixes #1852.

open_binary rejected a WebAssembly binary module with the generic unsupported binary format failure. The caller could not distinguish a restriction of the selected native lane from a missing engine, and nothing pointed to the artifact inspection lane that already exists behind #884.

Problem and expected behavior

Target admission recognized only ELF, Mach-O, PE and DOS headers. A \0asm module fell through to the generic unknown-format rejection, so the typed outcome identified neither the format nor the actually available continuation. The issue asks for the exact restriction in the typed outcome, a pointer to an advertised compatible operation when one exists, and no fabricated support claims.

Change and scope

  • Target admission recognizes the WebAssembly module header (\0asm magic) and fails with a typed webassembly_module_header constraint instead of the generic unknown-format reason.
  • The projected user message states that no native analysis lane loads WASM modules, so the caller can tell a selected-lane restriction from an absent engine.
  • The remediation names the optional inspect_wasm_artifact operation with its path argument and the caller-supplied WABT prerequisite (REA_WABT_BIN_DIRECTORY), states explicitly that it inspects sections, imports, exports and WAT forms and does not decompile or execute the module, and defers availability to the advertised tool catalog. It suggests no provider installation and no header edits.
  • rea doctor target inspection classifies the constraint as an unsupported target instead of configuration drift.

No provider, classification, or WASM-lane behavior changes.

Verification

Locally verified; fork PRs currently receive no CI check runs in this repository (maintainer approval gate), so results below are from this machine:

  • vitest src/domain/binaryTarget.test.ts (new header-identification case), tests/boundary/filesystem/targetDiagnostics.test.ts (new end-to-end case: resolver constraint, projected message and remediation content, doctor classification), src/domain/analysisErrorProjection.test.ts, tests/boundary/filesystem/binaryTarget.test.ts: all pass.
  • tsc --noEmit clean; oxlint reports the same 7 pre-existing warnings as main, 0 errors.
  • Reproduced on this machine: a minimal \0asm\x01\0\0\0 fixture now fails with the typed constraint, and a pre-change build reports the generic unknown-format failure.

🔄 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/1889 **Author:** [@BaaRai](https://github.com/BaaRai) **Created:** 10/11/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/wasm-target-admission` --- ### 📝 Commits (4) - [`dab6d8c`](https://github.com/morluto/rea/commit/dab6d8cf9f679fa4075876e35d089e3160a1d57c) fix(artifacts): identify WebAssembly module targets at native admission - [`7b6db29`](https://github.com/morluto/rea/commit/7b6db29a39f573da306cf426e4dc10e0c61e1ec1) fix(artifacts): match the complete v1 WebAssembly preamble and name the CLI lane - [`c074a55`](https://github.com/morluto/rea/commit/c074a5501f4f0056cd7c46ccfd0f24f44b5c72cc) fix(artifacts): state the WASM inspection lane's 8 MiB module capacity - [`1e1235c`](https://github.com/morluto/rea/commit/1e1235c913ca46fc1d31ceb38f095e53073bb762) fix(artifacts): project the WebAssembly refusal as an unsupported target ### 📊 Changes **7 files changed** (+104 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/application/BinaryTargetResolver.ts` (+11 -1) 📝 `src/application/Doctor.ts` (+2 -1) 📝 `src/domain/analysisErrorPresentation.ts` (+15 -1) 📝 `src/domain/binaryTarget.test.ts` (+16 -1) 📝 `src/domain/binaryTarget.ts` (+23 -0) 📝 `src/domain/configurationErrors.ts` (+1 -1) 📝 `tests/boundary/filesystem/targetDiagnostics.test.ts` (+36 -0) </details> ### 📄 Description ## Summary Fixes #1852. `open_binary` rejected a WebAssembly binary module with the generic `unsupported binary format` failure. The caller could not distinguish a restriction of the selected native lane from a missing engine, and nothing pointed to the artifact inspection lane that already exists behind `#884`. ## Problem and expected behavior Target admission recognized only ELF, Mach-O, PE and DOS headers. A `\0asm` module fell through to the generic unknown-format rejection, so the typed outcome identified neither the format nor the actually available continuation. The issue asks for the exact restriction in the typed outcome, a pointer to an advertised compatible operation when one exists, and no fabricated support claims. ## Change and scope - Target admission recognizes the WebAssembly module header (`\0asm` magic) and fails with a typed `webassembly_module_header` constraint instead of the generic unknown-format reason. - The projected user message states that no native analysis lane loads WASM modules, so the caller can tell a selected-lane restriction from an absent engine. - The remediation names the optional `inspect_wasm_artifact` operation with its `path` argument and the caller-supplied WABT prerequisite (`REA_WABT_BIN_DIRECTORY`), states explicitly that it inspects sections, imports, exports and WAT forms and does not decompile or execute the module, and defers availability to the advertised tool catalog. It suggests no provider installation and no header edits. - `rea doctor` target inspection classifies the constraint as an unsupported target instead of configuration drift. No provider, classification, or WASM-lane behavior changes. ## Verification Locally verified; fork PRs currently receive no CI check runs in this repository (maintainer approval gate), so results below are from this machine: - `vitest` `src/domain/binaryTarget.test.ts` (new header-identification case), `tests/boundary/filesystem/targetDiagnostics.test.ts` (new end-to-end case: resolver constraint, projected message and remediation content, doctor classification), `src/domain/analysisErrorProjection.test.ts`, `tests/boundary/filesystem/binaryTarget.test.ts`: all pass. - `tsc --noEmit` clean; `oxlint` reports the same 7 pre-existing warnings as `main`, 0 errors. - Reproduced on this machine: a minimal `\0asm\x01\0\0\0` fixture now fails with the typed constraint, and a pre-change build reports the generic unknown-format failure. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 00:56:23 +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#4882
No description provided.