fix: handle empty namespace paths in component codegen#1331
Merged
jsturtevant merged 2 commits intoJun 19, 2026
Conversation
dblnz
reviewed
Mar 25, 2026
dblnz
left a comment
Contributor
There was a problem hiding this comment.
Great to see this change!
It's been bugging me for some time when working on component debugging .
I am still new to this part of the codebase, maybe someone with more insight can have a look.
f12a24f to
d9ee203
Compare
When a WIT interface has no namespace path (e.g. no package prefix), the generated Rust code would produce invalid double-colon (::) paths. Add guards to emit correct paths when the namespace is empty. Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
d9ee203 to
fb96c87
Compare
d426239 to
20d73d5
Compare
Signed-off-by: James Sturtevant <jsturtevant@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a Rust path generation bug in Hyperlight’s component bindings when a WIT interface has an empty namespace path (previously producing invalid leading :: segments), and adds a shared bindgen-focused WIT fixture plus CI artifact plumbing to support future bindgen test expansion.
Changes:
- Adjusted Rust token emission to avoid generating
::...paths whennamespace_path()is empty (e.g., emitTraitinstead of::Trait). - Added a new shared WIT fixture (
bindgen-test-cases) and a host-side compile-time test that exercises the plain-export interface codegen path. - Updated guest-build and build-test CI workflows to upload/download the new
bindgen-test-cases.wasmartifact, and updated theJustfileto produce it.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/tests/rust_guests/witguest/bindgen-test-cases/world.wit |
Adds a reusable WIT fixture with an unqualified exported interface to reproduce/guard the empty-namespace path case. |
src/hyperlight_host/tests/wit_test.rs |
Adds a compile-time test that references generated types from the new fixture, ensuring codegen produces valid Rust paths. |
src/hyperlight_component_util/src/rtypes.rs |
Fixes several codegen sites to avoid inserting :: when namespace_path() is empty. |
src/hyperlight_component_util/src/host.rs |
Fixes host export-instance impl emission to use a local trait path when the namespace is empty. |
Justfile |
Generates bindgen-test-cases.wasm alongside existing WIT-derived wasm fixtures. |
.github/workflows/dep_build_test.yml |
Downloads the new fixture wasm artifact for build/test jobs. |
.github/workflows/dep_build_guests.yml |
Uploads the new fixture wasm artifact (debug build) for downstream jobs. |
andreiltd
approved these changes
Jun 19, 2026
ludfjig
approved these changes
Jun 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1329.
This updates component code generation so WIT interfaces without a namespace emit local Rust paths instead of paths with an invalid leading separator.
It also adds the shared
bindgen-test-casesWIT fixture and CI artifact plumbing so stacked bindgen-focused PRs can extend the same fixture instead of adding one-off wasm artifacts. This is an simple with test case but it gets tricky to add all of the examples there so split this out to catch all the edge cases.