Repository navigation
fix(wasm): preserve leading BOM in custom section names - #2102
Merged
Merged
Conversation
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. |
10 tasks done
3 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Preserve leading U+FEFF in WABT custom-section names so valid WASM modules return Evidence instead of
unreadable_output.No existing issue covers this specific decoding error. Searches for
WabtWat,WABT BOM, and custom-section names found the already merged NUL-display fix #1981 and debug-name fix #1967; neither preserves leading U+FEFF during custom-name decoding.Problem and expected behavior
Compile this valid fixture with WABT 1.0.42
wat2wasm --enable-all:WASM names are length-delimited UTF-8. U+FEFF is part of the name, not stream framing.
TextDecodercurrently removes it, turning the name into the specialnamesection and attempting to parse arbitrary payload as debug metadata. The real CLI returnsunreadable_outputwithIncomplete WABT name-section metadata.. Other leading-U+FEFF names disagree with the exact objdump header and are also rejected.Expected: preserve the complete name and return the original producer output and Evidence.
Change and scope
Use
ignoreBOM: truefor custom names, matching the existing module-name decoder. Extend the existing producer fixture and CLI/MCP verifier for leading U+FEFF, U+FEFF followed byname, and U+FEFF-only versus empty names. Retain fatal UTF-8 decoding and existing framing, range, NUL-display and actual debug-name controls.Contract and boundary impact
parseWabtWat, decoding length-delimited custom names.Evidence and regression coverage
Tests added or updated: one focused parser regression plus existing
custom-names.watand real-tool verifier expectations. Invalid UTF-8 remains rejected.Base reproduction: on main
79156e5bed1d72b83ade0483246f457b337b7e59, the new parser regression fails (11 controls pass). The compiled real-tool lane also fails at the CLI result for the expanded custom-name fixture, despite successful WABT validation.User-visible CLI/MCP output: before,
unreadable_output/Incomplete WABT name-section metadata.; after, both surfaces return equal Evidence with descriptions retaining U+FEFF. The verifier checks unmodified bytes, exact WAT/header/detail output, digests, and retained evidence bundles.Remaining proof gaps: no Windows/Linux execution or full deterministic suite; hosted CI remains separate.
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
Executed on macOS arm64 with Node 24.18.0, npm 11.16.0 and upstream WABT 1.0.42 (release archive SHA-256 verified):
npm run test:local -- src/wasm/WabtOutput.test.ts src/wasm/WabtArtifactProvider.test.ts src/application/wasm/WasmArtifactService.test.ts- 32 tests passed.REA_WABT_BIN_DIRECTORY=<absolute WABT bin> npm run verify:wasm:artifact -- --require-tools- 42 cases passed through compiled CLI and stdio MCP, including valid and malformed modules.npm run check- all six tasks and architecture guards passed. An earlier attempt stopped on the build command lock before checks ran; the sequential retry completed.git diff --check- passed.Compatibility, safety, and release
Review checklist