Skip to content

feat(wasm): compare retained core-module interfaces - #2464

Merged
morluto merged 2 commits into
morluto:mainfrom
thangldw:codex/compare-wasm-interfaces
Oct 13, 2026
Merged

morluto merged 2 commits into
morluto:mainfrom
thangldw:codex/compare-wasm-interfaces

Conversation

@thangldw

Copy link
Copy Markdown
Contributor

Summary

Fixes #2356. Adds compare_wasm_interfaces / rea compare-wasm-interfaces to compare declared core-module imports and exports from two authenticated inspect_wasm_artifact Evidence records. Results preserve original artifact identities and distinguish added, removed, changed, unchanged and unknown observations.

Problem and expected behavior

Inspection previously retained exact WAT forms without a typed interface comparison. Byte differences or changed type indices cannot establish whether a function signature changed. The WABT producer now resolves typed interface facts once; comparison consumes those facts without rereading files or reparsing retained display text.

The input requires scope: imports | exports | both and accepts portable inline Evidence or exact current-session references. For example, two differently encoded modules can report unchanged interfaces despite different original SHA-256 digests; a changed parameter type reports changed. Duplicate names and incomplete inventories remain unknown.

Change and scope

  • Add optional producer-owned interface facts with exact decoded names, kinds, resolved function/tag signatures, table/memory limits, memory page size and global type/mutability. Original WAT forms remain intact; historical Evidence can omit the facet.
  • Preserve every duplicate occurrence and unsupported signature. Partial coverage cannot establish absence or per-key uniqueness.
  • Bound declaration allocation and repeated signature expansion; capacity refusal preserves bounded partial facts and the existing WAT observation. Comparison groups linearly and yields for cancellation.
  • Register shared CLI/MCP comparison, update documentation and add spec/plan/verification under docs/specs/2356-wasm-interface-comparison/.
  • Correct the existing real-WABT verifier's stale inline partial-observation assumption by resolving and authenticating the retained MCP record.

This is core-module comparison. #2406 separately adds component decoding; this patch neither depends on nor duplicates its component parser. No component ABI comparison, module instantiation or runtime-compatibility inference is added.

Contract and boundary impact

  • Semantic owner: WABT adapter owns typed decoding; shared application service authenticates and compares supplied Evidence.
  • Scope/maintainer decision: static analysis within existing inspection and artifact-comparison authority; no new provider or expanded target execution/mutation authority. Separate advance decision is not applicable.
  • CLI/MCP: additive comparison tool/command, required scope, optional inspection facet, validated advertised schemas.
  • Compatibility: existing inspection output and historical Evidence remain valid; unsupported signature semantics are explicit unknowns.
  • Provenance: both input Evidence IDs and original path/digest/length are retained; derived Evidence links to its authenticated sources.
  • Authority/cleanup: comparison consumes supplied data only; existing WABT snapshot/process ownership is reused by inspection.
  • Generated/package impact: authored contract/catalog/skill references and an optional verifier command are updated. Ignored generated catalogs, skills and binaries are not committed; no dependency or release-version change.

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

  • Producer tests cover imported index spaces, escaped/BOM/empty names, all admitted kinds, recursive/unsupported types, memory page size and repeated type-use capacity.
  • Comparison tests cover all result states, duplicate ambiguity, historical/partial observations, tampered identity, retained lookup and cancellation.
  • Public compiled CLI/MCP tests validate advertised schemas, parity, source retention and derived Evidence links.
  • Independent review found and repaired custom page-size omission, shared-signature expansion undercounting, and partial singleton uniqueness. Final review reported no remaining actionable findings.
  • Real owned modules assembled with WABT cover padded LEB128 equivalence, signature/page-size changes, duplicate imports and unadmitted exception reference types. No module was instantiated or executed.

For evidence-bearing changes:

  • Observed and derived claims remain distinguishable.
  • Artifact identity, source provenance and failed attempts remain preserved.
  • Unsupported, partial and uncertain outcomes remain visible.

Validation performed

