[PR #4149] [CLOSED] fix(wasm): retain glue literals parsed as JavaScript directives #6089

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4149
Author: @viniciusdsandrade
Created: 10/15/2026
Status: ❌ Closed

Base: main ← Head: fix/wasm-glue-directive-literals


📝 Commits (2)

  • 9cdf910 fix(wasm): retain glue literals parsed as JavaScript directives
  • 658df71 test(wasm): cover .wasm literals written as JavaScript directives

📊 Changes

2 files changed (+38 additions, -5 deletions)

View changed files

📝 src/wasm/WabtOutput.test.ts (+32 -0)
📝 src/wasm/WasmGlueAdapter.ts (+6 -5)

📄 Description

Summary

Fixes #4001

Retain a .wasm string literal that Babel classifies as a JavaScript directive ("module.wasm"; at the start of a program) in associateWasmGlue, so inspect-wasm-artifact reports it as a static-literal local path candidate. The empty-statement control ;"module.wasm"; already appeared as a StringLiteral and stays at column 1.

Problem and expected behavior

inspect-wasm-artifact with --glue_paths glue.js on a file whose entire program is "module.wasm"; succeeds with validation: "valid" and glue parse_status: "complete", but returns no references. The same literal after a leading empty statement is retained.

associateWasmGlue in src/wasm/WasmGlueAdapter.ts only reads t.isStringLiteral and empty template literals. Babel parses a leading string statement as DirectiveLiteral, so the walk skipped the occurrence.

Expected behavior: keep the directive occurrence as a static-literal reference with value module.wasm, line 1, column 0, and associate the selected module as a local path candidate. Preserve the control at column 1.

Change and scope

  • In src/wasm/WasmGlueAdapter.ts, treat DirectiveLiteral like StringLiteral in the existing static-literal walk.
  • In src/wasm/WabtOutput.test.ts, assert the directive and empty-statement control through associateWasmGlue.

Contract and boundary impact

  • Semantic owner and earliest changed stage: WASM glue association in src/wasm/WasmGlueAdapter.ts.
  • Contribution scope fit and linked maintainer decision: not applicable (bug fix within existing WASM glue inspection).
  • CLI and MCP/tool-catalog contract: unchanged schemas. Glue evidence_kind remains static-literal.
  • Provider, bridge, target-format, or platform compatibility: caller-supplied WABT glue JavaScript.
  • Evidence, artifact, provenance, or reconstruction contract: previously omitted directive literals are now retained; other associations unchanged.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated:
    • src/wasm/WabtOutput.test.ts: associateWasmGlue('"module.wasm";\n') retains the local path candidate at column 0; ;"module.wasm"; remains at column 1.
  • Base reproduction or other evidence: on the base revision, t.isStringLiteral is false for a leading directive, so glue references are empty while parse_status is complete.
  • User-visible CLI/MCP output (if applicable): inspect-wasm-artifact glue references include the directive literal when it names a selected .wasm path.
  • Remaining proof gaps: tests were verified by source inspection; CI executes the deterministic suite.

For evidence-bearing changes:

  • 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

  • No local test commands were run: verification is source-derived; CI executes the deterministic suite.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: none run. No WABT process is launched by these unit tests.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: glue association remains a static parse of caller-selected JavaScript; no WASM execution.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • 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.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🔄 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/4149 **Author:** [@viniciusdsandrade](https://github.com/viniciusdsandrade) **Created:** 10/15/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/wasm-glue-directive-literals` --- ### 📝 Commits (2) - [`9cdf910`](https://github.com/morluto/rea/commit/9cdf9106a3f7a8fc71b0d870d709a63824ad22b8) fix(wasm): retain glue literals parsed as JavaScript directives - [`658df71`](https://github.com/morluto/rea/commit/658df7165c8fd86aedead2b8e6250cb17468b8e4) test(wasm): cover .wasm literals written as JavaScript directives ### 📊 Changes **2 files changed** (+38 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `src/wasm/WabtOutput.test.ts` (+32 -0) 📝 `src/wasm/WasmGlueAdapter.ts` (+6 -5) </details> ### 📄 Description ## Summary Fixes #4001 Retain a `.wasm` string literal that Babel classifies as a JavaScript directive (`"module.wasm";` at the start of a program) in `associateWasmGlue`, so `inspect-wasm-artifact` reports it as a `static-literal` local path candidate. The empty-statement control `;"module.wasm";` already appeared as a `StringLiteral` and stays at column 1. ## Problem and expected behavior `inspect-wasm-artifact` with `--glue_paths glue.js` on a file whose entire program is `"module.wasm";` succeeds with `validation: "valid"` and glue `parse_status: "complete"`, but returns no references. The same literal after a leading empty statement is retained. `associateWasmGlue` in `src/wasm/WasmGlueAdapter.ts` only reads `t.isStringLiteral` and empty template literals. Babel parses a leading string statement as `DirectiveLiteral`, so the walk skipped the occurrence. Expected behavior: keep the directive occurrence as a `static-literal` reference with value `module.wasm`, line 1, column 0, and associate the selected module as a local path candidate. Preserve the control at column 1. ## Change and scope - In `src/wasm/WasmGlueAdapter.ts`, treat `DirectiveLiteral` like `StringLiteral` in the existing static-literal walk. - In `src/wasm/WabtOutput.test.ts`, assert the directive and empty-statement control through `associateWasmGlue`. ## Contract and boundary impact - Semantic owner and earliest changed stage: WASM glue association in `src/wasm/WasmGlueAdapter.ts`. - Contribution scope fit and linked maintainer decision: not applicable (bug fix within existing WASM glue inspection). - CLI and MCP/tool-catalog contract: unchanged schemas. Glue `evidence_kind` remains `static-literal`. - Provider, bridge, target-format, or platform compatibility: caller-supplied WABT glue JavaScript. - Evidence, artifact, provenance, or reconstruction contract: previously omitted directive literals are now retained; other associations unchanged. - Target selection, authority, upstream behavior, and cleanup details (if applicable): not applicable. - Generated metadata (`docs/public/product-catalog.json`), package, or installation impact: none. Expected effects: - [x] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. ## Evidence and regression coverage - Tests added or updated: - `src/wasm/WabtOutput.test.ts`: `associateWasmGlue('"module.wasm";\n')` retains the local path candidate at column 0; `;"module.wasm";` remains at column 1. - Base reproduction or other evidence: on the base revision, `t.isStringLiteral` is false for a leading directive, so glue references are empty while `parse_status` is `complete`. - User-visible CLI/MCP output (if applicable): `inspect-wasm-artifact` glue references include the directive literal when it names a selected `.wasm` path. - Remaining proof gaps: tests were verified by source inspection; CI executes the deterministic suite. For evidence-bearing changes: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity, source provenance, and failed attempts remain preserved. - [x] Unsupported, incomplete, unavailable, or uncertain outcomes remain visible. ## Validation performed - No local test commands were run: verification is source-derived; CI executes the deterministic suite. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: none run. No WABT process is launched by these unit tests. - Package or release metadata impact: none. - Security, privacy, process, or containment review: glue association remains a static parse of caller-selected JavaScript; no WASM execution. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:11:46 +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#6089
No description provided.