Skip to content

feat: resource graph fixes, emit-import-map, and stable clippy#55

Merged
avrabe merged 6 commits intomainfrom
feat/resource-graph-fixes-and-import-map
Mar 22, 2026
Merged

feat: resource graph fixes, emit-import-map, and stable clippy#55
avrabe merged 6 commits intomainfrom
feat/resource-graph-fixes-and-import-map

Conversation

@avrabe
Copy link
Contributor

@avrabe avrabe commented Mar 22, 2026

Summary

  • Pre-commit fix: Use cargo +stable clippy so the hook works when nightly toolchain lacks the clippy component
  • --emit-import-map: New CLI flag for synth/kiln integration — writes JSON mapping each fused module import to its index, module, and field name
  • Resource graph fixes (3 interrelated):
    1. Build resource ownership graph BEFORE identify_adapter_sites so graph-based callee_defines_resource override actually runs (was dead code)
    2. defines_resource/resource_definer try bare, [export]-prefixed, and stripped interface name variants
    3. own<T> result transfers now call resource.rep then resource.new (was missing resource.rep)
    4. Re-exporter removal narrowed to specific interface (was removing all entries)
    5. Graph override uses one-way logic (only change when definitive answer)

Test plan

  • All 73 wit-bindgen tests pass (41 runtime + 4 fuse-only + 28 other)
  • All 157 unit tests pass
  • cargo +stable clippy --all-targets -- -D warnings clean
  • cargo fmt clean
  • No regressions in resources/xcrate fixtures

🤖 Generated with Claude Code

avrabe and others added 6 commits March 21, 2026 22:45
The nightly toolchain may not include the clippy component, causing
the pre-commit hook to fail. Use `cargo +stable clippy` to ensure
clippy is always available.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Adds `--emit-import-map <PATH>` to the `fuse` subcommand, which writes
a JSON file mapping each import in the fused module to its index,
module name, and field name. This enables the synth/kiln pipeline to
wire WASI host functions when cross-compiling fused WASM to ARM.

Output format: {"imports": [{"index": N, "module": "...", "name": "..."}]}

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… transfer

Three interrelated fixes for cross-component resource handle routing:

1. Build resource ownership graph BEFORE identify_adapter_sites so the
   graph-based callee_defines_resource override actually runs (was dead
   code — graph was always None at that point).

2. defines_resource/resource_definer try bare, [export]-prefixed, and
   [export]-stripped interface name variants. Core module imports use
   "[export]imports" while the resolver passes bare "imports". Also
   narrow the re-exporter removal pass to only remove entries for the
   specific interface being imported (was removing ALL entries).

3. Own<T> result transfers now call resource.rep (callee handle → rep)
   before resource.new (rep → caller handle). Previously only called
   resource.new which received a handle instead of a rep.

Graph override now uses one-way logic: only upgrade (false→true) when
graph confirms definer, only downgrade (true→false) when graph confirms
re-exporter. Unknown entries leave the heuristic value unchanged.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The cleanup pass now removes ALL defines_cache entries for a component
that imports a resource, regardless of the export interface name. A
component that imports "imports" and exports as "exports" is still a
re-exporter — the old code only removed entries where interface names
matched, missing cross-name re-export scenarios like resource_floats.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract three core WASM modules from the OSxCAR automotive demo
(osxcar.de/insights/demonstration/) — anti-pinch, motor driver,
and soft start/stop. These are real-world Aptiv components built
with wit-bindgen-c 0.46.0 for the anti-pinch window control system.

Includes:
- WIT interface definitions (reconstructed from jco JS bindings)
- Download script to extract base64-encoded WASM from demo page
- Build script to wrap core modules into P2 components
- README documenting cross-tool testing with meld/loom/synth/kiln/gale

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add a coverage job to CI using cargo-llvm-cov and codecov-action v5.
Generates lcov coverage data from all workspace tests and uploads to
Codecov. Add coverage badge to README.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@avrabe avrabe merged commit 5089f64 into main Mar 22, 2026
3 of 4 checks passed
@avrabe avrabe deleted the feat/resource-graph-fixes-and-import-map branch March 22, 2026 06:52
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