enum Lispex Preparation Error { Source(Lispex Boundary Report), Admission(Lispex Boundary Report), Interrupted(Lispex Operational Fault), Engine Defect(Lispex Boundary Report) }- Module
- std.
lispex - Receiver
- Not applicable
- Minimum arity
- 0
- Maximum arity
- 0
Declaration and parameters
LinkAvailability
Included by default: no
Import std.lispex from an application package with a verified lock. Packages with [lispex] require --locked. Application profile topaz/ uses evaluator profile lispex/. Application profile topaz/ uses evaluator profile lispex/.
The generated-module resolver gate starts at language mode 5.18. Compatibility of this API with earlier released editions remains Pending. Target deployment conditions are native (native-only), web (web-isolated-workers), web- (web-isolated-workers). Runtime payload follows checker-reached rules. An empty reached-rule set includes no runtime payload. Application quotas are required. Lock-only packages do not receive these application modules.
Source evidence
- compiler/crates/topaz_lispex_product/src/lib.rs at
b48527d0a174· 202 - compiler/crates/topaz_lispex_product/src/lib.rs at
b48527d0a174· 202 - compiler/crates/topaz_resolve/src/lib.rs at
b48527d0a174· 801 - compiler/crates/topaz_cli/src/package/target.rs at
b48527d0a174· 71 - compiler/crates/topaz_value/src/lispex_application.rs at
b48527d0a174· 11 - compiler/crates/topaz_lispex_product/src/lib.rs at
b48527d0a174· 739 - compiler/crates/topaz_lispex_product/src/full_product.rs at
b48527d0a174· 44 - compiler/crates/topaz_lispex_product/src/lib.rs at
b48527d0a174· 634 - compiler/crates/topaz_lispex_product/src/lib.rs at
b48527d0a174· 496 - compiler/crates/topaz_lispex_product/src/full_product.rs at
b48527d0a174· 356
Receiver
Parameter constraints
LispexSource contains a logical bundle name and exact source bytes. LispexSourceBundle supplies entryModule, entryBinding and every source dependency. The input values accepted by prepare follow collection value semantics.
Logical source names are nonempty relative names with slash separators. Reject absolute names, empty segments, dot segments, backslashes and duplicates. Match names and bindings exactly without case folding or Unicode normalization. These names are bundle keys and never host filesystem paths.
entryModule selects one supplied source. entryBinding selects the resolved callable binding in that module under the admitted source contract. The entry must accept one input argument. A fixed unary procedure and a rest procedure that accepts one argument satisfy this requirement. This Topaz selection does not add a Lispex export grammar or a last-expression convention.
prepare accepts an admitted package, the complete source snapshot and LispexPreparationLimits. Validate every required finite limit before reading source. Strictly read source under the selected source contract, resolve imports from the bundle and admitted standard library, expand and normalize, then verify the selected entry.
Preparation consumes its own work, cumulative allocation, semantic frames, source input, prepared result and diagnostic channels. It never borrows evaluation or profile work limits. A source, normalization, entry or preparation resource failure returns LispexPreparationError.Source with a source bound report.
Missing dependencies and unsupported components return Admission. Host cancellation, deadline and physical safety interruption return Interrupted. An engine invariant failure returns EngineDefect. The original first failure remains visible and no failed preparation yields a PreparedLispexRule.
A successful PreparedLispexRule seals the verified program, selected entry, dependency identities, semantic contracts and prepared artifact. Reusing it starts each evaluation with a fresh evaluation budget and fresh guest state. Preparation performs no guest computation. Required guest and module initialization belongs to each evaluation.
admitPrepared accepts transported bytes, an admitted package and finite preparation limits. Validate the container, exact integrity, interface, code and dependency identities, supported contracts and declared resource envelope before returning the same rule type. Previously prepared bytes are untrusted at a new boundary.
Transport validation verifies program, artifact and dependency identities from supplied material. Source provenance is optional for a supported source free artifact. inspectRule reports source as None unless exact source bytes and their program binding are verified under the supported format. A claimed source digest or signature alone is not verified provenance.
preparedBytes returns the immutable representation already reserved within the preparation result channel. It performs no new serialization, preparation or guest evaluation. Its size cannot escape the limit used to obtain the rule.
A warm preparation cache may change preparation work and its acceptance under the supplied preparation budget. Reuse still validates the cached contract and complete supplied inputs. It never increases an evaluation budget or changes evaluation charges or outcomes.
A source bound preparation report has no canonical evaluation outcome or evaluation receipt. Preserve source bytes and preparation contract when reproducing preparation. Exact evaluation replay additionally needs the complete evaluation request.
Related rule: Prepare closed source and revalidate transported rulesResult
Effects
Failures
Result and effects
LinkSeparate source preparation failure from admission and host failure.
Why
LinkThe preparation contract gives this operation one explicit input boundary and preserves the distinct result and failure cases.
Related entries
LinkPrepare closed source and revalidate transported rules
LinkPrepare closed source and revalidate transported rules
LispexSource contains a logical bundle name and exact source bytes. LispexSourceBundle supplies entryModule, entryBinding and every source dependency. The input values accepted by prepare follow collection value semantics.
Logical source names are nonempty relative names with slash separators. Reject absolute names, empty segments, dot segments, backslashes and duplicates. Match names and bindings exactly without case folding or Unicode normalization. These names are bundle keys and never host filesystem paths.
entryModule selects one supplied source. entryBinding selects the resolved callable binding in that module under the admitted source contract. The entry must accept one input argument. A fixed unary procedure and a rest procedure that accepts one argument satisfy this requirement. This Topaz selection does not add a Lispex export grammar or a last-expression convention.
prepare accepts an admitted package, the complete source snapshot and LispexPreparationLimits. Validate every required finite limit before reading source. Strictly read source under the selected source contract, resolve imports from the bundle and admitted standard library, expand and normalize, then verify the selected entry.
Preparation consumes its own work, cumulative allocation, semantic frames, source input, prepared result and diagnostic channels. It never borrows evaluation or profile work limits. A source, normalization, entry or preparation resource failure returns LispexPreparationError.Source with a source bound report.
Missing dependencies and unsupported components return Admission. Host cancellation, deadline and physical safety interruption return Interrupted. An engine invariant failure returns EngineDefect. The original first failure remains visible and no failed preparation yields a PreparedLispexRule.
A successful PreparedLispexRule seals the verified program, selected entry, dependency identities, semantic contracts and prepared artifact. Reusing it starts each evaluation with a fresh evaluation budget and fresh guest state. Preparation performs no guest computation. Required guest and module initialization belongs to each evaluation.
admitPrepared accepts transported bytes, an admitted package and finite preparation limits. Validate the container, exact integrity, interface, code and dependency identities, supported contracts and declared resource envelope before returning the same rule type. Previously prepared bytes are untrusted at a new boundary.
Transport validation verifies program, artifact and dependency identities from supplied material. Source provenance is optional for a supported source free artifact. inspectRule reports source as None unless exact source bytes and their program binding are verified under the supported format. A claimed source digest or signature alone is not verified provenance.
preparedBytes returns the immutable representation already reserved within the preparation result channel. It performs no new serialization, preparation or guest evaluation. Its size cannot escape the limit used to obtain the rule.
A warm preparation cache may change preparation work and its acceptance under the supplied preparation budget. Reuse still validates the cached contract and complete supplied inputs. It never increases an evaluation budget or changes evaluation charges or outcomes.
A source bound preparation report has no canonical evaluation outcome or evaluation receipt. Preserve source bytes and preparation contract when reproducing preparation. Exact evaluation replay additionally needs the complete evaluation request.
Why
Preparing supplied source and admitting transported code cross different trust boundaries. Both yield the same verified rule type after bounded validation. Explicit entry selection avoids an implicit procedure convention and immutable rules support repeated reproducible evaluation.
Source evidence
- docs/content-next/en/embedding.json at
f455ac95ab30· 1 - docs/content-next/en/resources.json at
f455ac95ab30· 1 - docs/content-next/en/receipt-and-replay.json at
f455ac95ab30· 1 - docs/content-next/en/procedures.json at
f455ac95ab30· 1 - docs/content-next/en/prepare.json at
f455ac95ab30· 1 -
topaz.stdlib.contract.lispex-preparationatworking-tree - topaz.decision.lispex-v2-preparation.1 at
topaz.decisi
Prepare source and revalidate transported bytes
Linkimport std.bytes { Bytes }import std.lispex {LispexPackage,LispexSourceBundle,LispexPreparationLimits,PreparedLispexRule,LispexPreparationError,prepare,preparedBytes,admitPrepared,}function transport(package: LispexPackage, bundle: LispexSourceBundle, limits: LispexPreparationLimits) -> Result<PreparedLispexRule, LispexPreparationError> {let prepared: Result<PreparedLispexRule, LispexPreparationError> = prepare(package, bundle, limits)let rule: PreparedLispexRule = prepared?let bytes: Bytes = preparedBytes(rule)return admitPrepared(package, bytes, limits)}export function main(args: Array<string>, stdin: string) -> Result<int, string> {return Ok(0)}
No stdout.
Expected result
Expected result
Checking accepts the program. Exit code 0.
Use a verified Lispex application package supplied through TOPAZ_LISPEX_APPLICATION. This example specifies the Lispex 2.0 behavior. The product scope remains the public 5.21.3 observation scope.
Source evidence
- docs/content-next/en/embedding.json at
f455ac95ab30· 1 - docs/content-next/en/resources.json at
f455ac95ab30· 1 - docs/content-next/en/receipt-and-replay.json at
f455ac95ab30· 1 - docs/content-next/en/procedures.json at
f455ac95ab30· 1 - docs/content-next/en/prepare.json at
f455ac95ab30· 1 -
topaz.stdlib.contract.lispex-preparationatworking-tree - topaz.decision.lispex-v2-preparation.1 at
topaz.decisi