On main base a2d8b94dd50dab8d966239dd63ab84718aa8b4b4:

  • Focused parser/provider/service/contract/CLI/MCP selection: 56 tests passed in 8 files.
  • npm run check: passed, including typecheck, lint, formatting, knip and architecture guards; lint warnings remain.
  • npm run docs:generate and npm run docs:check: passed.
  • npm run verify:test-discovery: 1011 files, each discovered exactly once.
  • node scripts/verify-wasm-interface-comparison.mjs with WABT 1.0.42: passed through compiled CLI and stdio MCP.
  • node scripts/verify-wasm-artifact.mjs --require-tools: 42 real-tool cases passed.

Compatibility, safety, and release

No breaking change, migration, new dependency or release metadata change. Comparison reads only explicitly supplied Evidence; source acquisition and execution are not performed. Static equality is not runtime/ABI compatibility or successful linking. Real-tool verification covers macOS arm64; native Linux/Windows lanes remain unverified. Token usage and concurrent process-family peak memory are unmeasured. CI remains separate from local verification.

Before merge

  • This PR addresses a concrete enhancement and links its issue.
  • Material scope and authority questions are resolved for this static workflow.
  • One focused outcome with a Conventional Commit title.
  • Tests cover observable behavior and meaningful failure paths.
  • Owning docs, contracts and generated metadata are updated.
  • CLI/MCP parity and representative results are verified.
  • Final diff checked for secrets, unrelated cleanup and unsupported claims.

Resolve producer-owned typed interface facts and compare authenticated Evidence with explicit scope, provenance and unknown coverage. Bound repeated signature expansion and preserve partial observations.

Fixes #2356
@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Repo admins can enable using credits for code reviews in their settings.

@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

@greptileai review

@greptile-apps

greptile-apps Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge; the previous finding is fixed and no new blocking issues were found.

Summary

Adds core-module interface comparison from supplied inspection Evidence through CLI and MCP.

  • Two inspection records now show which core interfaces differ.
  • WASM inspections now keep typed facts for each declared interface entry.
  • WASM comparison checks now cover the CLI and MCP workflows.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[WABT inspection] --> B[Evidence with typed interfaces]
  B --> C[CLI inline Evidence or MCP session reference]
  C --> D[Authenticate supplied Evidence]
  D --> E[Group selected imports and exports]
  E --> F[Compare supported unique entries]
  E --> G[Keep incomplete or unsupported entries unknown]
  F --> H[Derived Evidence with source links]
  G --> H
Loading

Reviews (2) · Last reviewed commit: "fix(wasm): keep unsupported one-sided in..." · Reviewed by Greptile

Address review findings at their producing boundaries and preserve directly affected consumers. Source inspection and git diff --check completed. Tests and automated checks were not run at the user’s explicit request.
@morluto

morluto commented Oct 13, 2026

Copy link
Copy Markdown
Owner

Review findings addressed at their producing boundaries and consumers. Latest changes were reviewed from source; tests and provider runs were skipped at the maintainer's request. Findings requiring separate decisions or verification remain open.

  1. thread 1

The absence branches ran before validating the present entry’s admitted semantics. Comparison now checks every present entry’s signature/issue/kind before added/removed/changed classification, so one-sided unsupported types remain unknown and coverage partial. Removed superseded downstream signature checks and redundant inventory tests. Added both comparison directions for an unsupported signature.

Source inspection and git diff --check completed. Tests and automated checks were not run at the user’s explicit request. Commit: 01c8eb0

@morluto morluto added enhancement New feature or request area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior area: cli CLI adapter and one-shot commands area: server Server layer and tool wiring P2: medium Medium priority issue labels Oct 13, 2026
@morluto
morluto merged commit 911894d into morluto:main Oct 13, 2026
44 checks passed
@morluto morluto mentioned this pull request Oct 14, 2026
3 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: cli CLI adapter and one-shot commands area: native Native analysis and decompilation, including Ghidra, IDA, and Hopper analysis behavior area: server Server layer and tool wiring enhancement New feature or request P2: medium Medium priority issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature] Compare admitted WebAssembly import and export interfaces

2 participants