Repository navigation
fix(wasm): stop appending WABT remediation to unrelated runtime-root failures - #2084
Conversation
…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.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
baron
left a comment
There was a problem hiding this comment.
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.
Summary
inspect_wasm_artifactreturns a misleading remediation when the failure has nothing to do with WABT. Fixes a bug introduced by howWabtArtifactProvider.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 itsPrivateRuntimeRootduring the same"configuration"phase used for resolving/validating the WABT tool directory.WabtFailures.ts'swabtFailure()treated every non-OwnedCommandFailurethrown 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()throwsPrivateRuntimeRootUnavailableError(e.g. the Windows native-authority capability is unavailable — unrelated to WABT at all), the resultingreasonread:with a fully correct, hash-verified
REA_WABT_BIN_DIRECTORYalready 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
PrivateRuntimeRootUnavailableErrorbefore the generic configuration-phase branch inWabtFailures.ts, returning anAnalysisCapabilityUnavailableErrorwith nouserMessageoverride. This matches the existing project convention already used for this exact error type inJavaScriptAnalysisWorker.tsandSourceMapCommand.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
src/wasm/WabtFailures.ts, configuration-phase error classification only.inspect_wasm_artifact's error shape is unchanged (AnalysisCapabilityUnavailableErroreither way), onlyuserMessage/reasoncontent differs for this one cause type.Evidence and regression coverage
Tests added or updated:
src/wasm/WabtArtifactProvider.test.ts— new case injects acreateRuntimethat throwsPrivateRuntimeRootUnavailableErroragainst a directory with real stub WABT tool binaries, assertsuserMessageisundefinedand 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
reasonstrings 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-existingit.eachfailures are unchanged before/after this change (confirmed viagit stash), caused by this checkout lacking the prebuilt Windows native addon (native/windows/build/manifest.json), not by this PR.REA_WABT_BIN_DIRECTORYpointed atwat2wasm/wasm-validate/wasm-objdump/wasm2wat, each confirmed reporting1.0.42) and a real compiled.wasmmodule:"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.""reason":"REA Windows native controls are unavailable: ENOENT: no such file or directory, open '...\native\windows\build\manifest.json'"Compatibility, safety, and release
Review checklist
type(scope): outcome.