Skip to content

fix: synthesize caller's resource imports for per-component type identity#85

Merged
avrabe merged 1 commit intomainfrom
fix/synthesize-caller-resource-rep
Apr 2, 2026
Merged

fix: synthesize caller's resource imports for per-component type identity#85
avrabe merged 1 commit intomainfrom
fix/synthesize-caller-resource-rep

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented Apr 2, 2026

Summary

  • Synthesize [resource-rep] and [resource-new] imports for the caller component in cross-component adapter sites
  • This ensures the P2 wrapper creates a separate resource type per component, fixing the "handle index used with the wrong type" error (H-11.8)
  • The 3 resource chain tests now get past wasmtime's type validation (was: type mismatch, now: trap in wit-bindgen slab code — next layer to fix)

Progress on resource chain tests

Stage Before After
Resource type validation Fails ("wrong type") Passes
wit-bindgen ResourceTable slab Not reached Fails (unreachable trap)

The remaining trap is in wit-bindgen's ResourceTable code — the handle values from the handle table functions need further investigation to match what the slab expects.

Part of #69.

Test plan

  • 276 tests pass, 0 failures
  • No regressions — synthesis only adds imports when from_component != to_component
  • 3 resource chain tests remain fuse-only (next failure layer documented)

🤖 Generated with Claude Code

…tity

In 3-component chains, the caller (runner) needs its own [resource-rep]
and [resource-new] imports for the P2 wrapper to create a separate
resource type. Without this, the caller reuses the callee's (definer's)
resource type, causing wasmtime to reject handles with "used with the
wrong type" (H-11.8).

This fixes the resource type identity mismatch — the 3 resource chain
tests now get past type validation. They still trap in wit-bindgen's
ResourceTable slab code (handle value format issue), which is the next
layer to fix.

Part of #69.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@avrabe avrabe merged commit e0f56c5 into main Apr 2, 2026
4 checks passed
@avrabe avrabe deleted the fix/synthesize-caller-resource-rep branch April 2, 2026 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant