diff --git a/crates/bashkit-python/Cargo.toml b/crates/bashkit-python/Cargo.toml
index ab10e7684..e2fbf924a 100644
--- a/crates/bashkit-python/Cargo.toml
+++ b/crates/bashkit-python/Cargo.toml
@@ -34,7 +34,7 @@ num-bigint = "^0.4.6"
# http_client/sqlite/interop pull mio/tokio-net/rt-multi-thread/tokio::fs,
# none of which compile on wasm32-unknown-emscripten — see the wasm block
# below and knowledge/runtimes/emscripten-wheels.md.
-[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
+[target.'cfg(not(target_family = "wasm"))'.dependencies]
bashkit = { path = "../bashkit", features = ["python", "typescript", "realfs", "jq", "interop", "http_client", "sqlite", "terminal"] }
bashkit-scripted-tool = { path = "../bashkit-scripted-tool", features = ["python", "jq"] }
tokio = { workspace = true, features = ["rt-multi-thread"] }
@@ -49,7 +49,7 @@ pyo3-async-runtimes = { workspace = true }
# shell plus the embedded jq and Monty Python interpreters. tokio stays on its
# wasm-safe base features (sync, macros, io-util, rt, time) — current-thread
# runtime only. See knowledge/runtimes/emscripten-wheels.md.
-[target.'cfg(target_arch = "wasm32")'.dependencies]
+[target.'cfg(target_family = "wasm")'.dependencies]
bashkit = { path = "../bashkit", features = ["python", "typescript", "jq", "terminal"] }
bashkit-scripted-tool = { path = "../bashkit-scripted-tool", features = ["python", "jq"] }
tokio = { workspace = true }
diff --git a/crates/bashkit-python/src/lib.rs b/crates/bashkit-python/src/lib.rs
index 16c629d96..19cdbe6e7 100644
--- a/crates/bashkit-python/src/lib.rs
+++ b/crates/bashkit-python/src/lib.rs
@@ -12,16 +12,16 @@
// That leaves a handful of imports and helper functions referenced only from the
// native-gated code paths; silence the resulting dead-code/unused-import lints on
// wasm rather than scattering per-item cfgs through shared conversion helpers.
-#![cfg_attr(target_arch = "wasm32", allow(dead_code, unused_imports))]
+#![cfg_attr(target_family = "wasm", allow(dead_code, unused_imports))]
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
mod streaming;
mod terminal;
// interop (capsule FS handoff), realfs (host mounts) and the credential-injection
// network config require threads / host FS / sockets that wasm32-unknown-emscripten
// (Pyodide) does not provide — see knowledge/runtimes/emscripten-wheels.md. They are native-only.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
use bashkit::interop::fs::{BashkitFsAbiOwnedHandleV1, export_filesystem, import_owned_filesystem};
use bashkit::tool::VERSION;
use bashkit::{
@@ -66,7 +66,7 @@ use bashkit::{
CommitOptions as RustCommitOptions, ObjectId as RustObjectId,
SnapshotGraph as RustSnapshotGraph,
};
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
use bashkit::{Credential, RealFs, RealFsMode};
use pyo3::exceptions::{PyRuntimeError, PyTypeError, PyValueError};
use pyo3::prelude::*;
@@ -79,20 +79,20 @@ use pyo3::types::{
// multi-threaded tokio + mio sockets, which do not build on wasm. The async
// `execute()` family and caller-loop callback scheduling are therefore native-only;
// wasm exposes the blocking `execute_sync()` API. See knowledge/runtimes/emscripten-wheels.md.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
use pyo3_async_runtimes::TaskLocals;
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
mod async_bridge;
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
use async_bridge::future_into_py;
// `caller_loop_locals` is a captured asyncio-loop handle, only ever `Some` when an
// async `execute()` ran (native). On wasm there is no such loop, so the field is
// always `None`; aliasing the type to the uninhabited `Infallible` lets the shared
// session structs compile while making the caller-loop branches statically dead.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
type CallerLoopLocals = TaskLocals;
-#[cfg(target_arch = "wasm32")]
+#[cfg(target_family = "wasm")]
type CallerLoopLocals = std::convert::Infallible;
use std::collections::{HashMap, HashSet};
use std::future::Future;
@@ -242,9 +242,9 @@ fn interpreter_at_exit() -> bool {
/// Registered with `atexit` at module import; not part of the public API.
#[pyfunction]
fn _mark_interpreter_at_exit(_py: Python<'_>) {
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
async_bridge::shutdown(_py);
- #[cfg(target_arch = "wasm32")]
+ #[cfg(target_family = "wasm")]
INTERPRETER_AT_EXIT.store(true, Ordering::Release);
}
@@ -381,7 +381,7 @@ enum PyCredentialSpec {
// `Credential` is a core type gated behind `http_client`; the conversion is
// native-only (network injection is unavailable on wasm — see parse_network_config).
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
impl PyCredentialSpec {
fn into_credential(self) -> Credential {
match self {
@@ -393,7 +393,7 @@ impl PyCredentialSpec {
}
impl PyNetworkConfig {
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
fn to_allowlist(&self) -> NetworkAllowlist {
let base = if self.allow_all {
NetworkAllowlist::allow_all()
@@ -407,7 +407,7 @@ impl PyNetworkConfig {
// core `http_client` feature, which is off on wasm (no sockets in Pyodide).
// On wasm the whole network config is inert — `parse_network_config` rejects
// it up front (see that fn), so this is a native-only pass-through.
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
fn apply(&self, mut builder: bashkit::BashBuilder) -> bashkit::BashBuilder {
builder = builder.network(self.to_allowlist());
for inj in &self.credentials {
@@ -433,7 +433,7 @@ impl PyNetworkConfig {
// The Pyodide/Emscripten build has no outbound HTTP client (no sockets in the
// browser sandbox), so accepting a network allowlist would silently do nothing.
// Fail loudly instead. See knowledge/runtimes/emscripten-wheels.md.
-#[cfg(target_arch = "wasm32")]
+#[cfg(target_family = "wasm")]
fn parse_network_config(network: Option<&Bound<'_, PyDict>>) -> PyResult> {
if network.is_some() {
return Err(PyRuntimeError::new_err(
@@ -444,7 +444,7 @@ fn parse_network_config(network: Option<&Bound<'_, PyDict>>) -> PyResult >) -> PyResult > {
let Some(dict) = network else {
return Ok(None);
@@ -515,7 +515,7 @@ fn parse_network_config(network: Option<&Bound<'_, PyDict>>) -> PyResult >,
) -> PyResult> {
@@ -540,7 +540,7 @@ fn parse_credential_injections(
Ok(out)
}
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
fn parse_credential_placeholders(
value: Option<&Bound<'_, PyAny>>,
) -> PyResult> {
@@ -573,7 +573,7 @@ fn parse_credential_placeholders(
Ok(out)
}
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
fn require_string(dict: &Bound<'_, PyDict>, key: &str, label: &str) -> PyResult {
let value = dict.get_item(key)?.ok_or_else(|| {
PyValueError::new_err(format!("network['{label}'] missing required '{key}' key"))
@@ -583,7 +583,7 @@ fn require_string(dict: &Bound<'_, PyDict>, key: &str, label: &str) -> PyResult<
.map_err(|_| PyValueError::new_err(format!("network['{label}']['{key}'] must be a string")))
}
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
fn parse_credential_spec(
dict: &Bound<'_, PyDict>,
label: &str,
@@ -650,7 +650,7 @@ fn parse_credential_spec(
Ok(spec)
}
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
fn extract_string_pair(item: &Bound<'_, PyAny>) -> PyResult<(String, String)> {
if let Ok(tup) = item.cast::() {
if tup.len() != 2 {
@@ -667,14 +667,14 @@ fn extract_string_pair(item: &Bound<'_, PyAny>) -> PyResult<(String, String)> {
Err(PyValueError::new_err("expected a 2-element pair"))
}
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
fn build_allowed_keys(base: &[&str], extra: &[&str]) -> Vec {
let mut all: Vec = base.iter().map(|s| s.to_string()).collect();
all.extend(extra.iter().map(|s| s.to_string()));
all
}
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
fn reject_unknown_keys(dict: &Bound<'_, PyDict>, allowed: &[String], label: &str) -> PyResult<()> {
for (key_obj, _) in dict.iter() {
let key: String = key_obj.extract()?;
@@ -694,7 +694,7 @@ fn parse_mounts(mounts: Option<&Bound<'_, PyList>>) -> PyResult builder.mount_real_readonly(&mount.host_path),
@@ -1037,7 +1037,7 @@ fn apply_fs_config(
(true, Some(vfs_mount)) => builder.mount_real_readwrite_at(&mount.host_path, vfs_mount),
};
}
- #[cfg(target_arch = "wasm32")]
+ #[cfg(target_family = "wasm")]
let _ = real_mounts;
Ok(builder)
@@ -2198,7 +2198,7 @@ impl PyFileSystem {
// bridge (`from_capsule`/`to_capsule`) needs the `interop` ABI — both pull
// threads/host-FS deps absent on wasm, so these constructors are native-only.
// See knowledge/runtimes/emscripten-wheels.md.
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
#[staticmethod]
#[pyo3(signature = (host_path, writable=false))]
#[allow(deprecated)] // Python constructors cannot await RealFs::open.
@@ -2215,7 +2215,7 @@ impl PyFileSystem {
Ok(Self::from_static(fs, rt))
}
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
#[staticmethod]
fn from_capsule(capsule: Bound<'_, PyAny>) -> PyResult {
let capsule = capsule
@@ -2231,7 +2231,7 @@ impl PyFileSystem {
Ok(Self::from_static(fs, rt))
}
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
fn to_capsule<'py>(&self, py: Python<'py>) -> PyResult> {
let fs = self.export_fs(py)?;
let exported = export_filesystem(fs).map_err(|e| PyRuntimeError::new_err(e.to_string()))?;
@@ -3259,7 +3259,7 @@ impl PyPrivateAsyncLoop {
closing: Arc::new(AtomicBool::new(false)),
bg_thread_runner: StdMutex::new(None),
});
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
async_bridge::register_private_loop(&private_loop);
private_loop
}
@@ -3617,7 +3617,7 @@ impl PyCallbackSession {
// Native: the caller-loop locals are a non-Copy TaskLocals, so clone out of the
// lock. Wasm: CallerLoopLocals is uninhabited and the field is always None, so
// return None without touching the (Copy) Option.
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
fn current_caller_loop_locals(&self) -> Option {
self.state
.lock()
@@ -3626,7 +3626,7 @@ impl PyCallbackSession {
.clone()
}
- #[cfg(target_arch = "wasm32")]
+ #[cfg(target_family = "wasm")]
fn current_caller_loop_locals(&self) -> Option {
None
}
@@ -3644,12 +3644,12 @@ impl PyCallbackSession {
};
// On wasm `locals` is `Infallible`, so this point is unreachable; the
// caller-loop scheduling helpers it would call are native-only.
- #[cfg(target_arch = "wasm32")]
+ #[cfg(target_family = "wasm")]
{
let _ = py;
match locals {}
}
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
{
let tasks = self
.active_caller_tasks
@@ -3707,7 +3707,7 @@ fn capture_callback_state(
// The caller-loop path captures the running asyncio loop's TaskLocals so async
// callbacks can be scheduled on it. That only happens under async `execute()`,
// which is native-only — on wasm we always fall through to the private-loop path.
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
if needs_async_callbacks && use_caller_loop {
let locals = async_bridge::get_current_locals(py)?;
return Ok(PyCallbackSessionState {
@@ -3715,7 +3715,7 @@ fn capture_callback_state(
caller_loop_locals: Some(locals),
});
}
- #[cfg(target_arch = "wasm32")]
+ #[cfg(target_family = "wasm")]
let _ = (needs_async_callbacks, use_caller_loop);
Ok(PyCallbackSessionState {
@@ -3742,7 +3742,7 @@ fn asyncio_cancelled_error(py: Python<'_>) -> PyResult {
}
// Caller-loop task scheduling/cancellation — native-only (see CallerLoopLocals).
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
fn call_soon_threadsafe_with_context(
py: Python<'_>,
locals: &TaskLocals,
@@ -3756,7 +3756,7 @@ fn call_soon_threadsafe_with_context(
Ok(())
}
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
fn cancel_python_task(py: Python<'_>, locals: &TaskLocals, task: &Py) -> PyResult<()> {
let cancel = task.bind(py).getattr("cancel")?;
call_soon_threadsafe_with_context(py, locals, &cancel)
@@ -3894,7 +3894,7 @@ fn wrap_future_with_cancel<'py>(
// Schedules an async callback on the caller's asyncio loop and awaits its result
// with cancellation propagation — caller-loop-only, hence native-only. On wasm,
// async callbacks run via the private-loop fallback in `call_python_callback_async`.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
struct PyCancellableLoopFuture {
result_rx: Option>>>,
locals: TaskLocals,
@@ -3903,7 +3903,7 @@ struct PyCancellableLoopFuture {
completed: bool,
}
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
impl PyCancellableLoopFuture {
fn new(
py: Python<'_>,
@@ -3961,7 +3961,7 @@ impl PyCancellableLoopFuture {
}
}
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
impl Drop for PyCancellableLoopFuture {
fn drop(&mut self) {
if self.completed {
@@ -4065,7 +4065,7 @@ async fn call_python_callback_async(
// Caller-loop scheduling is native-only; on wasm we always use the private
// event-loop fallback (current-thread, no cross-loop bridging).
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
let result = if session.current_caller_loop_locals().is_some() {
let future = Python::attach(|py| PyCancellableLoopFuture::new(py, session, awaitable))
.map_err(|e| format!("{callback_name}: {e}"))?;
@@ -4078,7 +4078,7 @@ async fn call_python_callback_async(
.await
.map_err(|e| format!("{callback_name}: {e}"))?
};
- #[cfg(target_arch = "wasm32")]
+ #[cfg(target_family = "wasm")]
let result =
Python::attach(|py| session.run_awaitable_on_private_loop(py, &awaitable, Arc::default()))
.map_err(|e| format!("{callback_name}: {e}"))?;
@@ -4086,7 +4086,7 @@ async fn call_python_callback_async(
Ok(result)
}
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
async fn run_private_loop_awaitable_yielding(
session: Arc,
awaitable: Py,
@@ -4618,7 +4618,7 @@ async fn exec_bash_with_optional_output(
// interpreter supplies a revocable request extension; no handler caches a
// caller loop or ContextVars across execute() calls. Sync calls reuse the
// instance's dedicated private-loop worker, including in notebooks.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
fn make_external_handler(py_handler: Py) -> PythonExternalFnHandler {
Arc::new(move |fn_name, args, kwargs| {
let py_handler = Python::attach(|py| py_handler.clone_ref(py));
@@ -4668,11 +4668,11 @@ fn make_external_handler(py_handler: Py) -> PythonExternalFnHandler {
}
fn make_external_handler_native(py: Python<'_>, handler: &Py) -> PythonExternalFnHandler {
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
{
make_external_handler(handler.clone_ref(py))
}
- #[cfg(target_arch = "wasm32")]
+ #[cfg(target_family = "wasm")]
{
let _ = (py, handler);
unreachable!("external_handler rejected at construction on wasm")
@@ -4683,7 +4683,7 @@ fn make_external_handler_native(py: Python<'_>, handler: &Py) -> PythonEx
// with the same nesting cap as Monty; reject functions, non-finite numbers,
// arbitrary Python objects and out-of-range integers instead of stringifying
// them or silently losing precision.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
fn zapcode_to_py(
py: Python<'_>,
value: &bashkit::ZapcodeValue,
@@ -4723,7 +4723,7 @@ fn zapcode_to_py(
})
}
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
fn py_to_zapcode(obj: &Bound<'_, PyAny>, depth: usize) -> PyResult {
use bashkit::ZapcodeValue as V;
if depth > MAX_NESTING_DEPTH {
@@ -4781,7 +4781,7 @@ fn make_typescript_external_handler_native(
py: Python<'_>,
handler: &Py,
) -> bashkit::TypeScriptExternalFnHandler {
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
{
let handler = handler.clone_ref(py);
Arc::new(move |name, args| {
@@ -4818,7 +4818,7 @@ fn make_typescript_external_handler_native(
})
})
}
- #[cfg(target_arch = "wasm32")]
+ #[cfg(target_family = "wasm")]
{
let _ = (py, handler);
unreachable!("typescript_external_handler rejected at construction on wasm")
@@ -4844,7 +4844,7 @@ fn prepare_runtime_external_handler(
runtime: &str,
prefix: &str,
) -> PyResult>> {
- #[cfg(target_arch = "wasm32")]
+ #[cfg(target_family = "wasm")]
if handler.is_some() {
return Err(PyRuntimeError::new_err(format!(
"{prefix}_handler is not available in the WebAssembly (Pyodide) build",
@@ -4949,7 +4949,7 @@ fn apply_python_config(
// On wasm, external_handler is rejected at construction, so handler is always
// None and the external-handler arm is native-only.
match (python, handler) {
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
(true, Some(h)) => {
builder =
builder.python_with_external_handler(limits, fn_names, make_external_handler(h));
@@ -4957,7 +4957,7 @@ fn apply_python_config(
// in-process Python execution; propagate that to the builtin's env gate.
builder = builder.env("BASHKIT_ALLOW_INPROCESS_PYTHON", "1");
}
- #[cfg(target_arch = "wasm32")]
+ #[cfg(target_family = "wasm")]
(true, Some(_)) => unreachable!("external_handler rejected at construction on wasm"),
(true, None) => {
let _ = &fn_names;
@@ -4975,19 +4975,19 @@ fn apply_python_config(
/// explicit opt-in for in-process SQLite execution, so we register the
/// builtin and inject the runtime gate env var. The deny-list defaults
/// (resource/FS-shaped PRAGMAs) come from `SqliteLimits::default()`.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
type ProfileSqliteLimits = bashkit::SqliteLimits;
-#[cfg(target_arch = "wasm32")]
+#[cfg(target_family = "wasm")]
type ProfileSqliteLimits = ();
fn profile_sqlite_limits(profile: &bashkit::ExecutionProfile) -> ProfileSqliteLimits {
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
{
profile.sqlite_limits().clone()
}
- #[cfg(target_arch = "wasm32")]
+ #[cfg(target_family = "wasm")]
{
let _ = profile;
}
@@ -5003,7 +5003,7 @@ fn apply_sqlite_config(
// The embedded SQLite (Turso) backend needs the multi-threaded tokio runtime to
// bridge its sync IO trait back to the async VFS, so the core `sqlite` feature is
// off on wasm. Reject `sqlite=True` loudly there. See knowledge/runtimes/emscripten-wheels.md.
- #[cfg(target_arch = "wasm32")]
+ #[cfg(target_family = "wasm")]
{
let _ = (profile_limits, timeout_seconds, max_memory);
if sqlite {
@@ -5014,7 +5014,7 @@ fn apply_sqlite_config(
Ok(builder)
}
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
{
let mut builder = builder;
if sqlite {
@@ -5191,7 +5191,7 @@ impl PyBash {
)?;
// network (http_client) and allowed_mount_paths (realfs) are native-only;
// both kwargs are rejected at construction on wasm. See knowledge/runtimes/emscripten-wheels.md.
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
{
if let Some(ref net) = self.network {
builder = net.apply(builder);
@@ -5329,7 +5329,7 @@ impl PyBash {
)?;
// network (http_client) and allowed_mount_paths (realfs) are native-only;
// both kwargs are rejected at construction on wasm. See knowledge/runtimes/emscripten-wheels.md.
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
{
if let Some(ref net) = network {
builder = net.apply(builder);
@@ -5415,7 +5415,7 @@ impl PyBash {
/// Native-only: the async API bridges to a Python asyncio loop via
/// pyo3-async-runtimes, which the WebAssembly (Pyodide) build omits. On wasm,
/// use `execute_sync()`. See knowledge/runtimes/emscripten-wheels.md.
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
// Python keyword arguments map 1:1 onto parameters here.
#[allow(clippy::too_many_arguments)]
#[pyo3(signature = (commands, on_output=None, *, capture=None, stdout=None, stderr=None, timeout_seconds=None, output_file=None, max_output_file_bytes=None))]
@@ -5581,7 +5581,7 @@ impl PyBash {
/// Execute commands asynchronously. Raises `BashError` on non-zero exit.
///
/// Native-only (see `execute`). Use `execute_sync_or_throw()` on wasm.
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
#[pyo3(signature = (commands, on_output=None, *, timeout_seconds=None))]
fn execute_or_throw<'py>(
&self,
@@ -5637,7 +5637,7 @@ impl PyBash {
/// Override precedence matches `custom_builtins` at construction time:
/// shell function > POSIX special builtin > custom builtin > baked-in
/// builtin > `PATH`.
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
fn add_command(&self, py: Python<'_>, name: String, callback: Py) -> PyResult<()> {
streaming::register(
py,
@@ -6407,7 +6407,7 @@ impl BashTool {
// network (http_client) and allowed_mount_paths (realfs) are native-only;
// both kwargs are rejected at construction on wasm. See knowledge/runtimes/emscripten-wheels.md.
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
{
if let Some(ref net) = self.network {
builder = net.apply(builder);
@@ -6623,7 +6623,7 @@ impl BashTool {
let network = parse_network_config(network)?;
// network (http_client) and allowed_mount_paths (realfs) are native-only;
// both kwargs are rejected at construction on wasm. See knowledge/runtimes/emscripten-wheels.md.
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
{
if let Some(ref net) = network {
builder = net.apply(builder);
@@ -6704,7 +6704,7 @@ impl BashTool {
}
/// Native-only (see `Bash.execute`). Use `execute_sync()` on wasm.
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
// Python keyword arguments map 1:1 onto parameters here.
#[allow(clippy::too_many_arguments)]
#[pyo3(signature = (commands, on_output=None, *, capture=None, stdout=None, stderr=None, timeout_seconds=None, output_file=None, max_output_file_bytes=None))]
@@ -6861,7 +6861,7 @@ impl BashTool {
/// Execute commands asynchronously. Raises `BashError` on non-zero exit.
///
/// Native-only (see `Bash.execute`). Use `execute_sync_or_throw()` on wasm.
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
#[pyo3(signature = (commands, on_output=None, *, timeout_seconds=None))]
fn execute_or_throw<'py>(
&self,
@@ -6908,7 +6908,7 @@ impl BashTool {
/// Register a Python callback as a custom bash builtin.
/// See [`PyBash::add_builtin`] for semantics.
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
fn add_command(&self, py: Python<'_>, name: String, callback: Py) -> PyResult<()> {
streaming::register(
py,
@@ -7684,7 +7684,7 @@ impl ScriptedTool {
/// Execute a bash script asynchronously.
///
/// Native-only (see `Bash.execute`). Use `execute_sync()` on wasm.
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
fn execute<'py>(&self, py: Python<'py>, commands: String) -> PyResult> {
let session = PyCallbackSession::capture(
py,
@@ -7943,7 +7943,7 @@ fn _bashkit(m: &Bound<'_, PyModule>) -> PyResult<()> {
m.add_class::()?;
m.add_class::()?;
m.add_class::()?;
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
streaming::add_classes(m)?;
m.add_class::()?;
m.add_class::()?;
diff --git a/crates/bashkit/Cargo.toml b/crates/bashkit/Cargo.toml
index 8129e65fd..0aa0288d5 100644
--- a/crates/bashkit/Cargo.toml
+++ b/crates/bashkit/Cargo.toml
@@ -438,7 +438,7 @@ name = "markkit_fetchkit"
required-features = ["markkit", "fetchkit"]
# Additional tokio features needed only on native (not WASM)
-[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
+[target.'cfg(not(target_family = "wasm"))'.dependencies]
tokio = { version = "1", features = ["rt-multi-thread", "fs"] }
# Grows the native stack on demand while polling nested interpreter
# futures, so deep (but limit-bounded) nesting cannot abort the process
@@ -460,10 +460,10 @@ fetchkit = { version = "0.7.2", default-features = false, features = ["docs-pdf"
# pulled in by `wasm_js`. A non-JS wasm embedder gets time_compat::host_clock
# instead and links none of them: their imports would be unresolvable in a
# runtime with no JS engine.
-[target.'cfg(target_arch = "wasm32")'.dependencies]
+[target.'cfg(target_family = "wasm")'.dependencies]
web-time = { workspace = true, optional = true }
-[target.'cfg(all(target_arch = "wasm32", target_os = "unknown"))'.dependencies]
+[target.'cfg(all(target_family = "wasm", target_os = "unknown"))'.dependencies]
gloo-timers = { version = "0.4", features = ["futures"], optional = true }
send_wrapper = { version = "0.6", features = ["futures"], optional = true }
# Task spawner for the host-call execution driver (see host_call.rs). JS-backed
@@ -482,6 +482,6 @@ unexpected_cfgs = { level = "warn", check-cfg = ['cfg(feature, values("i18n-deci
# The process feature is native test infrastructure only; keep WASM builds
# on the workspace Tokio feature set without changing versions or the lock.
-[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
+[target.'cfg(not(target_family = "wasm"))'.dev-dependencies]
tokio = { workspace = true, features = ["process"] }
diff --git a/crates/bashkit/src/builtins/mod.rs b/crates/bashkit/src/builtins/mod.rs
index 4c92967b0..d6a2f4197 100644
--- a/crates/bashkit/src/builtins/mod.rs
+++ b/crates/bashkit/src/builtins/mod.rs
@@ -59,7 +59,7 @@ mod export;
mod expr;
mod factor;
mod fc;
-#[cfg(all(feature = "fetchkit", not(target_arch = "wasm32")))]
+#[cfg(all(feature = "fetchkit", not(target_family = "wasm")))]
mod fetchkit;
mod fileops;
mod find;
@@ -88,7 +88,7 @@ mod ls;
mod make;
mod man;
mod mapfile;
-#[cfg(all(feature = "markkit", not(target_arch = "wasm32")))]
+#[cfg(all(feature = "markkit", not(target_family = "wasm")))]
mod markkit;
mod mkfifo;
#[cfg(feature = "terminal")]
@@ -202,7 +202,7 @@ pub use export::Export;
pub use expr::Expr;
pub use factor::Factor;
pub use fc::Fc;
-#[cfg(all(feature = "fetchkit", not(target_arch = "wasm32")))]
+#[cfg(all(feature = "fetchkit", not(target_family = "wasm")))]
pub use fetchkit::Fetchkit;
pub use fileops::{Chmod, Chown, Cp, Ln, Mkdir, Mktemp, Mv, Rm, Touch};
pub use find::Find;
@@ -231,7 +231,7 @@ pub(crate) use ls::{fnmatch, glob_match};
pub use make::Make;
pub use man::Man;
pub use mapfile::Mapfile;
-#[cfg(all(feature = "markkit", not(target_arch = "wasm32")))]
+#[cfg(all(feature = "markkit", not(target_family = "wasm")))]
pub use markkit::Markkit;
pub use mkfifo::Mkfifo;
pub use navigation::{Cd, Pwd};
diff --git a/crates/bashkit/src/builtins/sleep.rs b/crates/bashkit/src/builtins/sleep.rs
index 36169716b..497e2fed8 100644
--- a/crates/bashkit/src/builtins/sleep.rs
+++ b/crates/bashkit/src/builtins/sleep.rs
@@ -4,7 +4,7 @@ use async_trait::async_trait;
use std::time::Duration;
#[cfg(all(
- target_arch = "wasm32",
+ target_family = "wasm",
target_os = "unknown",
not(feature = "wasm_js")
))]
@@ -68,7 +68,7 @@ impl Builtin for Sleep {
if seconds > 0.0 {
let duration = Duration::from_secs_f64(seconds);
#[cfg(all(
- target_arch = "wasm32",
+ target_family = "wasm",
target_os = "unknown",
not(feature = "wasm_js")
))]
@@ -109,7 +109,7 @@ fn parse_interval(arg: &str) -> Option {
#[cfg(any(
test,
all(
- target_arch = "wasm32",
+ target_family = "wasm",
target_os = "unknown",
not(feature = "wasm_js")
)
diff --git a/crates/bashkit/src/builtins/typescript.rs b/crates/bashkit/src/builtins/typescript.rs
index 68409e5e2..8c59b817f 100644
--- a/crates/bashkit/src/builtins/typescript.rs
+++ b/crates/bashkit/src/builtins/typescript.rs
@@ -22,7 +22,7 @@ use std::future::Future;
use std::path::{Path, PathBuf};
use std::pin::Pin;
use std::sync::Arc;
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
use std::sync::OnceLock;
use std::time::Duration;
use zapcode_core::{ResourceLimits, RunResult, Value, VmState, ZapcodeRun};
@@ -51,13 +51,13 @@ const TS_CALL_WORK_UNITS: u64 = 4096;
/// in debug builds (32 MiB was the smallest that passed
/// `deep_nesting_at_the_limit_does_not_overflow` in a debug build; 128 MiB
/// gives 4x). The memory is reserved, not committed, until used.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
const TS_VM_STACK_BYTES: usize = 128 * 1024 * 1024;
/// Upper bound used when the host does not configure TypeScript VM admission.
/// Four active 128 MiB stack reservations are a deliberate process-wide cap,
/// while smaller hosts default to their available CPU parallelism.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
const DEFAULT_MAX_ACTIVE_TS_VMS: usize = 4;
/// Error returned by [`configure_typescript_vm_concurrency`].
@@ -110,7 +110,7 @@ pub fn configure_typescript_vm_concurrency(
maximum: tokio::sync::Semaphore::MAX_PERMITS,
});
}
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
{
TS_VM_ADMISSION
.set(VmAdmission::new(max_active))
@@ -121,14 +121,14 @@ pub fn configure_typescript_vm_concurrency(
Ok(())
}
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
#[derive(Clone)]
struct VmAdmission {
semaphore: Arc,
limit: usize,
}
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
impl VmAdmission {
fn new(limit: usize) -> Self {
Self {
@@ -155,10 +155,10 @@ impl VmAdmission {
}
}
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
static TS_VM_ADMISSION: OnceLock = OnceLock::new();
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
fn vm_admission() -> &'static VmAdmission {
TS_VM_ADMISSION.get_or_init(|| {
let parallelism = std::thread::available_parallelism().map_or(1, usize::from);
@@ -1024,7 +1024,7 @@ async fn run_typescript(
// Per-run heap meter (vm_meter.rs); ZapCode itself never enforces
// max_memory, so without the metered allocator `ts` fails closed.
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
if !crate::vm_meter::allocator_installed() {
return Ok(ExecResult::err(METER_MISSING_ERROR.to_string(), 1));
}
@@ -1090,11 +1090,11 @@ async fn run_typescript(
const VM_THREAD_ERROR: &str = "ts: cannot start execution thread\n";
/// Message when `MeteredAllocator` is not the global allocator.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
const METER_MISSING_ERROR: &str =
"ts: TypeScript memory limits need bashkit::MeteredAllocator as the global allocator\n";
-#[cfg_attr(target_arch = "wasm32", allow(dead_code))]
+#[cfg_attr(target_family = "wasm", allow(dead_code))]
enum VmStepResult {
Complete(T),
TimedOut,
@@ -1108,7 +1108,7 @@ enum VmStepResult {
/// blocking pool. The permit lives inside that blocking task, so a caller
/// whose deadline expires cannot release the slot while its abandoned VM
/// thread is still winding down.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
async fn run_vm_step(
meter: Arc,
deadline: Option,
@@ -1117,7 +1117,7 @@ async fn run_vm_step(
run_vm_step_with_admission(vm_admission().clone(), meter, deadline, step).await
}
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
async fn run_vm_step_with_admission(
admission: VmAdmission,
meter: Arc,
@@ -1161,7 +1161,7 @@ async fn run_vm_step_with_admission(
/// Run one synchronous ZapCode step (parse/compile/run, or a resume) inside
/// `meter`'s window on a dedicated [`TS_VM_STACK_BYTES`] stack. `None` means
/// no thread could be started.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
fn on_vm_stack(
meter: &crate::vm_meter::VmMeter,
step: impl FnOnce() -> T + Send + 'static,
@@ -1184,7 +1184,7 @@ fn on_vm_stack(
/// wasm32 has no threads: run on the current stack. The nesting cap still
/// applies; see the zapcode-runtime knowledge page for the residual risk.
-#[cfg(target_arch = "wasm32")]
+#[cfg(target_family = "wasm")]
async fn run_vm_step(
meter: Arc,
_deadline: Option,
@@ -1919,7 +1919,7 @@ mod tests {
));
}
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn vm_admission_caps_active_threads_and_times_out_queued_steps() {
use std::sync::atomic::{AtomicUsize, Ordering};
diff --git a/crates/bashkit/src/host_call.rs b/crates/bashkit/src/host_call.rs
index e2fa2833c..5a2a9a9a2 100644
--- a/crates/bashkit/src/host_call.rs
+++ b/crates/bashkit/src/host_call.rs
@@ -365,7 +365,7 @@ impl Drop for ExecutionHandle {
/// Hand the execution to an independent task so its deadline keeps running
/// while the host is parked. Returns the future back when this target has no
/// task spawner, leaving `next_event` as its only driver.
-#[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
+#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
fn spawn_execution(future: ExecutionFuture) -> Option {
// Not every embedder polls `next_event` from inside a Tokio runtime, and
// `start_execution` must not start panicking on the ones that don't.
@@ -378,7 +378,7 @@ fn spawn_execution(future: ExecutionFuture) -> Option {
}
}
-#[cfg(all(target_arch = "wasm32", target_os = "unknown", feature = "wasm_js"))]
+#[cfg(all(target_family = "wasm", target_os = "unknown", feature = "wasm_js"))]
fn spawn_execution(future: ExecutionFuture) -> Option {
wasm_bindgen_futures::spawn_local(future);
None
@@ -389,7 +389,7 @@ fn spawn_execution(future: ExecutionFuture) -> Option {
// still enforced, just on the host's next poll. See
// knowledge/runtimes/non-js-wasm.md.
#[cfg(all(
- target_arch = "wasm32",
+ target_family = "wasm",
target_os = "unknown",
not(feature = "wasm_js")
))]
diff --git a/crates/bashkit/src/interpreter/grow_stack.rs b/crates/bashkit/src/interpreter/grow_stack.rs
index be52eb384..273e91098 100644
--- a/crates/bashkit/src/interpreter/grow_stack.rs
+++ b/crates/bashkit/src/interpreter/grow_stack.rs
@@ -21,11 +21,11 @@ use std::task::{Context, Poll};
/// Remaining stack below which a poll moves to a new segment. Must exceed
/// the stack one interpreter level can use between two command polls in a
/// debug build (measured at ~150 KiB for an `eval` level).
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
const RED_ZONE: usize = 512 * 1024;
/// Size of each additional stack segment.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
const SEGMENT: usize = 4 * 1024 * 1024;
/// Future wrapper whose `poll` runs with at least [`RED_ZONE`] bytes of stack.
@@ -42,11 +42,11 @@ impl Future for GrowStack {
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll {
let inner = self.0.as_mut();
- #[cfg(not(target_arch = "wasm32"))]
+ #[cfg(not(target_family = "wasm"))]
{
stacker::maybe_grow(RED_ZONE, SEGMENT, || inner.poll(cx))
}
- #[cfg(target_arch = "wasm32")]
+ #[cfg(target_family = "wasm")]
{
inner.poll(cx)
}
diff --git a/crates/bashkit/src/interpreter/mod.rs b/crates/bashkit/src/interpreter/mod.rs
index f0a61a254..02465087f 100644
--- a/crates/bashkit/src/interpreter/mod.rs
+++ b/crates/bashkit/src/interpreter/mod.rs
@@ -2345,9 +2345,9 @@ impl Interpreter {
builtins.insert("jq".to_string(), Arc::new(builtins::Jq));
#[cfg(feature = "jq")]
builtins.insert("yq".to_string(), Arc::new(builtins::Yq));
- #[cfg(all(feature = "markkit", not(target_arch = "wasm32")))]
+ #[cfg(all(feature = "markkit", not(target_family = "wasm")))]
builtins.insert("markkit".to_string(), Arc::new(builtins::Markkit));
- #[cfg(all(feature = "fetchkit", not(target_arch = "wasm32")))]
+ #[cfg(all(feature = "fetchkit", not(target_family = "wasm")))]
builtins.insert("fetchkit".to_string(), Arc::new(builtins::Fetchkit));
// Custom-construction builtins that need parameters
diff --git a/crates/bashkit/src/lib.rs b/crates/bashkit/src/lib.rs
index 47d7bd31c..0844cb1bc 100644
--- a/crates/bashkit/src/lib.rs
+++ b/crates/bashkit/src/lib.rs
@@ -4323,7 +4323,7 @@ pub mod sqlite_guide {}
/// **Related:** `BashBuilder::network`, `NetworkAllowlist`, [`threat_model`]
#[cfg(all(
any(feature = "markkit", feature = "fetchkit"),
- not(target_arch = "wasm32")
+ not(target_family = "wasm")
))]
#[doc = include_str!("../docs/markkit-fetchkit.md")]
pub mod markkit_fetchkit_guide {}
diff --git a/crates/bashkit/src/time_compat/mod.rs b/crates/bashkit/src/time_compat/mod.rs
index 79b20eefe..eb6f9cfab 100644
--- a/crates/bashkit/src/time_compat/mod.rs
+++ b/crates/bashkit/src/time_compat/mod.rs
@@ -19,33 +19,33 @@ use std::future::Future;
use std::time::Duration;
#[cfg(all(
- target_arch = "wasm32",
+ target_family = "wasm",
target_os = "unknown",
not(feature = "wasm_js")
))]
pub mod host_clock;
#[cfg(all(
- target_arch = "wasm32",
+ target_family = "wasm",
target_os = "unknown",
not(feature = "wasm_js")
))]
pub use host_clock::{Instant, SystemTime, UNIX_EPOCH};
-#[cfg(all(target_arch = "wasm32", target_os = "unknown", feature = "wasm_js"))]
+#[cfg(all(target_family = "wasm", target_os = "unknown", feature = "wasm_js"))]
pub use web_time::{Instant, SystemTime, UNIX_EPOCH};
// WASI targets (wasip1, wasip2, wasip1-threads) have real clocks in std, and
// no tokio timer driver worth routing `Instant` through.
-#[cfg(all(target_arch = "wasm32", not(target_os = "unknown")))]
+#[cfg(all(target_family = "wasm", not(target_os = "unknown")))]
pub use std::time::{Instant, SystemTime, UNIX_EPOCH};
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
pub use std::time::{SystemTime, UNIX_EPOCH};
// Tokio's instant follows the runtime's paused/advanced monotonic clock. This
// makes shell deadlines and `time` deterministic under virtual-time runtimes.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
pub use tokio::time::Instant;
/// Portable timer future. JS-host wasm uses `setTimeout`; native targets keep
@@ -53,7 +53,7 @@ pub use tokio::time::Instant;
/// target is deliberately single-threaded (the same invariant as JS builtins).
pub async fn sleep(duration: Duration) {
#[cfg(all(
- target_arch = "wasm32",
+ target_family = "wasm",
target_os = "unknown",
not(feature = "wasm_js")
))]
@@ -67,13 +67,13 @@ pub async fn sleep(duration: Duration) {
}
}
- #[cfg(all(target_arch = "wasm32", target_os = "unknown", feature = "wasm_js"))]
+ #[cfg(all(target_family = "wasm", target_os = "unknown", feature = "wasm_js"))]
send_wrapper::SendWrapper::new(gloo_timers::future::TimeoutFuture::new(duration_millis(
duration,
)))
.await;
- #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
+ #[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
tokio::time::sleep(duration).await;
}
@@ -86,7 +86,7 @@ pub async fn timeout(
future: F,
) -> Result {
#[cfg(all(
- target_arch = "wasm32",
+ target_family = "wasm",
target_os = "unknown",
not(feature = "wasm_js")
))]
@@ -113,7 +113,7 @@ pub async fn timeout(
.await;
}
- #[cfg(all(target_arch = "wasm32", target_os = "unknown", feature = "wasm_js"))]
+ #[cfg(all(target_family = "wasm", target_os = "unknown", feature = "wasm_js"))]
{
use futures_util::future::{Either, select};
let timer = send_wrapper::SendWrapper::new(gloo_timers::future::TimeoutFuture::new(
@@ -126,13 +126,13 @@ pub async fn timeout(
}
}
- #[cfg(not(all(target_arch = "wasm32", target_os = "unknown")))]
+ #[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
tokio::time::timeout(duration, future)
.await
.map_err(|_| TimeoutElapsed)
}
-#[cfg(all(target_arch = "wasm32", target_os = "unknown", feature = "wasm_js"))]
+#[cfg(all(target_family = "wasm", target_os = "unknown", feature = "wasm_js"))]
fn duration_millis(duration: Duration) -> u32 {
(duration.as_secs_f64() * 1000.0)
.ceil()
diff --git a/crates/bashkit/tests/integration/input_redirect_budget_tests.rs b/crates/bashkit/tests/integration/input_redirect_budget_tests.rs
index 200843527..eb3dc5830 100644
--- a/crates/bashkit/tests/integration/input_redirect_budget_tests.rs
+++ b/crates/bashkit/tests/integration/input_redirect_budget_tests.rs
@@ -538,12 +538,12 @@ async fn stdin_clone_trip_recovers() {
// Reuses reviewed primitives (`drain_capped`, `reap_with_grace`) with a
// job-specific launcher. Shared defaults for other products are untouched.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
use crate::threat_model_tests::resource_exhaustion::bashkit_cli_path;
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
use std::process::Stdio;
use std::time::Duration;
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
use tokio::process::Command;
/// File-size backstop for the bash `ulimit -f` knob, in the shell's blocks.
@@ -556,13 +556,13 @@ const IR_FILE_BLOCKS: u64 = 131_072;
/// Active RSS cutoff in KiB (`ps -o rss=` reports KiB on Linux and macOS):
/// Sampled observations trigger termination on exceedance. This is not a
/// hard OS memory cap or proof that no between-sample peak occurred.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
const IR_RSS_CAP_KIB: u64 = 1_048_576; // 1GiB
/// Explicit allowance for one short instrumented run's coverage artifact.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
const IR_ARTIFACT_BOUND: u64 = 64 * 1024 * 1024; // 64MiB
/// Per-stream kept bytes for concurrent diagnostic drains.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
const PIPE_CAP: usize = 256 * 1024;
/// Opt-in launcher for the input-redirect job: shared CPU/stack caps plus a
@@ -733,7 +733,7 @@ fn file_size_unit_factor(blocks: u64, bytes: u64) -> Result {
/// Outcome of one opt-in bounded input-shape run: the reviewed verdict plus
/// job-specific receipts. Setup faults panic with context (fail-closed);
/// runtime observations are flags for the caller to assert on.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
struct InputShapeRun {
exit_code: Option,
wall_limit_seconds: u64,
@@ -842,7 +842,7 @@ struct SampleError {
/// One lifecycle owns wait, captures and the optional RSS sampler. Errors
/// request kill once, then retain all futures through finite completion.
/// Drop remains a best-effort backstop, never a completion receipt.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
struct ChildCompletion {
status: Option,
out: (Vec, usize, bool),
@@ -858,7 +858,7 @@ struct ChildCompletion {
exited_fast: bool,
}
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
async fn complete_owned_child(
child: &mut OwnedChild,
cap: usize,
@@ -1072,7 +1072,7 @@ async fn complete_owned_child(
/// RSS sampling uses the same finite owned lifecycle as the main child.
/// Sampling failure and incomplete reap/capture are distinct verdicts.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
async fn sample_child_rss(pid: u32) -> Result {
let ps = Command::new("ps")
.arg("-o")
@@ -1231,7 +1231,7 @@ async fn ir_helper_terminal_sampler_completion() {
);
}
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
async fn run_input_shape_bounded(script: &str, wall_secs: u64, tag: &str) -> InputShapeRun {
let sink = TempWorkdir::create(&format!("{tag}-sink")).expect("artifact sink setup");
let work = TempWorkdir::create(&format!("{tag}-work")).expect("producer workdir setup");
@@ -1331,7 +1331,7 @@ async fn run_input_shape_bounded(script: &str, wall_secs: u64, tag: &str) -> Inp
/// (fail-closed on any unit surprise); RSS policing receipts (a real pid,
/// no observed exceedance, sampled maximum under the cutoff, samples taken unless the child
/// exited before the first poll).
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
fn assert_effective_bounds(r: &InputShapeRun) {
use std::io::Write as _;
@@ -1430,7 +1430,7 @@ fn assert_effective_bounds(r: &InputShapeRun) {
/// (no exit code) and from pre-fix success (exit 0).
/// NOT EXECUTED in this environment (hostile-fixture ban); kept as the
/// blocked-verification target with full harness assertions intact.
-#[cfg(all(unix, not(target_arch = "wasm32")))]
+#[cfg(all(unix, not(target_family = "wasm")))]
#[tokio::test]
async fn original_shape_bounded_child_default_limits() {
let r =
@@ -1549,7 +1549,7 @@ fn ir_helper_workdir_drop_cleans() {
/// Finite normal child completion through the full opt-in wrapper with an
/// ordinary harmless script: proves the harness itself works end to end.
/// NOT vulnerability proof: `true` exercises no budget path.
-#[cfg(all(unix, not(target_arch = "wasm32")))]
+#[cfg(all(unix, not(target_family = "wasm")))]
#[tokio::test]
async fn ir_helper_normal_child_completes() {
let r = run_input_shape_bounded("true", 30, "ir-true").await;
@@ -1620,12 +1620,12 @@ fn ir_helper_ps_parse_cases() {
/// explicitly with a finite deadline and then drop the guard; Drop sends
/// SIGKILL best-effort via sync `start_kill` (documented backstop, never the
/// primary path) but never waits, so Drop cannot block.
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
struct OwnedChild {
inner: Option,
}
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
impl OwnedChild {
fn new(child: tokio::process::Child) -> Self {
Self { inner: Some(child) }
@@ -1672,7 +1672,7 @@ impl OwnedChild {
}
}
-#[cfg(not(target_arch = "wasm32"))]
+#[cfg(not(target_family = "wasm"))]
impl Drop for OwnedChild {
fn drop(&mut self) {
if let Some(child) = self.inner.as_mut() {
diff --git a/knowledge/runtimes/emscripten-wheels.md b/knowledge/runtimes/emscripten-wheels.md
index 0a8eb9fbd..0daa06327 100644
--- a/knowledge/runtimes/emscripten-wheels.md
+++ b/knowledge/runtimes/emscripten-wheels.md
@@ -37,7 +37,7 @@ on wasm:
- async `execute()` bridge → `pyo3-async-runtimes` (tokio-runtime): hard-pulls `rt-multi-thread` + tokio `net` (mio).
The core `bashkit` crate was already wasm-aware (gates
-`rt-multi-thread`/`fs` behind `cfg(not(target_arch = "wasm32"))`); the work
+`rt-multi-thread`/`fs` behind `cfg(not(target_family = "wasm"))`); the work
is confined to `crates/bashkit-python`.
## Feature surface: native vs wasm
@@ -63,13 +63,13 @@ All gating lives in `crates/bashkit-python`:
Per-target dependency split:
```toml
-[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
+[target.'cfg(not(target_family = "wasm"))'.dependencies]
bashkit = { path = "../bashkit", features = ["python","typescript","realfs","jq","interop","http_client","sqlite"] }
bashkit-scripted-tool = { path = "../bashkit-scripted-tool", features = ["python","jq"] }
tokio = { workspace = true, features = ["rt-multi-thread"] }
pyo3-async-runtimes = { workspace = true }
-[target.'cfg(target_arch = "wasm32")'.dependencies]
+[target.'cfg(target_family = "wasm")'.dependencies]
bashkit = { path = "../bashkit", features = ["python","typescript","jq"] }
bashkit-scripted-tool = { path = "../bashkit-scripted-tool", features = ["python","jq"] }
tokio = { workspace = true } # wasm-safe base features only
@@ -77,7 +77,7 @@ tokio = { workspace = true } # wasm-safe base features only
### `src/lib.rs`
-- `#[cfg(not(target_arch = "wasm32"))]` on: async `execute*()` `#[pymethods]`,
+- `#[cfg(not(target_family = "wasm"))]` on: async `execute*()` `#[pymethods]`,
`pyo3-async-runtimes` imports, `make_external_handler`, caller-loop callback
machinery (`PyCancellableLoopFuture`, `call_soon_threadsafe_with_context`,
`cancel_python_task`), network/credential parsing + `apply`,
@@ -86,7 +86,7 @@ tokio = { workspace = true } # wasm-safe base features only
`std::convert::Infallible` (wasm); `caller_loop_locals` is always `None`
on wasm, so caller-loop branches are statically dead.
- Construction-time `RuntimeError` guards for the four gated kwargs.
-- Wasm-scoped `#![cfg_attr(target_arch = "wasm32", allow(dead_code, unused_imports))]`
+- Wasm-scoped `#![cfg_attr(target_family = "wasm", allow(dead_code, unused_imports))]`
silences lints from native-only helpers.
Decision comments are inline at each gate; this spec is the index.
diff --git a/knowledge/runtimes/markkit-fetchkit-builtins.md b/knowledge/runtimes/markkit-fetchkit-builtins.md
index dbf25a26f..9cd6eb6a2 100644
--- a/knowledge/runtimes/markkit-fetchkit-builtins.md
+++ b/knowledge/runtimes/markkit-fetchkit-builtins.md
@@ -93,7 +93,7 @@ startup cost: registration is a map insert, nothing is loaded until a call.
## Constraints
-- Native only (`not(target_arch = "wasm32")`): both CLI crates need tokio's
+- Native only (`not(target_family = "wasm")`): both CLI crates need tokio's
multi-thread runtime.
- Off by default everywhere (core, bashkit-cli, Python, Node) until a separate
decision turns them on (user, 2026-11-01).