[PR #1872] [MERGED] feat(target): explain static WASM inspection after native rejection #4866

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1872
Author: @SII-YDD
Created: 10/11/2026
Status: ✅ Merged
Merged: 10/11/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/wasm-native-admission-guidance


📝 Commits (10+)

  • 5bb8e3e feat(target): explain static WASM inspection after native rejection
  • 795890a chore(target): sync main for static WASM recovery
  • b4d7df8 test(target): verify WASM recovery schemas and caller format choices
  • 521bbb5 test(wasm): reuse owned MCP harness for recovery coverage
  • 23a66d1 chore(target): sync current main before WASM recovery validation
  • 7fd0eeb fix(ci): run renamed JavaScript reconstruction tests on Windows
  • 3d2c55d test(ghidra): align filesystem ABI coverage with soft-float admission
  • 87e7087 fix(ci): preserve the moved reconstruction workflow coverage
  • 641e0e8 chore(target): sync current main before WASM recovery validation
  • 5164098 chore(target): sync current main before WASM recovery validation

📊 Changes

9 files changed (+238 additions, -47 deletions)

View changed files

📝 docs/wasm-artifacts.md (+9 -0)
📝 src/application/BinaryTargetResolver.ts (+9 -0)
📝 src/application/Doctor.ts (+1 -1)
📝 src/domain/analysisErrorPresentation.ts (+15 -0)
📝 src/domain/configurationErrors.ts (+3 -1)
📝 tests/boundary/filesystem/mipsAbiFlags.test.ts (+25 -13)
📝 tests/boundary/filesystem/targetDiagnostics.test.ts (+75 -0)
📝 tests/boundary/mcp/wasmArtifactMcp.test.ts (+85 -26)
📝 tests/fixtures/applicationMcpHarness.ts (+16 -6)

📄 Description

Summary

Recognized WebAssembly v1 files opened through open_binary produce an unsupported native-format diagnostic or follow an unrelated filename route. Identify the observed format before suffix classification and give valid arguments for the existing target-free inspect_wasm_artifact tool.

Refs #1852. This PR covers WASM recovery; other unsupported firmware encoding/load combinations remain outside its scope.

Problem and expected behavior

The complete eight-byte WASM v1 header establishes a format/version observation regardless of filename. Native admission should remain rejected while explaining the supported static lane, its optional tool prerequisites and the distinction between header recognition and full validation. Incomplete, future-version and unrelated headers must not establish WASM v1 support.

Change and scope

  • Recognize the complete v1 header at the existing bounded filesystem probe, before suffix classification.
  • Preserve target_unavailable and nonretryable behavior; add wasm_requires_static_inspection and project unsupported_target through shared CLI/MCP diagnostics and doctor.
  • Offer the exact canonical path as JSON arguments to the named static tool, the CLI equivalent, caller-supplied WABT 1.0.42 and absolute REA_WABT_BIN_DIRECTORY.
  • Preserve explicit raw-binary, DOS COM and database selections; distinguish observation from module validation, execution and tool availability.
  • Reuse the existing owned application MCP harness with optional session/server inputs for recovery tests and advertised-schema validation.
  • Retain distinct filesystem ABI controls exposed by main integration: both byte orders for its existing soft-float admission test, parsed FP64 source fields and rejection of an inconsistent soft-float declaration. Provider behavior is unchanged by these test follow-ups.

Contract and boundary impact

  • Semantic owner: BinaryTargetResolver.detectArtifactFormat at its existing eight-byte read; shared error presentation owns the diagnostic.
  • CLI/MCP: no new tools or schemas. Recognized v1 rejection gains a typed constraint and more specific category while retaining its error code and retryability.
  • Evidence: rejection produces no Evidence. The subsequent static operation preserves existing provenance, identity and complete-result recovery.
  • Resource and authority: no additional reads, target execution, automatic fallback, installation or provider changes. Caller-selected raw/database inputs retain priority.

Representative outcomes

A recognized file rejected by open_binary now identifies the native admission restriction and offers inspect_wasm_artifact with the exact path, including quotes/spaces. Without WABT, that tool returns its distinct capability_unavailable setup diagnostic. With WABT, static validation and inspection proceed independently of native engines.

The integrated DataCount and module-name fixes from #1963/#1967 were also verified on two unchanged released WASM modules (94,519 and 879,148 bytes). The smaller result returns complete inline Evidence. The larger result contains 15,350,577 bytes of decoded WAT: the default MCP receive budget produces an explicit transport constraint, and retained Evidence export exactly matches complete CLI JSON. No response budget was raised.

Validation

  • Initial focused target, raw selection, MCP and error projection tests: 102 passed, one platform test skipped.
  • Restoring the original admission producer reproduces three diagnostic failures; restoring the change resolves them.
  • Final main-integrated target diagnostics, WASM MCP contract and actual producer/provider tests: 30 passed across four files.
  • Current caller-supplied WABT 1.0.42 public CLI/MCP verifier: 42 cases passed, with verified process lineage and no surviving owned descendants.
  • Fresh stdio MCP and CLI missing-tool, empty-module and both released-module workflows: expected outcomes, exact CLI/MCP parity, following pings and unchanged source digests. Peak memory 1,399,619,584 bytes, with zero memory-limit/OOM events under one CPU / 3 GiB.
  • Shared application harness consumers and target diagnostics: 38 passed.
  • Filesystem ABI and Ghidra profile tests after removing overlapping main coverage: 71 passed.
  • Final main-integrated npm run check:ci: all eight tasks and architecture guards passed.
  • Final npm run docs:check: all six tasks passed.
  • git diff --check: passed.
  • All applicable matching-head CI checks must pass before merge. The inherited Apple producer regression is fixed on main; #1972 verifies its complete output and updates remaining inherited fixture prerequisites.

Compatibility, safety, and release

No input migrations, new native prerequisites or package/release metadata changes. Linux source-built CLI and actual stdio MCP workflows use WABT; native engine verification is not claimed for this diagnostic increment. Platform-specific coverage is reported by matching-head CI. No credentials, private paths, generated binaries or local planning artifacts are committed.

Review checklist

  • This PR addresses a concrete REA problem and has a Conventional Commit title.
  • The related issue and partial scope are explicit.
  • Producer ownership, caller selections, identity and uncertainty are preserved.
  • Changed behavior and meaningful malformed/unknown-input controls are verified.
  • Owning documentation is updated and tool contracts are unchanged.
  • Actual CLI/MCP outcomes and real-provider verification limits are explicit.

Final integration: 95 tests passed across target diagnostics, actual MCP WASM workflows, MIPS declaration boundaries and error projection; the complete eight-task CI static gate passed with 1,154 architecture guards, and generated documentation checks passed. Current provider and workflow fixes, including #1972, are integrated. Full PR CI is requested.


🔄 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/1872 **Author:** [@SII-YDD](https://github.com/SII-YDD) **Created:** 10/11/2026 **Status:** ✅ Merged **Merged:** 10/11/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/wasm-native-admission-guidance` --- ### 📝 Commits (10+) - [`5bb8e3e`](https://github.com/morluto/rea/commit/5bb8e3ee8c0a7e64ee64a16b60dab009f1a4f327) feat(target): explain static WASM inspection after native rejection - [`795890a`](https://github.com/morluto/rea/commit/795890ab0accd44a7869a13ec5b76e9e1d10afdb) chore(target): sync main for static WASM recovery - [`b4d7df8`](https://github.com/morluto/rea/commit/b4d7df8461d7077001c1232a10bbcac6e9045c40) test(target): verify WASM recovery schemas and caller format choices - [`521bbb5`](https://github.com/morluto/rea/commit/521bbb571ba37a73ac35325e89d741ae1f0beac9) test(wasm): reuse owned MCP harness for recovery coverage - [`23a66d1`](https://github.com/morluto/rea/commit/23a66d1f69061a8bcb42398dd658d1ebd3e80523) chore(target): sync current main before WASM recovery validation - [`7fd0eeb`](https://github.com/morluto/rea/commit/7fd0eeb248851daf738fc28fd594ddcc2a2a9ecd) fix(ci): run renamed JavaScript reconstruction tests on Windows - [`3d2c55d`](https://github.com/morluto/rea/commit/3d2c55d2a8b3eb37655f32ab4e95527442464bab) test(ghidra): align filesystem ABI coverage with soft-float admission - [`87e7087`](https://github.com/morluto/rea/commit/87e70877b2ba353c022490a6a9a000bd3863e07a) fix(ci): preserve the moved reconstruction workflow coverage - [`641e0e8`](https://github.com/morluto/rea/commit/641e0e82bd93ee0f041e8a4cc15e1cf7e7f3045f) chore(target): sync current main before WASM recovery validation - [`5164098`](https://github.com/morluto/rea/commit/51640985ec7b529b70ea006e8713217e010b729a) chore(target): sync current main before WASM recovery validation ### 📊 Changes **9 files changed** (+238 additions, -47 deletions) <details> <summary>View changed files</summary> 📝 `docs/wasm-artifacts.md` (+9 -0) 📝 `src/application/BinaryTargetResolver.ts` (+9 -0) 📝 `src/application/Doctor.ts` (+1 -1) 📝 `src/domain/analysisErrorPresentation.ts` (+15 -0) 📝 `src/domain/configurationErrors.ts` (+3 -1) 📝 `tests/boundary/filesystem/mipsAbiFlags.test.ts` (+25 -13) 📝 `tests/boundary/filesystem/targetDiagnostics.test.ts` (+75 -0) 📝 `tests/boundary/mcp/wasmArtifactMcp.test.ts` (+85 -26) 📝 `tests/fixtures/applicationMcpHarness.ts` (+16 -6) </details> ### 📄 Description ## Summary Recognized WebAssembly v1 files opened through `open_binary` produce an unsupported native-format diagnostic or follow an unrelated filename route. Identify the observed format before suffix classification and give valid arguments for the existing target-free `inspect_wasm_artifact` tool. Refs #1852. This PR covers WASM recovery; other unsupported firmware encoding/load combinations remain outside its scope. ## Problem and expected behavior The complete eight-byte WASM v1 header establishes a format/version observation regardless of filename. Native admission should remain rejected while explaining the supported static lane, its optional tool prerequisites and the distinction between header recognition and full validation. Incomplete, future-version and unrelated headers must not establish WASM v1 support. ## Change and scope - Recognize the complete v1 header at the existing bounded filesystem probe, before suffix classification. - Preserve `target_unavailable` and nonretryable behavior; add `wasm_requires_static_inspection` and project `unsupported_target` through shared CLI/MCP diagnostics and doctor. - Offer the exact canonical path as JSON arguments to the named static tool, the CLI equivalent, caller-supplied WABT 1.0.42 and absolute `REA_WABT_BIN_DIRECTORY`. - Preserve explicit raw-binary, DOS COM and database selections; distinguish observation from module validation, execution and tool availability. - Reuse the existing owned application MCP harness with optional session/server inputs for recovery tests and advertised-schema validation. - Retain distinct filesystem ABI controls exposed by main integration: both byte orders for its existing soft-float admission test, parsed FP64 source fields and rejection of an inconsistent soft-float declaration. Provider behavior is unchanged by these test follow-ups. ## Contract and boundary impact - Semantic owner: `BinaryTargetResolver.detectArtifactFormat` at its existing eight-byte read; shared error presentation owns the diagnostic. - CLI/MCP: no new tools or schemas. Recognized v1 rejection gains a typed constraint and more specific category while retaining its error code and retryability. - Evidence: rejection produces no Evidence. The subsequent static operation preserves existing provenance, identity and complete-result recovery. - Resource and authority: no additional reads, target execution, automatic fallback, installation or provider changes. Caller-selected raw/database inputs retain priority. ## Representative outcomes A recognized file rejected by `open_binary` now identifies the native admission restriction and offers `inspect_wasm_artifact` with the exact path, including quotes/spaces. Without WABT, that tool returns its distinct `capability_unavailable` setup diagnostic. With WABT, static validation and inspection proceed independently of native engines. The integrated DataCount and module-name fixes from #1963/#1967 were also verified on two unchanged released WASM modules (94,519 and 879,148 bytes). The smaller result returns complete inline Evidence. The larger result contains 15,350,577 bytes of decoded WAT: the default MCP receive budget produces an explicit transport constraint, and retained Evidence export exactly matches complete CLI JSON. No response budget was raised. ## Validation - Initial focused target, raw selection, MCP and error projection tests: 102 passed, one platform test skipped. - Restoring the original admission producer reproduces three diagnostic failures; restoring the change resolves them. - Final main-integrated target diagnostics, WASM MCP contract and actual producer/provider tests: **30 passed across four files**. - Current caller-supplied WABT 1.0.42 public CLI/MCP verifier: **42 cases passed**, with verified process lineage and no surviving owned descendants. - Fresh stdio MCP and CLI missing-tool, empty-module and both released-module workflows: expected outcomes, exact CLI/MCP parity, following pings and unchanged source digests. Peak memory 1,399,619,584 bytes, with zero memory-limit/OOM events under one CPU / 3 GiB. - Shared application harness consumers and target diagnostics: 38 passed. - Filesystem ABI and Ghidra profile tests after removing overlapping main coverage: **71 passed**. - Final main-integrated `npm run check:ci`: all eight tasks and architecture guards passed. - Final `npm run docs:check`: all six tasks passed. - `git diff --check`: passed. - All applicable matching-head CI checks must pass before merge. The inherited Apple producer regression is fixed on main; #1972 verifies its complete output and updates remaining inherited fixture prerequisites. ## Compatibility, safety, and release No input migrations, new native prerequisites or package/release metadata changes. Linux source-built CLI and actual stdio MCP workflows use WABT; native engine verification is not claimed for this diagnostic increment. Platform-specific coverage is reported by matching-head CI. No credentials, private paths, generated binaries or local planning artifacts are committed. ## Review checklist - [x] This PR addresses a concrete REA problem and has a Conventional Commit title. - [x] The related issue and partial scope are explicit. - [x] Producer ownership, caller selections, identity and uncertainty are preserved. - [x] Changed behavior and meaningful malformed/unknown-input controls are verified. - [x] Owning documentation is updated and tool contracts are unchanged. - [x] Actual CLI/MCP outcomes and real-provider verification limits are explicit. Final integration: 95 tests passed across target diagnostics, actual MCP WASM workflows, MIPS declaration boundaries and error projection; the complete eight-task CI static gate passed with 1,154 architecture guards, and generated documentation checks passed. Current provider and workflow fixes, including #1972, are integrated. Full PR CI is requested. --- <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:11 +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#4866
No description provided.