Skip to content

Minor quality-of-life improvements to component test/debug infrastructure - #1720

Merged
syntactically merged 2 commits into
mainfrom
lm/component-test-qol
Aug 13, 2026
Merged

Minor quality-of-life improvements to component test/debug infrastructure#1720
syntactically merged 2 commits into
mainfrom
lm/component-test-qol

Conversation

@syntactically

Copy link
Copy Markdown
Member

No description provided.

Copilot AI lite review requested due to automatic review settings August 12, 2026 10:21
@syntactically syntactically added the kind/enhancement For PRs adding features, improving functionality, docs, tests, etc. label Aug 12, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_DEBUG handling by allowing placeholder substitution based on the component’s kebab name.
  • Extend macro parameter parsing and error messages to recognize the new wat source 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_str failures 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.

Comment thread src/hyperlight_component_util/src/util.rs Outdated
Comment thread src/hyperlight_component_util/src/util.rs
Comment thread src/hyperlight_component_util/src/util.rs
Comment thread src/hyperlight_component_util/src/util.rs
@syntactically
syntactically force-pushed the lm/component-test-qol branch from 27ff446 to 5e5d8c3 Compare August 12, 2026 10:29
jsturtevant
jsturtevant previously approved these changes Aug 12, 2026

@jsturtevant jsturtevant left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Having WAT and wit makes testing easier!

@ludfjig ludfjig left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm. Should we exercise the wat somewhere in a test? And do we want to update the public doc on the macro to include the new syntax?

@syntactically
syntactically force-pushed the lm/component-test-qol branch from a133af5 to 9993f23 Compare August 12, 2026 19:48
@syntactically

Copy link
Copy Markdown
Member Author

lgtm. Should we exercise the wat somewhere in a test? And do we want to update the public doc on the macro to include the new syntax?

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.

@syntactically
syntactically force-pushed the lm/component-test-qol branch from 9993f23 to 0ce204c Compare August 13, 2026 08:58
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>
@syntactically
syntactically force-pushed the lm/component-test-qol branch from 0ce204c to 9839de3 Compare August 13, 2026 10:47
@syntactically syntactically added the ready-for-review PR is ready for (re-)review label Aug 13, 2026
@syntactically
syntactically merged commit 9839de3 into main Aug 13, 2026
51 checks passed
@syntactically
syntactically deleted the lm/component-test-qol branch August 13, 2026 11:52
@github-actions github-actions Bot removed the ready-for-review PR is ready for (re-)review label Aug 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/enhancement For PRs adding features, improving functionality, docs, tests, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants