Skip to content

fix(wasm): stop appending WABT remediation to unrelated runtime-root failures - #2084

Merged
baron merged 1 commit into
morluto:mainfrom
STiFLeR7:fix/wabt-runtime-root-error-message
Oct 12, 2026
Merged

baron merged 1 commit into
morluto:mainfrom
STiFLeR7:fix/wabt-runtime-root-error-message

Conversation

@STiFLeR7

@STiFLeR7 STiFLeR7 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Summary

inspect_wasm_artifact returns a misleading remediation when the failure has nothing to do with WABT. Fixes a bug introduced by how WabtArtifactProvider.inspect()'s configuration phase is structured (no linked issue; found via hands-on CLI testing with a real WABT 1.0.42 install, not from an existing report).

Problem and expected behavior

WabtArtifactProvider.inspect() allocates its PrivateRuntimeRoot during the same "configuration" phase used for resolving/validating the WABT tool directory. WabtFailures.ts's wabtFailure() treated every non-OwnedCommandFailure thrown during that phase as a WABT tool/directory problem and unconditionally appended "Supply WABT 1.0.42 via absolute REA_WABT_BIN_DIRECTORY; REA does not install tools." to the reason.

On a host where PrivateRuntimeRoot.create() throws PrivateRuntimeRootUnavailableError (e.g. the Windows native-authority capability is unavailable — unrelated to WABT at all), the resulting reason read:

REA Windows native controls are unavailable: ENOENT: ... manifest.json Supply WABT 1.0.42 via absolute REA_WABT_BIN_DIRECTORY; REA does not install tools.

with a fully correct, hash-verified REA_WABT_BIN_DIRECTORY already pointing at real WABT 1.0.42 binaries. Expected: the reason should describe the actual failure (the private-runtime-root capability) without implying WABT is misconfigured.

Change and scope

Classify PrivateRuntimeRootUnavailableError before the generic configuration-phase branch in WabtFailures.ts, returning an AnalysisCapabilityUnavailableError with no userMessage override. This matches the existing project convention already used for this exact error type in JavaScriptAnalysisWorker.ts and SourceMapCommand.ts — not a new pattern. Every other configuration-phase failure (missing/invalid directory, missing tool, bad version banner) is untouched and still gets the WABT-specific remediation, which is correct for those cases.

Contract and boundary impact

  • Semantic owner and earliest changed stage: src/wasm/WabtFailures.ts, configuration-phase error classification only.
  • CLI and MCP/tool-catalog contract: no schema change; inspect_wasm_artifact's error shape is unchanged (AnalysisCapabilityUnavailableError either way), only userMessage/reason content differs for this one cause type.
  • Provider, bridge, target-format, or platform compatibility: none.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Process execution, authorization, cleanup, or containment impact: none.
  • Generated metadata/package/installation impact: none.

Evidence and regression coverage

  • Tests added or updated: src/wasm/WabtArtifactProvider.test.ts — new case injects a createRuntime that throws PrivateRuntimeRootUnavailableError against a directory with real stub WABT tool binaries, asserts userMessage is undefined and the message carries the real cause, not the WABT remediation.

  • Base reproduction: confirmed via real CLI run against a hash-verified WABT 1.0.42 Windows release before this change — see Validation below.

  • User-visible CLI/MCP output: before/after reason strings in Validation.

  • Remaining proof gaps: could not reproduce on a host where the native Windows authority addon is present (this dev checkout lacks the prebuilt artifact, same gap tracked by Define a trusted Windows native authority and packaging boundary #287), so the "available" path through PrivateRuntimeRoot.create() on Windows is unexercised by this PR; the unit test exercises the classification logic directly instead, which is where the actual bug lives.

  • 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 check (typecheck, lint, format:check, knip, metadata:check, verify:architecture-guards) — clean. Lint reported 854 pre-existing warnings repo-wide, 0 errors; unrelated to this change.
  • npm run verify:test-discovery — all 915 test files discovered exactly once, confirming the new test case didn't orphan or duplicate discovery for its file.
  • npx vitest run src/wasm/WabtArtifactProvider.test.ts — new test passes; the file's 9 pre-existing it.each failures are unchanged before/after this change (confirmed via git stash), caused by this checkout lacking the prebuilt Windows native addon (native/windows/build/manifest.json), not by this PR.
  • Real CLI repro with a hash-verified WABT 1.0.42 Windows release (REA_WABT_BIN_DIRECTORY pointed at wat2wasm/wasm-validate/wasm-objdump/wasm2wat, each confirmed reporting 1.0.42) and a real compiled .wasm module:
    • Before: "reason":"REA Windows native controls are unavailable: ENOENT: no such file or directory, open '...\native\windows\build\manifest.json' Supply WABT 1.0.42 via absolute REA_WABT_BIN_DIRECTORY; REA does not install tools."
    • After: "reason":"REA Windows native controls are unavailable: ENOENT: no such file or directory, open '...\native\windows\build\manifest.json'"

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: none needed; this is error-classification logic, not provider behavior.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: none.

Review checklist

  • This PR addresses a concrete problem or an agreed enhancement.
  • 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 (found via hands-on testing, no pre-existing issue).
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed (none needed here).
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

…failures

inspect_wasm_artifact's configuration-phase error handler assumed every
non-OwnedCommandFailure thrown before the artifact phase was about WABT
tool/directory resolution, and unconditionally appended "Supply WABT 1.0.42
via absolute REA_WABT_BIN_DIRECTORY; REA does not install tools." to the
reason. WabtArtifactProvider.inspect() also allocates its PrivateRuntimeRoot
during the configuration phase, so a PrivateRuntimeRootUnavailableError (the
Windows native-authority capability, unrelated to WABT) got the same false
remediation glued onto its own already-correct message, misdirecting anyone
troubleshooting a correctly-configured WABT install toward re-checking WABT
instead of the real blocker.

Classify PrivateRuntimeRootUnavailableError before the generic
configuration-phase branch, matching the existing convention already used
in JavaScriptAnalysisWorker.ts and SourceMapCommand.ts: surface it as its
own AnalysisCapabilityUnavailableError with no userMessage override, letting
its own message stand.

Verified against a real WABT 1.0.42 Windows release (hash-checked against
GitHub release metadata) and a real compiled .wasm module: before the fix,
`reason` read "REA Windows native controls are unavailable: ENOENT: ...
Supply WABT 1.0.42 ..." even with a fully correct REA_WABT_BIN_DIRECTORY;
after, `reason` reports only the real cause.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 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 ⚠️ Failed 2026-10-12T07:10:49.289557Z e4fa638 PR opened
ℹ️ 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.

@baron baron left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Reviewed exact head e4fa638 and current-main integration. No confirmed source or directly related design blocker.

The producing runtime-root failure now owns its existing reason/remediation; the Wasm adapter no longer appends WABT advice to unrelated failures. Relevant unavailable-path cases pass on pinned Node 24.18.0/npm 11.16.0, alongside check:fast and clean object-only integration. The nine unrelated cases were deliberately excluded; no real WABT/provider operation was performed or claimed. Exact-head hosted CI is green.

@baron
baron merged commit ea2f94d into morluto:main Oct 12, 2026
31 checks passed
@morluto morluto mentioned this pull request Oct 13, 2026
3 tasks done
@morluto morluto added bug Something isn't working area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior labels Oct 14, 2026
@morluto morluto added area: runtime Process capture and runtime observation provider: wabt Analysis provider / engine: wabt labels Nov 23, 2026
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 area: runtime Process capture and runtime observation bug Something isn't working provider: wabt Analysis provider / engine: wabt

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants