Skip to main content

Module guard

Module guard 

Source
Expand description

guard — Portability Guard (assert_portable).

DSL-agnostic IR portability invariant: a portable IR must not contain non-serializable values. In Rust the runtime works over serde_json::Value (already JSON-serializable) plus the native crate::value::Value, so the only structurally non-portable case is a non-finite float (NaN/±Inf) which cannot be represented in JSON. assert_portable walks a value and rejects it.

Structs§

PortabilityError

Constants§

PORTABLE_COMPOUND_KINDS
The compound type constructors of the portable type notation (same closed set as the TS guard’s PORTABLE_COMPOUND_KINDS).
PORTABLE_EXPR_OPERATORS
The closed set of Expression-IR operators allowed in a portable IR (expression-ir.md §3).
PORTABLE_SCALAR_TYPES
The closed set of scalar types in the portable type notation (scp-ir-architecture.md §5.2, bc#44 B0). Compound types are the single-key objects {opt|arr|map|obj: ...}.
PORTABLE_VALUE_TYPE
The generic opaque-value literal (bc#156): the declared type of a driver boundary’s generic bound value (WireValue). Not a concrete scalar, but in the type notation it appears as the leaf string "value" ({arr:"value"} = a list of bound values), accepted with the same strength as a scalar (it is a DECLARED opaque type, not an "any" escape hatch). Same as the TS guard’s PORTABLE_VALUE_TYPE.

Functions§

assert_portable
Assert that a runtime Value is portable (JSON-serializable). The only non-portable scalar in the Rust value model is a non-finite float.
assert_portable_component_graph
Portability Guard for a component-graph IR (scp-ir-architecture.md §5), operating on the raw serde_json::Value IR (P0-2). Enforces, fail-closed:
portable_type_has_value
Does the portable type carry the opaque wire value "value" ANYWHERE (recursive)? The COUNTERPART of wire_passthrough_out_type_ok: an output type that contains value without being the legal passthrough shape (nested in a record field / map value / nested array) has no de-box contract. Same rule as the TS portableTypeHasValue (behavior.ts).
wire_passthrough_out_type_ok
Is an output-passthrough node’s outType the legal opaque shape (value / {arr:"value"})? Passthrough only covers “the whole output” and “the DIRECT element of an output array” — a value anywhere else has no de-box contract. Same rule as the TS wirePassthroughOutTypeOk (behavior.ts).