fix(runtime): stop reporting readiness without an engine

Built without the wasmtime-runtime feature, weft-runtime printed READY
and exited without executing anything. weft-appd treats READY on the
runtime's stdout as the readiness signal, so such a build made a session
appear to start successfully although no component ran.

The feature-disabled build now exits with an error naming the missing
feature, so appd sees the runtime close without READY and stops the
session. The binary still builds for the portable type, lint and unit
checks. The Nix package keeps building the engine-enabled runtime.

Validation:
- new unit test: run_module in a feature-disabled build returns an error
  naming the feature; it fails against the previous stub
- feature-disabled binary against a minimal package: exits 1 with the
  error and prints no READY
- cargo test -p weft-runtime (5 passed), clippy -D warnings, fmt --check
This commit is contained in:
Marco Allegretti 2026-10-09 00:41:43 +00:00
parent b99cc73a47
commit f6d5cf102c
No known key found for this signature in database
2 changed files with 12 additions and 3 deletions

View file

@ -87,8 +87,9 @@ fn run_module(
_preopen: &[(String, String)], _preopen: &[(String, String)],
_ipc_socket: Option<&str>, _ipc_socket: Option<&str>,
) -> anyhow::Result<()> { ) -> anyhow::Result<()> {
println!("READY"); anyhow::bail!(
Ok(()) "weft-runtime was built without the wasmtime-runtime feature and cannot execute components"
)
} }
#[cfg(feature = "wasmtime-runtime")] #[cfg(feature = "wasmtime-runtime")]
@ -506,6 +507,14 @@ fn package_store_roots() -> Vec<PathBuf> {
mod tests { mod tests {
use super::*; use super::*;
#[cfg(not(feature = "wasmtime-runtime"))]
#[test]
fn engine_disabled_build_refuses_to_run_components() {
let err = run_module(std::path::Path::new("app.wasm"), &[], None)
.expect_err("a build without wasmtime-runtime must not report success");
assert!(err.to_string().contains("wasmtime-runtime"));
}
#[test] #[test]
fn package_store_roots_includes_system_path() { fn package_store_roots_includes_system_path() {
let roots = package_store_roots(); let roots = package_store_roots();

View file

@ -62,7 +62,7 @@ cargo build --release
cargo build -p weft-runtime --features wasmtime-runtime,net-fetch cargo build -p weft-runtime --features wasmtime-runtime,net-fetch
``` ```
Without `--features wasmtime-runtime`, the runtime prints READY and exits (stub mode, used in CI on platforms without Linux system dependencies). Without `--features wasmtime-runtime`, the runtime compiles for type, lint and unit checks (the portable CI configuration) but exits with an error when asked to run a component; it never reports readiness.
## Signing packages ## Signing packages