Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 14 additions & 27 deletions crates/plugin-wasm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ impl PluginRuntime {
let mut engine_config = Config::new();
engine_config.wasm_component_model(true);
engine_config.wasm_simd(config.enable_simd);
if !config.enable_simd {
engine_config.wasm_relaxed_simd(false);
}
engine_config.wasm_threads(config.enable_threads);
Comment on lines 76 to 80
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

📝 Info: Disabled SIMD now also disables relaxed SIMD while preserving the default feature set

The Wasmtime config still leaves relaxed SIMD at Wasmtime's default when enable_simd=true, but explicitly disables relaxed SIMD when base SIMD is disabled. That matches the exposed PluginRuntimeConfig::enable_simd contract and avoids changing default plugin compatibility for runtimes that still allow SIMD.

Open in Devin Review (Staging)

Was this helpful? React with 👍 or 👎 to provide feedback.

Debug

Playground


let engine = Engine::new(&engine_config)?;
Expand Down Expand Up @@ -295,19 +298,17 @@ pub fn namespaced_kind(kind: &str) -> Result<String, String> {
return Ok(kind.to_string());
}

// Validate: reject if contains namespace separator
if kind.contains("::") {
if kind.starts_with(RESERVED_PREFIX) {
return Err(format!(
"Plugin kind '{kind}' contains '::' which is reserved for namespace prefixes. \
Plugin kinds must be simple names like 'gain', 'reverb', etc."
"Plugin kind '{kind}' uses reserved prefix '{RESERVED_PREFIX}'. \
This prefix is reserved for built-in core nodes."
));
}

// Validate: reject if uses reserved prefix
if kind.starts_with(RESERVED_PREFIX) {
if kind.contains("::") {
return Err(format!(
"Plugin kind '{kind}' uses reserved prefix '{RESERVED_PREFIX}'. \
This prefix is reserved for built-in core nodes."
"Plugin kind '{kind}' contains '::' which is reserved for namespace prefixes. \
Plugin kinds must be simple names like 'gain', 'reverb', etc."
));
}
Comment on lines +301 to 313
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

📝 Info: core:: kinds now fail with the reserved-prefix error before the generic namespace check

The guard order in namespaced_kind now checks kind.starts_with("core::") before the broader kind.contains("::"), so core::audio remains rejected but receives the more specific reserved-prefix message. This is a behavior change only for diagnostics/logging from register_plugins; current registration behavior still skips the plugin either way, so I did not classify it as a bug.

Open in Devin Review (Staging)

Was this helpful? React with 👍 or 👎 to provide feedback.

Debug

Playground


Expand Down Expand Up @@ -394,23 +395,16 @@ mod tests {
}

#[test]
fn plugin_runtime_new_rejects_disabled_simd_due_to_relaxed_simd_default() {
// BUG (tracked in #469): PluginRuntimeConfig exposes `enable_simd: false`, but
// wasmtime enables the relaxed-simd proposal by default, which requires the base
// SIMD proposal. The resulting config error ("cannot disable the simd proposal but
// enable the relaxed simd proposal") means every `enable_simd: false` config —
// including the threads combination — fails initialization. Pin current (broken)
// behavior until fixed.
fn plugin_runtime_new_succeeds_with_simd_disabled() {
for enable_threads in [false, true] {
let cfg = PluginRuntimeConfig {
max_memory_bytes: 16 * 1024 * 1024,
enable_simd: false,
enable_threads,
};
assert!(
PluginRuntime::new(cfg).is_err(),
"expected init to fail when enable_simd=false (enable_threads={enable_threads})"
);
PluginRuntime::new(cfg).unwrap_or_else(|e| {
panic!("enable_simd=false (enable_threads={enable_threads}) must succeed: {e}")
});
}
}

Expand All @@ -435,14 +429,7 @@ mod tests {
#[test]
fn namespaced_kind_rejects_reserved_core_prefix() {
let err = namespaced_kind("core::audio").expect_err("must reject `core::` kinds");
// BUG (tracked in #470): the `core::` check is unreachable because any string
// containing `::` is already rejected by the namespace-separator guard. Pin the
// current behavior — the error message references the namespace-separator rule,
// not the reserved-prefix rule — so the test fails if the contract is revisited.
assert!(
err.contains("reserved for namespace prefixes"),
"expected namespace-separator error, got: {err}"
);
assert!(err.contains("reserved prefix"), "expected reserved-prefix error, got: {err}");
}

#[test]
Expand Down
Loading