[PR #5417] [CLOSED] fix(wasm): preserve ambiguous normalized debug labels #6923

Closed
opened 2026-11-01 21:44:05 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/5417
Author: @maxazure
Created: 10/20/2026
Status: ❌ Closed

Base: main ← Head: fix/wasm-ambiguous-debug-names


📝 Commits (1)

  • 68f0fd3 fix(wasm): preserve ambiguous normalized debug labels

📊 Changes

3 files changed (+231 additions, -17 deletions)

View changed files

📝 scripts/verify-wasm-interface-comparison.mjs (+121 -1)
📝 src/wasm/WabtInterface.test.ts (+77 -0)
📝 src/wasm/WabtInterface.ts (+33 -16)

📄 Description

Summary

Fixes #5395. Distinct debug names such as a b and a_b normalize to the same WABT label. Inspection previously selected the first matching function, and comparison hid a real parameter change as two unchanged exports with complete coverage.

Problem and expected behavior

Resolve a named reference only when its label identifies one definition. Ambiguous identity must retain null facts and a per-entry issue. Numeric references, unique names, exact WAT and complete import/export inventories must remain available.

Change and scope

Record label uniqueness while constructing each producer-owned index space, including named types. A duplicate remains unresolved rather than selecting the first export definition or the last type definition. Remove the superseded per-definition display-label lookup. Comparison consumes these typed facts through its existing unknown/partial path.

Routine correction within existing static WASM inspection; advance maintainer scope decision is not applicable. No consumer repair or raw binary/debug-name reconstruction is introduced.

Contract and boundary impact

  • Owner: WabtInterface, before typed inspection Evidence is emitted.
  • CLI/MCP schemas and tool catalog: unchanged. Affected entries now expose existing null/issue fields; comparison reports unknown with partial coverage.
  • Provider/platform: existing WABT 1.0.42 tools and supervision. No new provider or target authority.
  • Evidence/provenance: original WAT, artifact identity, inventory completeness and known numeric indices remain preserved.
  • Generated metadata, dependencies, installation and release metadata: unchanged.

Expected effects describe the existing inspection workflow:

  • 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.

Inspection invokes WABT and writes owned temporary snapshots; this fix adds no target execution, mutation or network access. No WASM module was instantiated or executed during validation.

Evidence and regression coverage

On base d532b18123916a9e88f98c7880ba4f984e23d715, real WABT assembly/validation and public CLI inspection/comparison reproduced:

Fixture Before After
Two colliding function labels unchanged 2, complete unknown 2, partial
Imported/defined function collision unchanged 2, complete unknown 2, partial
Distinct-name control changed 1, unchanged 1, complete changed 1, unchanged 1, complete
Colliding type labels incorrect confident signatures null signatures/issues, known export indices retained
Table/memory/global/tag collisions unchanged 8, complete unknown 8, partial

Seven new producer regressions failed against the original implementation (7 failed, 6 passed). The extended real-provider verifier also failed on the original index 0 versus expected null. Numeric type/export references and unique controls retain accurate signatures. The real-provider lane checks compiled CLI/MCP comparison parity, retained Evidence, exact WAT entry evidence and all five export index spaces.

  • 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

Linux cloud, pinned Node 24.18.0/npm 11.16.0, native WABT 1.0.42:

  • npm run test:focused -- src/wasm/WabtInterface.test.ts src/wasm/WabtOutput.test.ts src/wasm/WabtArtifactProvider.test.ts src/application/wasm/WasmInterfaceComparisonService.test.ts — 61 passed across four files.
  • npm run check — passed all six tasks and architecture guards; lint reports zero errors.
  • npm run verify:test-discovery — all 1,720 files discovered exactly once.
  • npm run test:focused -- tests/acceptance/wasmInterfaceComparison.test.ts tests/boundary/mcp/wasmArtifactMcp.test.ts — eight passed; four reached the configured 30-second timeout. A single-worker node scripts/run-exact-tests.mjs run ... --testTimeout=120000 --maxWorkers=1 --testNamePattern=... retry of only those four passed (4 passed, 8 filtered skips), including the acceptance case in 59.7 seconds; repository defaults are unchanged.
  • REA_WABT_BIN_DIRECTORY=/workspace/toolchains/wabt-1.0.42/bin node scripts/verify-wasm-interface-comparison.mjs — passed compiled CLI/stdio MCP parity and 14 named scenario groups, including all collision regressions.
  • Public CLI before/after replay — all ten assembled/validated modules and five comparison expectations passed on the fixed runtime; exact WAT and selected artifact SHA-256 independently matched for all ten.
  • git diff --check — passed.

Compatibility, safety, and release

No schema, package or migration change. Results are conservative unknowns where normalized names lose identity; they do not establish runtime/ABI compatibility. Linux/WABT 1.0.42 only: no macOS/Windows run, full local suite or additional engine coverage is claimed. CI results must be assessed for the published head.

Author readiness

Human owner: @maxazure

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

AI-assisted implementation; draft pending the human owner's review and readiness declarations.

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/5417 **Author:** [@maxazure](https://github.com/maxazure) **Created:** 10/20/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/wasm-ambiguous-debug-names` --- ### 📝 Commits (1) - [`68f0fd3`](https://github.com/morluto/rea/commit/68f0fd38a81340e82d72e596cd2aa288eaf89692) fix(wasm): preserve ambiguous normalized debug labels ### 📊 Changes **3 files changed** (+231 additions, -17 deletions) <details> <summary>View changed files</summary> 📝 `scripts/verify-wasm-interface-comparison.mjs` (+121 -1) 📝 `src/wasm/WabtInterface.test.ts` (+77 -0) 📝 `src/wasm/WabtInterface.ts` (+33 -16) </details> ### 📄 Description ## Summary Fixes #5395. Distinct debug names such as `a b` and `a_b` normalize to the same WABT label. Inspection previously selected the first matching function, and comparison hid a real parameter change as two unchanged exports with complete coverage. ## Problem and expected behavior Resolve a named reference only when its label identifies one definition. Ambiguous identity must retain null facts and a per-entry issue. Numeric references, unique names, exact WAT and complete import/export inventories must remain available. ## Change and scope Record label uniqueness while constructing each producer-owned index space, including named types. A duplicate remains unresolved rather than selecting the first export definition or the last type definition. Remove the superseded per-definition display-label lookup. Comparison consumes these typed facts through its existing unknown/partial path. Routine correction within existing static WASM inspection; advance maintainer scope decision is not applicable. No consumer repair or raw binary/debug-name reconstruction is introduced. ## Contract and boundary impact - Owner: `WabtInterface`, before typed inspection Evidence is emitted. - CLI/MCP schemas and tool catalog: unchanged. Affected entries now expose existing null/issue fields; comparison reports unknown with partial coverage. - Provider/platform: existing WABT 1.0.42 tools and supervision. No new provider or target authority. - Evidence/provenance: original WAT, artifact identity, inventory completeness and known numeric indices remain preserved. - Generated metadata, dependencies, installation and release metadata: unchanged. Expected effects describe the existing inspection workflow: - [x] Read existing files or captured data. - [x] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [x] 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. Inspection invokes WABT and writes owned temporary snapshots; this fix adds no target execution, mutation or network access. No WASM module was instantiated or executed during validation. ## Evidence and regression coverage On base `d532b18123916a9e88f98c7880ba4f984e23d715`, real WABT assembly/validation and public CLI inspection/comparison reproduced: | Fixture | Before | After | | --- | --- | --- | | Two colliding function labels | unchanged 2, complete | unknown 2, partial | | Imported/defined function collision | unchanged 2, complete | unknown 2, partial | | Distinct-name control | changed 1, unchanged 1, complete | changed 1, unchanged 1, complete | | Colliding type labels | incorrect confident signatures | null signatures/issues, known export indices retained | | Table/memory/global/tag collisions | unchanged 8, complete | unknown 8, partial | Seven new producer regressions failed against the original implementation (7 failed, 6 passed). The extended real-provider verifier also failed on the original index 0 versus expected null. Numeric type/export references and unique controls retain accurate signatures. The real-provider lane checks compiled CLI/MCP comparison parity, retained Evidence, exact WAT entry evidence and all five export index spaces. - [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 Linux cloud, pinned Node 24.18.0/npm 11.16.0, native WABT 1.0.42: - `npm run test:focused -- src/wasm/WabtInterface.test.ts src/wasm/WabtOutput.test.ts src/wasm/WabtArtifactProvider.test.ts src/application/wasm/WasmInterfaceComparisonService.test.ts` — 61 passed across four files. - `npm run check` — passed all six tasks and architecture guards; lint reports zero errors. - `npm run verify:test-discovery` — all 1,720 files discovered exactly once. - `npm run test:focused -- tests/acceptance/wasmInterfaceComparison.test.ts tests/boundary/mcp/wasmArtifactMcp.test.ts` — eight passed; four reached the configured 30-second timeout. A single-worker `node scripts/run-exact-tests.mjs run ... --testTimeout=120000 --maxWorkers=1 --testNamePattern=...` retry of only those four passed (4 passed, 8 filtered skips), including the acceptance case in 59.7 seconds; repository defaults are unchanged. - `REA_WABT_BIN_DIRECTORY=/workspace/toolchains/wabt-1.0.42/bin node scripts/verify-wasm-interface-comparison.mjs` — passed compiled CLI/stdio MCP parity and 14 named scenario groups, including all collision regressions. - Public CLI before/after replay — all ten assembled/validated modules and five comparison expectations passed on the fixed runtime; exact WAT and selected artifact SHA-256 independently matched for all ten. - `git diff --check` — passed. ## Compatibility, safety, and release No schema, package or migration change. Results are conservative unknowns where normalized names lose identity; they do not establish runtime/ABI compatibility. Linux/WABT 1.0.42 only: no macOS/Windows run, full local suite or additional engine coverage is claimed. CI results must be assessed for the published head. ## Author readiness Human owner: @maxazure - [ ] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [ ] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [ ] I declare this PR ready for initial maintainer review. AI-assisted implementation; draft pending the human owner's review and readiness declarations. ## 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-01 21:44:05 +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#6923
No description provided.