Skip to content
Merged
Show file tree
Hide file tree
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
47 changes: 23 additions & 24 deletions crates/policy-evaluator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,30 +66,29 @@ wasmtime = { workspace = true, default-features = true }
# Workaround for https://github.com/bytecodealliance/wasmtime/issues/12217
[target.'cfg(all(target_os = "macos", target_arch = "x86_64"))'.dependencies]
wasmtime = { workspace = true, features = [
"addr2line",
"async",
"cache",
"compile-time-builtins",
"component-model",
"component-model-async",
"coredump",
"cranelift",
"debug",
"debug-builtins",
"demangle",
"gc",
"gc-drc",
"gc-null",
"once_cell",
"parallel-compilation",
"pooling-allocator",
"profiling",
"runtime",
"std",
"threads",
"wasmtime-jit-debug",
"wasmtime-jit-icache-coherence",
"wat",
'addr2line',
'anyhow',
'async',
'backtrace',
'cache',
'compile-time-builtins',
'component-model',
'component-model-async',
'coredump',
'cranelift',
'debug',
'debug-builtins',
'demangle',
'gc',
'gc-drc',
'gc-null',
'parallel-compilation',
'pooling-allocator',
'profiling',
'runtime',
'std',
'threads',
'wat',
Comment on lines +69 to +91
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

For consistency with the rest of the repo's Cargo.toml files (and to minimize churn with TOML formatters), consider using double-quoted strings for the wasmtime feature names here instead of single-quoted literal strings.

Suggested change
'addr2line',
'anyhow',
'async',
'backtrace',
'cache',
'compile-time-builtins',
'component-model',
'component-model-async',
'coredump',
'cranelift',
'debug',
'debug-builtins',
'demangle',
'gc',
'gc-drc',
'gc-null',
'parallel-compilation',
'pooling-allocator',
'profiling',
'runtime',
'std',
'threads',
'wat',
"addr2line",
"anyhow",
"async",
"backtrace",
"cache",
"compile-time-builtins",
"component-model",
"component-model-async",
"coredump",
"cranelift",
"debug",
"debug-builtins",
"demangle",
"gc",
"gc-drc",
"gc-null",
"parallel-compilation",
"pooling-allocator",
"profiling",
"runtime",
"std",
"threads",
"wat",

Copilot uses AI. Check for mistakes.
] }
Comment on lines 68 to 92
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

This macOS x86_64 wasmtime feature override is intended to "replicate default features minus stack-switching", but the feature list now diverges from the similar override in crates/burrego/Cargo.toml (same workaround comment). To avoid target-specific build/behavior drift, consider updating the other manifest(s) in the same PR or centralizing the list so they stay in sync.

Copilot uses AI. Check for mistakes.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,8 @@ impl PolicyEvaluatorBuilder {
if self.epoch_deadlines.is_some() {
wasmtime_config.epoch_interruption(true);
}
// required by policies built by the official go compiler >= 1.26.0
wasmtime_config.wasm_function_references(true);

Comment on lines +208 to 210
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

wasm_function_references(true) is now required for Go >= 1.26 policies when this builder constructs its own Engine, but users can also supply a custom wasmtime::Engine via PolicyEvaluatorBuilder::engine(...). The existing docs only warn about enabling epoch_interruption; please also document that custom engines must enable wasm_function_references (or otherwise Go >= 1.26 policies will fail to load).

Copilot uses AI. Check for mistakes.
Comment on lines +208 to 210
Copy link

Copilot AI Apr 24, 2026

Choose a reason for hiding this comment

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

This change is meant to restore compatibility with Go >= 1.26 WASI policies, but there isn't a regression test that would fail without wasm_function_references(true). Consider adding a unit/integration test that attempts to compile/load a minimal module requiring function references (e.g., a tiny WAT using ref.func / funcref) to prevent future regressions.

Copilot uses AI. Check for mistakes.
wasmtime::Engine::new(&wasmtime_config)
},
Expand Down
4 changes: 3 additions & 1 deletion crates/policy-server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,9 @@ impl PolicyServer {
)
.await;

let mut wasmtime_config = wasmtime::Config::new();
let mut wasmtime_config = wasmtime::Config::default();
// required by policies built by the official go compiler >= 1.26.0
wasmtime_config.wasm_function_references(true);

let any_policy_has_timeout = config.policies.values().any(|policy| match policy {
config::PolicyOrPolicyGroup::Policy {
Expand Down