Skip to content

feat(target): explain static WASM inspection after native rejection - #1872

Merged
N0zoM1z0 merged 13 commits into
morluto:mainfrom
SII-YDD:fix/wasm-native-admission-guidance
Oct 11, 2026
Merged

N0zoM1z0 merged 13 commits into
morluto:mainfrom
SII-YDD:fix/wasm-native-admission-guidance

Conversation

@SII-YDD

@SII-YDD SII-YDD commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

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; test(native): replay complete dylib-use provider output #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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-11T22:46:47.396790Z 2e058af New commits
ℹ️ 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.

Retain the original WASM routing change while integrating the current shared
target, Evidence and MCP workflows before public recovery verification.

Refs morluto#1852

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: Kaoru0822 <[email protected]>
Check the actual MCP-advertised input and output schemas for the static tool
offered after native WASM rejection. Confirm connection usability after the
missing-tool outcome and preserve an explicit raw-binary load selection.

Refs morluto#1852

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: Kaoru0822 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b4d7df8461

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +250 to +253
if (
observed.bytesRead === 8 &&
magic.equals(Buffer.from([0, 0x61, 0x73, 0x6d, 1, 0, 0, 0]))
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Probe WASM before automatic .hop routing

For a valid v1 module saved with a .hop suffix and opened without an explicit format, parseBinaryTarget returns from the automatic analysis-database branch at lines 144-154 before it ever calls this detector. The module is therefore sent to a native database provider and never receives the wasm_requires_static_inspection recovery promised for recognized headers; move this content check ahead of the suffix-only .hop branch while leaving an explicitly requested database kind as the override.

AGENTS.md reference: AGENTS.md:L19-L19

Useful? React with 👍 / 👎.

N0zoM1z0 and others added 4 commits October 11, 2026 21:02
Reuse the existing application MCP harness with explicit session and server
options, and validate the named WASM schemas once per client. Preserve all
recovery, Evidence, cleanup, malformed-input and connection assertions while
removing duplicate setup that exceeded the unchanged CI duplication threshold.

Refs morluto#1852

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: Kaoru0822 <[email protected]>
Integrate current target, artifact, process and provider workflows before running
the full CI static gate and shared MCP harness consumers. Preserve the original
WASM recovery implementation and its focused public behavior.

Refs morluto#1852

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: Kaoru0822 <[email protected]>
Update the curated Windows invocation after the upstream reconstruction test
moved from composition to the filesystem boundary. Keep the missing-path guard
and the test coverage enabled rather than silently ignoring the stale selector.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: Kaoru0822 <[email protected]>
Verify little- and big-endian soft-float declarations through real filesystem
target resolution and the committed storage policy. Preserve rejection of
inconsistent CPR1 declarations and assert the existing FP64 restriction instead
of superseded general-register diagnostic wording.

Production provider semantics are unchanged. These expectations follow the
soft-float support already merged in morluto#1949.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: Kaoru0822 <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3d2c55d2a8

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/ci.yml Outdated
tests/boundary/cli/referenceSourceImportStatus.test.ts
tests/boundary/filesystem/asarInventoryFreshness.test.ts
tests/composition/javascript-applications/javascriptArtifactReconstruction.test.ts
tests/boundary/filesystem/javascriptArtifactReconstruction.test.ts

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Follow the reconstruction suite's actual rename

In the windows-curated invocation, this is not the destination of the renamed selector: commit dc303a8 moved tests/composition/javascript-applications/javascriptArtifactReconstruction.test.ts to tests/boundary/filesystem/javascript-applications/javascriptArtifactReconstruction.test.ts, while this flat path is a different pre-existing suite. Because tests/process-global/curatedWindowsLane.test.ts:58-64 checks only that selectors exist, CI remains green while silently dropping the intended reconstruction/worker coverage on Windows; point this entry at the nested javascript-applications path.

AGENTS.md reference: AGENTS.md:L46-L46

Useful? React with 👍 / 👎.

N0zoM1z0 and others added 6 commits October 11, 2026 21:26
Point the Windows invocation to the exact filesystem boundary path recorded by
the upstream file move, including the javascript-applications directory. A
separate existing test has the same basename and must not replace this coverage.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: Kaoru0822 <[email protected]>
Integrate current target, artifact, process and provider workflows before running
the full CI static gate and shared MCP harness consumers. Preserve the original
WASM recovery implementation and its focused public behavior.

Refs morluto#1852

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: Kaoru0822 <[email protected]>
Integrate current target, artifact, process and provider workflows before running
the full CI static gate and shared MCP harness consumers. Preserve the original
WASM recovery implementation and its focused public behavior.

Refs morluto#1852

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: Kaoru0822 <[email protected]>
Reuse the upstream soft-float filesystem test for both byte orders rather
than keeping an overlapping scenario. Preserve parsed FP64 source fields and
the distinct inconsistent soft-float declaration refusal.

Refs morluto#1852

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: Kaoru0822 <[email protected]>
Integrate current target, artifact, process and provider workflows before running
the full CI static gate and shared MCP harness consumers. Preserve the original
WASM recovery implementation and its focused public behavior.

Refs morluto#1852

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: Kaoru0822 <[email protected]>
Integrate the verified dylib-use replay and current workflow ownership and
error contracts before final WASM recovery validation.

Refs morluto#1852

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
Co-authored-by: Kaoru0822 <[email protected]>
@N0zoM1z0
N0zoM1z0 merged commit 1f17ac8 into morluto:main Oct 11, 2026
31 checks passed
@morluto

morluto commented Oct 12, 2026 •

Copy link
Copy Markdown
Owner

@SII-YDD, thank you for tracing this from the bounded WASM header probe through the shared CLI and MCP diagnostics. Calling out the difference between recognizing a v1 header and validating the module, while pointing directly to the static inspection route, makes the refusal much more useful. Welcome to REA!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior ci:full enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants