Minor quality-of-life improvements to component test/debug infrastructure - #1720
Conversation
There was a problem hiding this comment.
Pull request overview
Adds WAT support and improves macro debug-output ergonomics in Hyperlight’s component bindgen utilities/macros, enabling easier iteration when authoring or inspecting component-model interface definitions.
Changes:
- Add
wat:file support (and inline WAT detection) alongside existing wasm-encoded WIT, WIT, and inline WIT inputs. - Improve
$HYPERLIGHT_COMPONENT_MACRO_DEBUGhandling by allowing placeholder substitution based on the component’s kebab name. - Extend macro parameter parsing and error messages to recognize the new
watsource kind.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/hyperlight_component_util/src/util.rs | Adds WAT parsing paths, inline input detection, and enhances macro debug-file naming. |
| src/hyperlight_component_util/Cargo.toml | Adds the wat crate dependency required for WAT parsing. |
| src/hyperlight_component_macro/src/lib.rs | Accepts wat: as a macro parameter and passes kebab name into the debug-emission helper. |
Suppressed comments (1)
src/hyperlight_component_util/src/util.rs:80
- Similarly,
wat::parse_strfailures are parse errors; the panic message saying "failed to read" is misleading.
let bytes = wat::parse_str(&contents).unwrap_or_else(|err| {
panic!("failed to read inline wat input: {err:#}")
});
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
27ff446 to
5e5d8c3
Compare
jsturtevant
left a comment
There was a problem hiding this comment.
Having WAT and wit makes testing easier!
a133af5 to
9993f23
Compare
The inline version of the wat is used elsewhere which I think is good enough---I don't think we have any testing of the file path variants other than the wit one right now, so maybe it's worth adding that in the future, but I don't think worth doing right now. I don't believe there is presently any documentation in this repo that covers the other syntax, either, so again it may be worth adding later, but IMO not right now. |
9993f23 to
0ce204c
Compare
Previously, when using `HYPERLIGHT_COMPONENT_MACRO_DEBUG` to debug an issue with the Rust bindings generation, if the bindings generator macros were invoked multiple times during a single compile run, later invocations would overwrite the file specified by earlier invocations, leading to the earlier code getting lost and producing spurious compilation errors. This changes the relevant logic to support a template character (presently `#`) in the path, which is replaced by a version of the wit name for the world being worked on. Whilst there is still room for confusion between e.g. guest and host versions of the same world, this makes debugging a lot more possible. Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
This is a minor change, bridging the gap between the already-supported textual WIT and binary formats. Signed-off-by: Lucy Menon <168595099+syntactically@users.noreply.github.com>
0ce204c to
9839de3
Compare
No description provided.