Skip to content
Topaz6.0 · Before release
Download

Search documentation

Specification 6.0 · Not released · Tested product 5.21.3

Use arrow keys to choose a result. Press Enter to open.

Type an API name, diagnostic number, rule, or project topic.

    Library · std.lispex

    LispexPreparationError

    Separate source preparation failure from admission and host failure.

    enum LispexPreparationError { Source(LispexBoundaryReport), Admission(LispexBoundaryReport), Interrupted(LispexOperationalFault), EngineDefect(LispexBoundaryReport) }
    Receiver
    Not applicable
    Minimum arity
    0
    Maximum arity
    0

    Declaration and parameters

    Link

    Availability

    Included by default: no

    Import std.lispex from an application package with a verified lock. Packages with [lispex] require --locked. Application profile topaz/lispex-decision-application/1 uses evaluator profile lispex/r7rs-rule-embedded-core/1. Application profile topaz/lispex-decision-application/2 uses evaluator profile lispex/r7rs-rule-current-profile-bounded/1.

    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-worker (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

    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.

    Result

    Effects

    Failures

    Result and effects

    Link

    Separate source preparation failure from admission and host failure.

    Why

    Link

    The preparation contract gives this operation one explicit input boundary and preserves the distinct result and failure cases.

    Related entries

    Link

    std.lispex

    Prepare closed source and revalidate transported rules

    Link
    Ruletopaz.stdlib.contract.lispex-preparation.rule

    Prepare 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

    Prepare source and revalidate transported bytes

    Link
    main.tpzPrepare source and revalidate transported bytesOpen in Playground
    1. import std.bytes { Bytes }
    2. import std.lispex {
    3. LispexPackage,
    4. LispexSourceBundle,
    5. LispexPreparationLimits,
    6. PreparedLispexRule,
    7. LispexPreparationError,
    8. prepare,
    9. preparedBytes,
    10. admitPrepared,
    11. }
    12. function transport(package: LispexPackage, bundle: LispexSourceBundle, limits: LispexPreparationLimits) -> Result<PreparedLispexRule, LispexPreparationError> {
    13. let prepared: Result<PreparedLispexRule, LispexPreparationError> = prepare(package, bundle, limits)
    14. let rule: PreparedLispexRule = prepared?
    15. let bytes: Bytes = preparedBytes(rule)
    16. return admitPrepared(package, bytes, limits)
    17. }
    18. export function main(args: Array<string>, stdin: string) -> Result<int, string> {
    19. return Ok(0)
    20. }
    Expected outputexit 0
    No stdout.
    $ topaz check main.tpz --locked --format json · target product 5.21.3
    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

    Menu

    Download