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

    Prepare closed rules and evaluate canonical values with finite Lispex 2.0 limits.

    APIs in this module

    63 APIs

    NameModule
    LispexAttemptErrorstd.lispex
    LispexAuthenticationstd.lispex
    LispexBoundaryReportstd.lispex
    LispexCanonicalSitestd.lispex
    LispexConditionstd.lispex
    LispexConsumerArtifactInspection.artifactBytesstd.lispex
    LispexConsumerArtifactInspection.portableCoreBytesstd.lispex
    LispexConsumerEvidence.artifactstd.lispex
    LispexConsumerEvidence.settlementstd.lispex
    LispexDatumViewstd.lispex
    LispexEvaluationstd.lispex
    LispexEvidenceError.InvalidConsumerArtifactstd.lispex
    LispexEvidenceOutcome.Portablestd.lispex
    LispexEvidenceOutcome.Unrecordedstd.lispex
    LispexExecutionEvidencestd.lispex
    LispexHostLimitsstd.lispex
    LispexIdentitystd.lispex
    LispexLimitPresetstd.lispex
    LispexLimits.logicalAllocationstd.lispex
    LispexLimits.semanticFramesstd.lispex
    LispexOperationalFault.Cancelledstd.lispex
    LispexOperationalFault.DeadlineExceededstd.lispex
    LispexOperationalFault.SafetyPreemptionstd.lispex
    LispexPackagestd.lispex
    LispexPackageInputstd.lispex
    LispexPackagePartstd.lispex
    LispexPreparationErrorstd.lispex
    LispexPreparationLimitsstd.lispex
    LispexProfileReportstd.lispex
    LispexProfileRequeststd.lispex
    LispexReceiptstd.lispex
    LispexReportFieldstd.lispex
    LispexRequeststd.lispex
    LispexResourceAxisstd.lispex
    LispexSemanticContractstd.lispex
    LispexSettlement.Completestd.lispex
    LispexSettlement.LimitExhaustionstd.lispex
    LispexSettlement.SemanticFailurestd.lispex
    LispexSourcestd.lispex
    LispexSourceBundlestd.lispex
    LispexTrustKeystd.lispex
    LispexTrustPolicystd.lispex
    LispexValueError.InvalidCanonicalValuestd.lispex
    LispexValueError.InvalidDatumstd.lispex
    LispexValueError.LimitExceededstd.lispex
    std.lispex.admitPackagestd.lispex
    std.lispex.admitPreparedstd.lispex
    std.lispex.applicationPackagestd.lispex
    std.lispex.authenticateEvidencestd.lispex
    std.lispex.canonicalBytesstd.lispex
    std.lispex.consumerArtifactBytesstd.lispex
    std.lispex.defaultLimitsstd.lispex
    std.lispex.evaluatestd.lispex
    std.lispex.evaluateWithEvidencestd.lispex
    std.lispex.freshReplaystd.lispex
    std.lispex.inspectConsumerArtifactstd.lispex
    std.lispex.inspectRulestd.lispex
    std.lispex.portableCoreBytesstd.lispex
    std.lispex.preparestd.lispex
    std.lispex.preparedBytesstd.lispex
    std.lispex.valueFromCanonicalstd.lispex
    std.lispex.valueFromDatumstd.lispex
    std.lispex.valueViewstd.lispex

    Module

    Link

    The Topaz 6.0 API passes immutable values into Lispex 2.0. Prepare source or admit transported code before evaluation. Completed outcomes preserve success, language failure and resource failure. Admission reports, interrupted attempts and profile work remain separate.

    Why

    Link

    Topaz supplies external facts and acts on results. A closed guest boundary preserves that direction of authority while explicit phases let ordinary programs reuse prepared rules and reproduce decisions.

    Availability

    Link

    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.

    Exported types

    Link

    type PreparedLispexRule

    An opaque handle to a prepared application rule.

    type LispexValue

    A Lispex value exchanged through canonical bytes.

    type LispexConsumerArtifact

    A consumer evidence artifact carried by the application API.

    enum LispexValueError { InvalidCanonicalValue(LispexBoundaryReport), InvalidDatum(LispexBoundaryReport), LimitExceeded(LispexBoundaryReport) }

    An error reported while reading a canonical Lispex value.

    LispexLimits { work: int, logicalAllocation: int, semanticFrames: int, input: int, result: int, diagnostics: int }

    Evaluation limits supplied when running a prepared rule.

    LispexRuleIdentity { source: Option<LispexIdentity>, program: LispexIdentity, artifact: LispexIdentity, contract: LispexSemanticContract }

    Identity information returned for a prepared rule.

    enum LispexSettlement { Complete(LispexValue), SemanticFailure(LispexCondition), LimitExhaustion(LispexCondition) }

    The semantic outcome of an evaluation request.

    enum LispexOperationalFault { Cancelled(), DeadlineExceeded(), SafetyPreemption() }

    An operational fault reported by an application evaluation.

    LispexConsumerEvidence { request: LispexRequest, settlement: LispexSettlement, artifact: LispexConsumerArtifact }

    A settlement paired with its consumer evidence artifact.

    enum LispexEvidenceOutcome { Portable(LispexConsumerEvidence), Unrecorded(LispexEvaluation, LispexProfileReport) }

    The outcome of an evaluation that requested consumer evidence.

    LispexConsumerArtifactInspection { artifact: LispexConsumerArtifact, receipt: LispexReceipt, evidence: Option<LispexExecutionEvidence>, artifactBytes: int, portableCoreBytes: int }

    Inspection information returned for a consumer evidence artifact.

    enum LispexEvidenceError { InvalidConsumerArtifact(LispexBoundaryReport), Admission(LispexBoundaryReport), Authentication(LispexBoundaryReport), LimitExceeded(LispexBoundaryReport) }

    An error reported by consumer evidence operations.

    enum LispexReplayError { MissingRequest(LispexBoundaryReport), RequestMismatch(LispexBoundaryReport), OutcomeMismatch(LispexBoundaryReport, LispexEvaluation), AttemptFailed(LispexAttemptError), HostWorkRefused(LispexBoundaryReport, Option<LispexEvaluation>) }

    An error reported by fresh replay.

    Type members keep the compiler-owned type name shown in their declarations. Importing a module does not create a new type identity.

    Public API

    Link

    LispexValueError.InvalidCanonicalValue

    LispexLimits.logicalAllocation

    LispexLimits.semanticFrames

    LispexSettlement.Complete

    LispexSettlement.SemanticFailure

    LispexSettlement.LimitExhaustion

    LispexOperationalFault.Cancelled

    LispexOperationalFault.DeadlineExceeded

    LispexOperationalFault.SafetyPreemption

    LispexConsumerEvidence.settlement

    LispexConsumerEvidence.artifact

    LispexEvidenceOutcome.Portable

    LispexEvidenceOutcome.Unrecorded

    LispexConsumerArtifactInspection.artifactBytes

    LispexConsumerArtifactInspection.portableCoreBytes

    LispexEvidenceError.InvalidConsumerArtifact

    std.lispex.valueFromCanonical

    std.lispex.canonicalBytes

    std.lispex.defaultLimits

    std.lispex.inspectRule

    std.lispex.evaluate

    std.lispex.evaluateWithEvidence

    std.lispex.consumerArtifactBytes

    std.lispex.portableCoreBytes

    std.lispex.inspectConsumerArtifact

    std.lispex.freshReplay

    LispexDatumView

    LispexValueError.InvalidDatum

    LispexValueError.LimitExceeded

    std.lispex.valueFromDatum

    std.lispex.valueView

    LispexPreparationLimits

    LispexHostLimits

    LispexLimitPreset

    LispexReportField

    LispexBoundaryReport

    LispexPreparationError

    LispexAttemptError

    LispexCanonicalSite

    LispexResourceAxis

    LispexCondition

    LispexEvaluation

    LispexSource

    LispexSourceBundle

    LispexPackage

    LispexPackagePart

    LispexPackageInput

    std.lispex.applicationPackage

    std.lispex.admitPackage

    std.lispex.prepare

    std.lispex.admitPrepared

    std.lispex.preparedBytes

    LispexIdentity

    LispexSemanticContract

    LispexRequest

    LispexProfileRequest

    LispexProfileReport

    LispexReceipt

    LispexExecutionEvidence

    LispexTrustKey

    LispexTrustPolicy

    LispexAuthentication

    std.lispex.authenticateEvidence

    Pending contracts

    Link

    Inspect and validate consumer artifacts in one call

    Link

    Inspect and validate consumer artifacts in one call

    inspectConsumerArtifact accepts an admitted package, complete artifact bytes and finite host limits. It decodes and validates the receipt and evidence bindings before returning an inspection.

    Inspection performs no guest evaluation or replay. Structural validity does not authenticate an issuer. authenticateEvidence applies explicit trust separately.

    std.lispex exports neither verifyConsumerArtifact nor consumerArtifactFromBytes. inspectConsumerArtifact is the single artifact byte admission operation.

    Why

    The former verification and inspection names performed the same validation and expressed the same intention. Decoding bytes into an accepted artifact is part of that admission. Authenticating an issuer and reproducing a semantic request express different intentions.

    Source evidence

    Reject the removed verification name in a verified application

    Link
    main.tpzReject the removed verification name in a verified applicationOpen in Playground
    1. import std.lispex { verifyConsumerArtifact }
    2. export function main(args: Array<string>, stdin: string) -> Result<int, string> {
    3. return Ok(0)
    4. }
    Expected outputNonzero exit
    No stdout.
    $ topaz check main.tpz --locked --format json · target product 5.21.3
    Expected result

    Expected result

    Rejection during resolve. Nonzero exit.

    • TPZ3009 selected-name-not-exported at main.tpz:1:21

    Check this source inside an existing verified Lispex application package supplied through TOPAZ_LISPEX_APPLICATION. The product test copies that package and adds this source file. This example does not create or prepare its package lock or binary artifacts.

    Source evidence

    Diagnostics

    Link

    Name is not exported

    Pass values through a bounded guest boundary

    Link
    Ruletopaz.stdlib.contract.lispex-host-boundary.rule

    Pass values through a bounded guest boundary

    The Lispex 2.0 embedding contract governs both modules. Topaz is the host. Lispex is the guest. A guest invocation cannot invoke Topaz code or acquire host authority.

    The host supplies a closed source bundle or an admitted prepared rule. Evaluation accepts one canonical Datum and returns one canonical Datum on success. Host closures and object references cannot cross the boundary.

    Preparation and evaluation each receive a complete finite limit record. Missing fields, unknown fields, negative values and values outside the declared integer range are rejected before entry. No implicit default replaces an invalid record.

    Guest code cannot obtain files, sockets, clocks, randomness, process state, environment variables or host callbacks. The host reads external facts before the call and passes their values explicitly.

    The same canonical request under the same semantic and resource contracts produces the same canonical outcome. Host interruption and engine defects remain separate from deterministic language and resource failures.

    Topaz decides what to do with a returned value after the guest invocation ends. A guest result does not itself grant permission to write files, send messages or perform another host action.

    Why

    Explicit immutable values preserve the direction of authority. Preparation and evaluation have different inputs and costs, so separate bounded operations preserve distinct intentions. A shortcut must perform those same phases without granting an alternate capability path.

    Source evidence

    Pass captured host text as a value

    Link
    main.tpzPass captured host text as a valueOpen in Playground
    1. import std.bytes { Bytes }
    2. import std.io
    3. import std.test
    4. import std.lispex {
    5. LispexPackage,
    6. LispexBoundaryReport,
    7. LispexLimitPreset,
    8. LispexLimits,
    9. LispexSource,
    10. LispexSourceBundle,
    11. PreparedLispexRule,
    12. LispexPreparationError,
    13. LispexDatumView,
    14. LispexValue,
    15. LispexValueError,
    16. LispexEvaluation,
    17. LispexAttemptError,
    18. LispexSettlement,
    19. applicationPackage,
    20. defaultLimits,
    21. prepare,
    22. valueFromDatum,
    23. canonicalBytes,
    24. evaluate,
    25. }
    26. export function main(args: Array<string>, stdin: string) -> Result<int, string> {
    27. let packageResult: Result<LispexPackage, LispexBoundaryReport> = applicationPackage()
    28. let application: LispexPackage = test.assertOk(packageResult)
    29. let preset: LispexLimitPreset = defaultLimits()
    30. let source: LispexSource = LispexSource {
    31. name: "source.scm",
    32. bytes: "(define rule (lambda (input) input))\n".encodeUtf8(),
    33. }
    34. let bundle: LispexSourceBundle = LispexSourceBundle {
    35. entryModule: "source.scm",
    36. entryBinding: "rule",
    37. sources: [source],
    38. }
    39. let prepared: Result<PreparedLispexRule, LispexPreparationError> = prepare(application, bundle, preset.preparation)
    40. let rule: PreparedLispexRule = test.assertOk(prepared)
    41. let converted: Result<LispexValue, LispexValueError> = valueFromDatum(application, LispexDatumView.Text(stdin), preset.host)
    42. let input: LispexValue = test.assertOk(converted)
    43. let attempt: Result<LispexEvaluation, LispexAttemptError> = evaluate(rule, input, preset.evaluation)
    44. let evaluation: LispexEvaluation = test.assertOk(attempt)
    45. match (evaluation.settlement) {
    46. case Complete(output) => {
    47. let captured: Bytes = canonicalBytes(input)
    48. let returned: Bytes = canonicalBytes(output)
    49. io.writeLine("{returned.toHex() == captured.toHex()}")
    50. }
    51. case _ => io.writeLine("unexpected outcome")
    52. }
    53. return Ok(0)
    54. }
    Expected outputexit 0
    true
    
    $ topaz run main.tpz --locked · target product 5.21.3
    Expected result

    Expected result

    Execution completes. Exit code 0.

    Expected stdout
    1. true

    Run this source inside the verified Lispex application supplied through TOPAZ_LISPEX_APPLICATION. The example expects the Lispex 2.0 host contract.

    Source evidence

    Use the Lispex 2.0 host API

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

    Use the Lispex 2.0 host API

    The following table defines the Topaz 6.0 exports. A removed name is absent from this edition. The product scope attached to examples remains the public 5.21.3 observation scope.

    APIActionContract or replacement
    LispexValueError.InvalidCanonicalValueChangeLispexValueError.InvalidCanonicalValue(LispexBoundaryReport)
    LispexLimits.canonicalInputBytesRemoveUse the complete LispexLimits record with work, logicalAllocation, semanticFrames, input, result and diagnostics. Channel units come from the selected resource contract.
    LispexLimits.evalWorkRemoveUse the complete LispexLimits record with work, logicalAllocation, semanticFrames, input, result and diagnostics. Channel units come from the selected resource contract.
    LispexLimits.logicalAllocationKeepLispexLimits.logicalAllocation: int
    LispexLimits.semanticFramesKeepLispexLimits.semanticFrames: int
    LispexLimits.traversalDepthRemoveUse the complete LispexLimits record with work, logicalAllocation, semanticFrames, input, result and diagnostics. Channel units come from the selected resource contract.
    LispexLimits.outputBytesRemoveUse the complete LispexLimits record with work, logicalAllocation, semanticFrames, input, result and diagnostics. Channel units come from the selected resource contract.
    LispexLimits.diagnosticBytesRemoveUse the complete LispexLimits record with work, logicalAllocation, semanticFrames, input, result and diagnostics. Channel units come from the selected resource contract.
    LispexLimits.transcriptBytesRemoveUse the complete LispexLimits record with work, logicalAllocation, semanticFrames, input, result and diagnostics. Channel units come from the selected resource contract.
    LispexLimits.transcriptEventsRemoveUse the complete LispexLimits record with work, logicalAllocation, semanticFrames, input, result and diagnostics. Channel units come from the selected resource contract.
    LispexLimits.resultBytesRemoveUse the complete LispexLimits record with work, logicalAllocation, semanticFrames, input, result and diagnostics. Channel units come from the selected resource contract.
    LispexRuleIdentity.nameRemoveRead the verified source, program, artifact and contract fields from inspectRule. Package names and product hashes do not replace semantic request identity.
    LispexRuleIdentity.profileRemoveRead the verified source, program, artifact and contract fields from inspectRule. Package names and product hashes do not replace semantic request identity.
    LispexRuleIdentity.componentIdRemoveRead the verified source, program, artifact and contract fields from inspectRule. Package names and product hashes do not replace semantic request identity.
    LispexRuleIdentity.evaluatorSha256RemoveRead the verified source, program, artifact and contract fields from inspectRule. Package names and product hashes do not replace semantic request identity.
    LispexRuleIdentity.preparedArtifactSha256RemoveRead the verified source, program, artifact and contract fields from inspectRule. Package names and product hashes do not replace semantic request identity.
    LispexRuleIdentity.preparationRequestSha256RemoveRead the verified source, program, artifact and contract fields from inspectRule. Package names and product hashes do not replace semantic request identity.
    LispexSettlement.CompleteKeepLispexSettlement.Complete(LispexValue)
    LispexSettlement.SemanticFailureChangeLispexSettlement.SemanticFailure(LispexCondition)
    LispexSettlement.LimitExhaustionChangeLispexSettlement.LimitExhaustion(LispexCondition)
    LispexSettlement.RequestRefusalRemoveMatch LispexAttemptError.Admission before a canonical evaluation outcome exists.
    LispexOperationalFault.CancelledChangeLispexOperationalFault.Cancelled()
    LispexOperationalFault.DeadlineExceededChangeLispexOperationalFault.DeadlineExceeded()
    LispexOperationalFault.QueueFullRemoveUse a typed admission report for host admission limits and unsupported components. Use LispexAttemptError.EngineDefect for an engine defect. Deterministic guest exhaustion remains LispexSettlement.LimitExhaustion.
    LispexOperationalFault.TotalEvaluationsExceededRemoveUse a typed admission report for host admission limits and unsupported components. Use LispexAttemptError.EngineDefect for an engine defect. Deterministic guest exhaustion remains LispexSettlement.LimitExhaustion.
    LispexOperationalFault.InputQuotaExceededRemoveUse a typed admission report for host admission limits and unsupported components. Use LispexAttemptError.EngineDefect for an engine defect. Deterministic guest exhaustion remains LispexSettlement.LimitExhaustion.
    LispexOperationalFault.ResultQuotaExceededRemoveUse a typed admission report for host admission limits and unsupported components. Use LispexAttemptError.EngineDefect for an engine defect. Deterministic guest exhaustion remains LispexSettlement.LimitExhaustion.
    LispexOperationalFault.OutputQuotaExceededRemoveUse a typed admission report for host admission limits and unsupported components. Use LispexAttemptError.EngineDefect for an engine defect. Deterministic guest exhaustion remains LispexSettlement.LimitExhaustion.
    LispexOperationalFault.TranscriptQuotaExceededRemoveUse a typed admission report for host admission limits and unsupported components. Use LispexAttemptError.EngineDefect for an engine defect. Deterministic guest exhaustion remains LispexSettlement.LimitExhaustion.
    LispexOperationalFault.SafetyFuelQuotaExceededRemoveUse a typed admission report for host admission limits and unsupported components. Use LispexAttemptError.EngineDefect for an engine defect. Deterministic guest exhaustion remains LispexSettlement.LimitExhaustion.
    LispexOperationalFault.PreparedBytesQuotaExceededRemoveUse a typed admission report for host admission limits and unsupported components. Use LispexAttemptError.EngineDefect for an engine defect. Deterministic guest exhaustion remains LispexSettlement.LimitExhaustion.
    LispexOperationalFault.CancellationTokenAlreadyUsedRemoveUse a typed admission report for host admission limits and unsupported components. Use LispexAttemptError.EngineDefect for an engine defect. Deterministic guest exhaustion remains LispexSettlement.LimitExhaustion.
    LispexOperationalFault.ComponentMismatchRemoveUse a typed admission report for host admission limits and unsupported components. Use LispexAttemptError.EngineDefect for an engine defect. Deterministic guest exhaustion remains LispexSettlement.LimitExhaustion.
    LispexOperationalFault.AdmissionMismatchRemoveUse a typed admission report for host admission limits and unsupported components. Use LispexAttemptError.EngineDefect for an engine defect. Deterministic guest exhaustion remains LispexSettlement.LimitExhaustion.
    LispexOperationalFault.SafetyPreemptionChangeLispexOperationalFault.SafetyPreemption()
    LispexOperationalFault.TargetUnavailableRemoveUse a typed admission report for host admission limits and unsupported components. Use LispexAttemptError.EngineDefect for an engine defect. Deterministic guest exhaustion remains LispexSettlement.LimitExhaustion.
    LispexOperationalFault.EngineFailureRemoveUse a typed admission report for host admission limits and unsupported components. Use LispexAttemptError.EngineDefect for an engine defect. Deterministic guest exhaustion remains LispexSettlement.LimitExhaustion.
    LispexConsumerEvidence.settlementKeepLispexConsumerEvidence.settlement: LispexSettlement
    LispexConsumerEvidence.artifactKeepLispexConsumerEvidence.artifact: LispexConsumerArtifact
    LispexEvidenceOutcome.PortableKeepLispexEvidenceOutcome.Portable(LispexConsumerEvidence)
    LispexEvidenceOutcome.UnrecordedChangeLispexEvidenceOutcome.Unrecorded(LispexEvaluation, LispexProfileReport)
    LispexConsumerArtifactInspection.kindRemoveRead the receipt and optional execution evidence from inspectConsumerArtifact. Authenticate an envelope through authenticateEvidence with explicit trust.
    LispexConsumerArtifactInspection.categoryRemoveRead the receipt and optional execution evidence from inspectConsumerArtifact. Authenticate an envelope through authenticateEvidence with explicit trust.
    LispexConsumerArtifactInspection.evaluatorSha256RemoveRead the receipt and optional execution evidence from inspectConsumerArtifact. Authenticate an envelope through authenticateEvidence with explicit trust.
    LispexConsumerArtifactInspection.semanticProfileIdRemoveRead the receipt and optional execution evidence from inspectConsumerArtifact. Authenticate an envelope through authenticateEvidence with explicit trust.
    LispexConsumerArtifactInspection.artifactSha256RemoveRead the receipt and optional execution evidence from inspectConsumerArtifact. Authenticate an envelope through authenticateEvidence with explicit trust.
    LispexConsumerArtifactInspection.artifactBytesKeepLispexConsumerArtifactInspection.artifactBytes: int
    LispexConsumerArtifactInspection.portableCoreSha256RemoveRead the receipt and optional execution evidence from inspectConsumerArtifact. Authenticate an envelope through authenticateEvidence with explicit trust.
    LispexConsumerArtifactInspection.portableCoreBytesKeepLispexConsumerArtifactInspection.portableCoreBytes: int
    LispexConsumerArtifactInspection.authenticatedRemoveRead the receipt and optional execution evidence from inspectConsumerArtifact. Authenticate an envelope through authenticateEvidence with explicit trust.
    LispexConsumerArtifactInspection.issuerRemoveRead the receipt and optional execution evidence from inspectConsumerArtifact. Authenticate an envelope through authenticateEvidence with explicit trust.
    LispexEvidenceError.InvalidConsumerArtifactChangeLispexEvidenceError.InvalidConsumerArtifact(LispexBoundaryReport)
    LispexEvidenceError.NoPortableCoreRemoveinspectConsumerArtifact requires a portable receipt and rejects a container without one as InvalidConsumerArtifact.
    LispexReplayError.InvalidConsumerArtifactRemoveUse MissingRequest, RequestMismatch, OutcomeMismatch, AttemptFailed and HostWorkRefused to distinguish missing material, changed requests, changed outcomes, failed attempts and incomplete host comparison.
    LispexReplayError.ContextMismatchRemoveUse MissingRequest, RequestMismatch, OutcomeMismatch, AttemptFailed and HostWorkRefused to distinguish missing material, changed requests, changed outcomes, failed attempts and incomplete host comparison.
    LispexReplayError.ReplayMismatchRemoveUse MissingRequest, RequestMismatch, OutcomeMismatch, AttemptFailed and HostWorkRefused to distinguish missing material, changed requests, changed outcomes, failed attempts and incomplete host comparison.
    LispexReplayError.OperationalFaultRemoveUse MissingRequest, RequestMismatch, OutcomeMismatch, AttemptFailed and HostWorkRefused to distinguish missing material, changed requests, changed outcomes, failed attempts and incomplete host comparison.
    std.lispex.valueFromCanonicalChangevalueFromCanonical(package: LispexPackage, bytes: Bytes, limits: LispexHostLimits) -> Result<LispexValue, LispexValueError>
    std.lispex.canonicalBytesKeepcanonicalBytes(value: LispexValue) -> Bytes
    std.lispex.defaultLimitsChangedefaultLimits() -> LispexLimitPreset
    std.lispex.inspectRuleKeepinspectRule(rule: PreparedLispexRule) -> LispexRuleIdentity
    std.lispex.evaluateChangeevaluate(rule: PreparedLispexRule, input: LispexValue, limits: LispexLimits) -> Result<LispexEvaluation, LispexAttemptError>
    std.lispex.evaluateWithEvidenceChangeevaluateWithEvidence(rule: PreparedLispexRule, input: LispexValue, limits: LispexLimits, profile: LispexProfileRequest, hostLimits: LispexHostLimits) -> Result<LispexEvidenceOutcome, LispexAttemptError>
    std.lispex.consumerArtifactFromBytesRemoveUse inspectConsumerArtifact to decode and validate the same supplied bytes in one bounded call.
    std.lispex.consumerArtifactBytesKeepconsumerArtifactBytes(artifact: LispexConsumerArtifact) -> Bytes
    std.lispex.portableCoreBytesChangeportableCoreBytes(artifact: LispexConsumerArtifact) -> Bytes
    std.lispex.inspectConsumerArtifactChangeinspectConsumerArtifact(package: LispexPackage, bytes: Bytes, limits: LispexHostLimits) -> Result<LispexConsumerArtifactInspection, LispexEvidenceError>
    std.lispex.verifyConsumerArtifactRemoveUse inspectConsumerArtifact for structural and integrity validation. Use authenticateEvidence for the distinct intention of authenticating an issuer.
    std.lispex.freshReplayChangefreshReplay(rule: PreparedLispexRule, input: LispexValue, limits: LispexLimits, artifact: LispexConsumerArtifact, hostLimits: LispexHostLimits) -> Result<LispexEvaluation, LispexReplayError>
    Generated rule factoryChange{ruleName}(limits: LispexPreparationLimits) -> Result<PreparedLispexRule, LispexPreparationError>
    LispexDatumViewAddenum LispexDatumView { Boolean(bool), Number(BigInt, BigInt), Character(string), Symbol(string), EmptyList(), Pair(LispexValue, LispexValue), Text(string), Vector(Array<LispexValue>), Bytevector(Bytes) }
    LispexValueError.InvalidDatumAddLispexValueError.InvalidDatum(LispexBoundaryReport)
    LispexValueError.LimitExceededAddLispexValueError.LimitExceeded(LispexBoundaryReport)
    std.lispex.valueFromDatumAddvalueFromDatum(package: LispexPackage, datum: LispexDatumView, limits: LispexHostLimits) -> Result<LispexValue, LispexValueError>
    std.lispex.valueViewAddvalueView(value: LispexValue, limits: LispexHostLimits) -> Result<LispexDatumView, LispexValueError>
    LispexPreparationLimitsAddLispexPreparationLimits { work: int, logicalAllocation: int, semanticFrames: int, input: int, result: int, diagnostics: int }
    LispexHostLimitsAddLispexHostLimits { work: int, logicalAllocation: int, semanticFrames: int, input: int, result: int, diagnostics: int }
    LispexLimitPresetAddLispexLimitPreset { preparation: LispexPreparationLimits, evaluation: LispexLimits, host: LispexHostLimits }
    LispexReportFieldAddLispexReportField { name: string, value: string }
    LispexBoundaryReportAddLispexBoundaryReport { phase: string, code: string, fields: Array<LispexReportField>, message: string, source: Option<LispexIdentity>, verified: Array<LispexIdentity> }
    LispexPreparationErrorAddenum LispexPreparationError { Source(LispexBoundaryReport), Admission(LispexBoundaryReport), Interrupted(LispexOperationalFault), EngineDefect(LispexBoundaryReport) }
    LispexSourceAddLispexSource { name: string, bytes: Bytes }
    LispexSourceBundleAddLispexSourceBundle { entryModule: string, entryBinding: string, sources: Array<LispexSource> }
    std.lispex.prepareAddprepare(package: LispexPackage, bundle: LispexSourceBundle, limits: LispexPreparationLimits) -> Result<PreparedLispexRule, LispexPreparationError>
    std.lispex.admitPreparedAddadmitPrepared(package: LispexPackage, bytes: Bytes, limits: LispexPreparationLimits) -> Result<PreparedLispexRule, LispexPreparationError>
    std.lispex.preparedBytesAddpreparedBytes(rule: PreparedLispexRule) -> Bytes
    LispexAttemptErrorAddenum LispexAttemptError { Admission(LispexBoundaryReport), Interrupted(LispexOperationalFault), EngineDefect(LispexBoundaryReport) }
    LispexCanonicalSiteAddtype LispexCanonicalSite
    LispexResourceAxisAddenum LispexResourceAxis { Work(), LogicalAllocation(), SemanticFrames(), Channel(string) }
    LispexConditionAddLispexCondition { phase: string, code: string, parameters: LispexValue, site: LispexCanonicalSite, resource: Option<LispexResourceAxis> }
    LispexEvaluationAddLispexEvaluation { request: LispexRequest, settlement: LispexSettlement }
    LispexPackageAddtype LispexPackage
    LispexPackagePartAddLispexPackagePart { name: string, bytes: Bytes }
    LispexPackageInputAddLispexPackageInput { manifest: Bytes, evaluator: Bytes, standardLibrary: Bytes, dependencies: Array<LispexPackagePart> }
    std.lispex.applicationPackageAddapplicationPackage() -> Result<LispexPackage, LispexBoundaryReport>
    std.lispex.admitPackageAddadmitPackage(input: LispexPackageInput, limits: LispexHostLimits) -> Result<LispexPackage, LispexBoundaryReport>
    LispexIdentityAddtype LispexIdentity
    LispexSemanticContractAddLispexSemanticContract { language: string, standardLibrary: string, unicode: string, codec: string, resourceModel: string }
    LispexRequestAddLispexRequest { identity: LispexIdentity, program: LispexIdentity, entry: string, input: LispexValue, contract: LispexSemanticContract, limits: LispexLimits }
    LispexProfileRequestAddLispexProfileRequest { profile: string, inputSchema: Option<Bytes>, outputSchema: Option<Bytes>, evidence: string }
    LispexProfileReportAddLispexProfileReport { identity: LispexIdentity, report: LispexBoundaryReport }
    LispexReceiptAddLispexReceipt { request: LispexIdentity, settlement: LispexSettlement }
    LispexExecutionEvidenceAddLispexExecutionEvidence { request: LispexIdentity, outcome: LispexSettlement, product: string, evaluator: LispexIdentity, preparedArtifact: LispexIdentity, profileWork: LispexIdentity }
    LispexTrustKeyAddLispexTrustKey { id: string, issuer: string, algorithm: string, bytes: Bytes }
    LispexTrustPolicyAddLispexTrustPolicy { keys: Array<LispexTrustKey>, issuers: Array<string>, algorithms: Array<string> }
    LispexAuthenticationAddLispexAuthentication { artifact: LispexIdentity, issuer: string, key: string, algorithm: string }
    std.lispex.authenticateEvidenceAddauthenticateEvidence(artifact: LispexConsumerArtifact, trust: LispexTrustPolicy, limits: LispexHostLimits) -> Result<LispexAuthentication, LispexEvidenceError>

    consumerArtifactFromBytes and inspectConsumerArtifact previously expressed the same intention of accepting artifact bytes as validated input. Inspection now performs decoding and validation once. The extra constructor name is absent.

    verifyConsumerArtifact and inspectConsumerArtifact previously performed the same validation. The verification alias remains absent. Signature authentication and semantic replay have different intentions and retain separate operations.

    The old operational quota alternatives mixed physical host admission with deterministic guest accounting. Their distinctions remain in the report code and resource axis. Moving them to the correct phase does not turn a refusal into a canonical failure.

    The old identity and inspection fields mixed program meaning, artifact bytes and issuer trust. The replacement fields preserve those distinct intentions in separate typed records. No legacy digest is reinterpreted as a Lispex 2.0 identity.

    The removed declarations retain resolved question records in the authoring source. Each record preserves its original question and links this migration contract. Retained targets keep their resolved records on their current pages.

    Why

    One expression serves each intention. Byte admission needs one operation. Host interruption, semantic failure, receipt inspection, issuer authentication and semantic replay answer different questions and remain distinct. The type names that still describe the same concepts remain available with the 2.0 contracts.

    Source evidence

    Reject the redundant artifact decoder export

    Link
    main.tpzReject the redundant artifact decoder exportOpen in Playground
    1. import std.lispex { consumerArtifactFromBytes }
    2. export function main(args: Array<string>, stdin: string) -> Result<int, string> {
    3. return Ok(0)
    4. }
    Expected outputNonzero exit
    No stdout.
    $ topaz check main.tpz --locked --format json · target product 5.21.3
    Expected result

    Expected result

    Rejection during resolve. Nonzero exit.

    • TPZ3009 lispex-retired-artifact-decoder at main.tpz:1:21

    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

    Exchange exact immutable Datum values

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

    Exchange exact immutable Datum values

    LispexValue is an immutable validated Datum handle. Its codec identity travels with the value. Guest inputs and successful results use this same representation. Equality follows the selected canonical value contract.

    valueFromCanonical accepts an admitted package, immutable bytes and complete finite host limits. Decode exactly one complete canonical Datum under the package codec. Reject malformed bytes, trailing values, unsupported versions and noncanonical representations as InvalidCanonicalValue.

    valueFromDatum accepts a LispexDatumView and creates a detached immutable snapshot. Boolean accepts a bool. Number accepts exact BigInt numerator and denominator values and normalizes their rational value. A zero denominator returns InvalidDatum. No inexact floating value is accepted.

    Character accepts exactly one Unicode scalar. Empty text, several scalars and invalid scalar representations return InvalidDatum. Symbol and Text preserve their scalar sequences without normalization or case conversion. Empty symbols follow the selected Datum codec contract.

    EmptyList is the empty list value. Pair holds two validated values. Vector copies its Array of validated values in order. Bytevector retains exact immutable bytes. Every child must use the same admitted codec contract. A mismatched child returns InvalidDatum before guest entry.

    The exposed view has no procedure, callback or host object alternative. A procedure cannot be hidden in Pair or Vector because each child must already be a validated LispexValue. Construction does not follow host reference graphs. Mutating a source Array after conversion cannot change the sealed value.

    valueView returns a detached view of the same value. Number exposes the normalized exact numerator and positive denominator. Aggregate views contain sealed child handles. Changing a returned Array changes that view and does not mutate the LispexValue.

    Conversions reserve their work, allocation, traversal frames, input and result channels under LispexHostLimits. Host conversion exhaustion returns LimitExceeded with the first axis. A failure returns no prefix or partly valid value. It creates no canonical evaluation outcome or receipt.

    canonicalBytes returns the immutable canonical bytes established when the handle was created. It does not decode, evaluate, discover a codec or perform fresh serialization. The handle retains that bounded representation, so reading it starts no new guest or host work account.

    Host conversion work is separate from evaluation work. Evaluation still charges canonical input decoding and canonical result or failure encoding under its own limits. Prevalidated bytes cannot bypass those charges.

    The same value, codec and explicit conversion limits have the same accepted canonical bytes or deterministic conversion refusal. Exact codec bytes and normalization encodings belong to the admitted versioned Lispex contract. Legacy 1.21 bytes are never relabeled as 2.0 bytes.

    Why

    Canonical bytes serve interchange. Datum views serve typed host construction and inspection. These are different intentions even when they describe the same value. Immutable snapshots keep host mutation from changing a request after it has been identified.

    Source evidence

    Preserve an explicit Boolean input

    Link
    main.tpzPreserve an explicit Boolean inputOpen in Playground
    1. import std.bytes { Bytes }
    2. import std.io
    3. import std.test
    4. import std.lispex {
    5. LispexPackage,
    6. LispexBoundaryReport,
    7. LispexLimitPreset,
    8. LispexLimits,
    9. LispexSource,
    10. LispexSourceBundle,
    11. PreparedLispexRule,
    12. LispexPreparationError,
    13. LispexDatumView,
    14. LispexValue,
    15. LispexValueError,
    16. LispexEvaluation,
    17. LispexAttemptError,
    18. LispexSettlement,
    19. applicationPackage,
    20. defaultLimits,
    21. prepare,
    22. valueFromDatum,
    23. canonicalBytes,
    24. evaluate,
    25. }
    26. export function main(args: Array<string>, stdin: string) -> Result<int, string> {
    27. let packageResult: Result<LispexPackage, LispexBoundaryReport> = applicationPackage()
    28. let application: LispexPackage = test.assertOk(packageResult)
    29. let preset: LispexLimitPreset = defaultLimits()
    30. let source: LispexSource = LispexSource {
    31. name: "source.scm",
    32. bytes: "(define rule (lambda (input) input))\n".encodeUtf8(),
    33. }
    34. let bundle: LispexSourceBundle = LispexSourceBundle {
    35. entryModule: "source.scm",
    36. entryBinding: "rule",
    37. sources: [source],
    38. }
    39. let prepared: Result<PreparedLispexRule, LispexPreparationError> = prepare(application, bundle, preset.preparation)
    40. let rule: PreparedLispexRule = test.assertOk(prepared)
    41. let converted: Result<LispexValue, LispexValueError> = valueFromDatum(application, LispexDatumView.Boolean(true), preset.host)
    42. let input: LispexValue = test.assertOk(converted)
    43. let attempt: Result<LispexEvaluation, LispexAttemptError> = evaluate(rule, input, preset.evaluation)
    44. let evaluation: LispexEvaluation = test.assertOk(attempt)
    45. match (evaluation.settlement) {
    46. case Complete(output) => {
    47. let expected: Bytes = canonicalBytes(input)
    48. let actual: Bytes = canonicalBytes(output)
    49. io.writeLine("{actual.toHex() == expected.toHex()}")
    50. }
    51. case _ => io.writeLine("unexpected outcome")
    52. }
    53. return Ok(0)
    54. }
    Expected outputexit 0
    true
    
    $ topaz run main.tpz --locked · target product 5.21.3
    Expected result

    Expected result

    Execution completes. Exit code 0.

    Expected stdout
    1. true

    Run this source inside the verified Lispex application supplied through TOPAZ_LISPEX_APPLICATION. The example expects the Lispex 2.0 host contract.

    Source evidence

    Round trip exact values and isolate host mutations

    Link
    main.tpzRound trip exact values and isolate host mutationsOpen in Playground
    1. import std.bigint { BigInt }
    2. import std.bytes { Bytes }
    3. import std.io
    4. import std.test
    5. import std.lispex {
    6. LispexPackage, LispexBoundaryReport, LispexLimitPreset, LispexDatumView,
    7. LispexValue, LispexValueError, applicationPackage, defaultLimits,
    8. valueFromDatum, valueFromCanonical, valueView, canonicalBytes,
    9. }
    10. function conversionFailure(error: LispexValueError) -> string {
    11. return match (error) {
    12. case InvalidCanonicalValue(report) => report.code
    13. case InvalidDatum(report) => report.code
    14. case LimitExceeded(report) => report.code
    15. }
    16. }
    17. export function main(args: Array<string>, stdin: string) -> Result<int, string> {
    18. let packageResult: Result<LispexPackage, LispexBoundaryReport> = applicationPackage()
    19. let package: LispexPackage = test.assertOk(packageResult)
    20. let limits: LispexLimitPreset = defaultLimits()
    21. let numeratorResult: Option<BigInt> = BigInt.parse("2", 10)
    22. let denominatorResult: Option<BigInt> = BigInt.parse("4", 10)
    23. let zeroResult: Option<BigInt> = BigInt.parse("0", 10)
    24. let numerator: BigInt = test.assertSome(numeratorResult)
    25. let denominator: BigInt = test.assertSome(denominatorResult)
    26. let zero: BigInt = test.assertSome(zeroResult)
    27. let built: Result<LispexValue, LispexValueError> = valueFromDatum(package, LispexDatumView.Number(numerator, denominator), limits.host)
    28. let value: LispexValue = test.assertOk(built)
    29. let bytes: Bytes = canonicalBytes(value)
    30. let decoded: Result<LispexValue, LispexValueError> = valueFromCanonical(package, bytes, limits.host)
    31. let restored: LispexValue = test.assertOk(decoded)
    32. io.writeLine("{canonicalBytes(restored).toHex() == bytes.toHex()}")
    33. let viewed: Result<LispexDatumView, LispexValueError> = valueView(value, limits.host)
    34. let view: LispexDatumView = test.assertOk(viewed)
    35. match (view) {
    36. case Number(n, d) => io.writeLine("{n.toString(10)}/{d.toString(10)}")
    37. case _ => io.writeLine("unexpected view")
    38. }
    39. let mut items: Array<LispexValue> = [value]
    40. let vectorResult: Result<LispexValue, LispexValueError> = valueFromDatum(package, LispexDatumView.Vector(items), limits.host)
    41. let vector: LispexValue = test.assertOk(vectorResult)
    42. let emptyResult: Result<LispexValue, LispexValueError> = valueFromDatum(package, LispexDatumView.EmptyList(), limits.host)
    43. let empty: LispexValue = test.assertOk(emptyResult)
    44. items[0] = empty
    45. let vectorViewResult: Result<LispexDatumView, LispexValueError> = valueView(vector, limits.host)
    46. let vectorView: LispexDatumView = test.assertOk(vectorViewResult)
    47. match (vectorView) {
    48. case Vector(snapshot) => io.writeLine("{canonicalBytes(snapshot[0]).toHex() == bytes.toHex()}")
    49. case _ => io.writeLine("unexpected vector")
    50. }
    51. let invalid: Result<LispexValue, LispexValueError> = valueFromDatum(package, LispexDatumView.Number(numerator, zero), limits.host)
    52. match (invalid) {
    53. case Err(InvalidDatum(report)) => io.writeLine("{report.code != ""}")
    54. case _ => io.writeLine("unexpected conversion")
    55. }
    56. let otherKinds: Array<LispexDatumView> = [
    57. LispexDatumView.Character("a"),
    58. LispexDatumView.Symbol("rule"),
    59. LispexDatumView.Pair(value, empty),
    60. LispexDatumView.Bytevector("abc".encodeUtf8()),
    61. ]
    62. for datum in (otherKinds) {
    63. let convertedKind: Result<LispexValue, LispexValueError> = valueFromDatum(package, datum, limits.host)
    64. let kindValue: LispexValue = test.assertOk(convertedKind)
    65. let kindBytes: Bytes = canonicalBytes(kindValue)
    66. let decodedKind: Result<LispexValue, LispexValueError> = valueFromCanonical(package, kindBytes, limits.host)
    67. let kindCopy: LispexValue = test.assertOk(decodedKind)
    68. io.writeLine("{canonicalBytes(kindCopy).toHex() == kindBytes.toHex()}")
    69. }
    70. return Ok(0)
    71. }
    Expected outputexit 0
    true
    1/2
    true
    true
    true
    true
    true
    true
    
    $ topaz run main.tpz --locked · target product 5.21.3
    Expected result

    Expected result

    Execution completes. Exit code 0.

    Expected stdout
    1. true
    2. 1/2
    3. true
    4. true
    5. true
    6. true
    7. true
    8. true

    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

    Read structured reports without inventing outcomes

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

    Read structured reports without inventing outcomes

    LispexBoundaryReport identifies the phase, a stable code, named presentation fields and a human readable message. LispexReportField names and values explain the host failure. They are diagnostic presentation rather than canonical guest condition parameters.

    source is Some of the exact source identity when that identity has been established and None otherwise. verified lists identities actually validated before refusal. It cannot contain a proposed program or request identity merely because the input claimed one.

    A source reading or normalization failure before a canonical program exists uses a source bound report. It may identify a source location through named fields. It has no fabricated canonical program site or completed evaluation receipt.

    Admission rejects unsupported contracts, missing components, identity mismatches, ambient imports and an insufficient physical execution envelope. Its report identifies the first failed check and relevant supplied component. A mismatch never selects a substitute component or smaller limits.

    Host budget reports retain the submitted finite limits and first exhausted host axis in their fields. Host scheduling and physical failures describe an attempt rather than a deterministic guest resource result.

    Messages, field presentation order, paths and local coordinates do not define canonical outcome identity. Programs branch on the phase and code under the selected report contract. Reading report fields performs no I/O or guest execution.

    No report accessor raises a second Lispex failure. Array fields follow collection value semantics. Reading a report does not retry its failed operation, consume a guest budget or authorize an external action.

    Why

    A failed phase can establish some facts without completing the next phase. Keeping those verified facts separate from canonical outcomes prevents missing identities and host failures from becoming invented semantic evidence.

    Source evidence

    Read verified report facts without a guest outcome

    Link
    main.tpzRead verified report facts without a guest outcomeOpen in Playground
    1. import std.bytes { Bytes }
    2. import std.lispex {
    3. LispexBoundaryReport,
    4. LispexIdentity,
    5. }
    6. function reason(report: LispexBoundaryReport) -> string {
    7. let verified: Array<LispexIdentity> = report.verified
    8. match (report.source) {
    9. case Some(source) => { let identity: LispexIdentity = source }
    10. case None() => {}
    11. }
    12. for field in (report.fields) {
    13. let name: string = field.name
    14. let value: string = field.value
    15. }
    16. return report.code
    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

    Admit complete packages without ambient authority

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

    Admit complete packages without ambient authority

    std.lispex is the Topaz 6.0 host module. Importing it does not start a guest or grant guest capabilities. std.lispex.rules additionally requires the verified application lock that determines its generated names.

    LispexPackageInput contains the manifest, evaluator artifact, standard library artifact and every declared dependency as immutable bytes. Each LispexPackagePart pairs dependency bytes with an exact logical name declared by the manifest. Admission computes and verifies the identity promised for that name. Arrays and records at call entry follow collection value semantics.

    admitPackage requires complete finite LispexHostLimits. Validate the limit record before parsing artifacts. Reject negative or unrepresentable fields without beginning admission. No package handle is returned on refusal.

    Check manifest structure and declared identities before using a component. Verify evaluator interface and exports, standard library, ABI, codec, language semantics, Unicode semantics, selected profile and resource model. Every required component must be supplied exactly once and match its declared identity.

    Dependencies resolve from the supplied package closure. Reject missing or duplicate components, identity collisions and incompatible contracts. Do not consult the working directory, environment, network, host registry or another installed evaluator as a substitute.

    Evaluator artifacts must expose the selected data only interface. Reject host function imports and any dependency that obtains ambient authority. A callback advertised as pure is still a callback and is rejected. No import can turn a guest value into a host object reference.

    The host checks the physical envelope needed to honor the selected semantic limits and supported package contracts. Refuse an unsupported target or insufficient envelope before guest entry. Do not silently lower limits or retry another engine.

    Return Ok of an immutable LispexPackage after all checks succeed. The handle records the exact verified contract identities and closure. Refusal returns Err of LispexBoundaryReport. The checks may fail deterministically on supplied data or operationally on the physical host, but neither case is a canonical evaluation outcome.

    applicationPackage reads an already admitted handle associated with the current verified application lock. It performs no parsing, preparation, guest execution or discovery. Without such a handle it returns a no-application-package report. Startup admission has its own recorded finite host limits.

    The same package bytes, supported contract and finite budget produce the same validation decision unless the physical host cannot supply the declared envelope. Admission success alone proves neither issuer trust nor application permission to act.

    The package container, ABI bytes and identity encodings remain Lispex versioned contracts. A supported admitted version is required. This API does not assign 1.21 artifact formats to Lispex 2.0.

    Why

    Supplying the complete closure makes package admission an explicit host decision. A package handle preserves that decision without reopening discovery at every call. Inspecting a current application binding and admitting new bytes are different intentions.

    Source evidence

    Admit supplied package bytes with finite host limits

    Link
    main.tpzAdmit supplied package bytes with finite host limitsOpen in Playground
    1. import std.bytes { Bytes }
    2. import std.lispex {
    3. LispexPackageInput,
    4. LispexPackage,
    5. LispexBoundaryReport,
    6. LispexHostLimits,
    7. admitPackage,
    8. applicationPackage,
    9. }
    10. function admit(input: LispexPackageInput, limits: LispexHostLimits) -> Result<LispexPackage, LispexBoundaryReport> {
    11. return admitPackage(input, limits)
    12. }
    13. function current() -> Result<LispexPackage, LispexBoundaryReport> {
    14. return applicationPackage()
    15. }
    16. export function main(args: Array<string>, stdin: string) -> Result<int, string> {
    17. return Ok(0)
    18. }
    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

    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

    Inspect portable receipt artifacts without evaluation

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

    Inspect portable receipt artifacts without evaluation

    inspectConsumerArtifact accepts an admitted package, complete supplied bytes and finite host limits. Validate the limits before decoding. Parse one complete artifact under its declared supported 2.0 container and codec versions.

    Validate structure, integrity and supported semantic contracts. A portable receipt is required. Check that its complete request identity and canonical outcome agree with any included execution evidence and profile work binding. Reject trailing bytes, missing cores, inconsistent identities and unsupported versions.

    Return an inspection containing the admitted immutable artifact, its LispexReceipt and optional LispexExecutionEvidence. artifactBytes is the byte count of the entire accepted representation. portableCoreBytes is the byte count of its portable receipt representation.

    A missing execution evidence envelope is None. A validated signature envelope remains unauthenticated until authenticateEvidence accepts it under explicit trust. Structural inspection never sets an authenticated Boolean.

    Invalid structure, missing portable receipt or inconsistent binding returns InvalidConsumerArtifact. Unsupported contracts or components return Admission. Exhausted host work, allocation, frame or channel budgets return LimitExceeded. The first failed check is retained without exposing a partially accepted artifact.

    Inspection neither invokes the guest nor recreates a canonical outcome. It checks supplied records and cannot prove that a particular engine ran the program. Reproducing the recorded request is freshReplay and authenticating the issuer is authenticateEvidence.

    consumerArtifactBytes returns the exact immutable accepted or produced container. portableCoreBytes returns its portable receipt bytes. Both representations were established within the creating operation budget and are retained with the handle. Reading them performs no fresh encoding or I/O.

    The same supplied bytes, supported contract and finite limits produce the same structural inspection or deterministic refusal. Issuance and engine metadata can differ between containers while their portable receipt bytes remain equal.

    A 1.21 artifact remains a 1.21 record. Inspection does not relabel legacy hashes, settlements or receipt fields as 2.0 identities or outcomes.

    Why

    Byte decoding and artifact validation express one admission intention, so inspectConsumerArtifact performs both. Whole artifact bytes and portable receipt bytes serve different interchange purposes. Structural inspection, issuer authentication and semantic replay preserve their separate meanings.

    Source evidence

    Validate artifact bytes and read the portable core

    Link
    main.tpzValidate artifact bytes and read the portable coreOpen in Playground
    1. import std.bytes { Bytes }
    2. import std.lispex {
    3. LispexPackage,
    4. LispexHostLimits,
    5. LispexConsumerArtifactInspection,
    6. LispexEvidenceError,
    7. inspectConsumerArtifact,
    8. consumerArtifactBytes,
    9. portableCoreBytes,
    10. }
    11. function core(package: LispexPackage, bytes: Bytes, host: LispexHostLimits) -> Result<Bytes, LispexEvidenceError> {
    12. let result: Result<LispexConsumerArtifactInspection, LispexEvidenceError> = inspectConsumerArtifact(package, bytes, host)
    13. let inspection: LispexConsumerArtifactInspection = result?
    14. let original: Bytes = consumerArtifactBytes(inspection.artifact)
    15. let count: int = inspection.artifactBytes
    16. let coreCount: int = inspection.portableCoreBytes
    17. return Ok(portableCoreBytes(inspection.artifact))
    18. }
    19. function failure(error: LispexEvidenceError) -> string {
    20. return match (error) {
    21. case InvalidConsumerArtifact(report) => report.code
    22. case Admission(report) => report.code
    23. case Authentication(report) => report.code
    24. case LimitExceeded(report) => report.code
    25. }
    26. }
    27. export function main(args: Array<string>, stdin: string) -> Result<int, string> {
    28. return Ok(0)
    29. }
    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

    Authenticate evidence through explicit trust

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

    Authenticate evidence through explicit trust

    authenticateEvidence accepts an admitted LispexConsumerArtifact, explicit LispexTrustPolicy and complete finite host limits. The key, issuer and algorithm arrays follow collection value semantics at call entry, before verification.

    Each LispexTrustKey contains its key identifier, issuer, algorithm and immutable public key bytes. The policy lists the issuers and algorithms it accepts. Duplicate identifiers, malformed keys, unsupported algorithms and contradictory policy rows return Authentication with a structured report.

    A valid envelope must bind the artifact and its request, canonical outcome, execution evidence and declared profile work as required by its versioned signing contract. Use a matching caller supplied key whose issuer and algorithm the policy allows.

    An unsigned artifact, an unknown issuer, an untrusted key, a disallowed algorithm or an invalid signature returns Authentication. A lack of trust is not a language failure. Unsupported envelope contracts return Admission. Host budget exhaustion returns LimitExceeded.

    Return LispexAuthentication with the authenticated artifact identity, issuer, key identifier and algorithm. The value records this policy decision. It does not say that the guest program is correct or that the caller may perform an external action.

    No implicit system trust store, network key lookup, revocation request or live clock participates. If an application needs time or revocation policy, it evaluates explicit captured facts in a separate host decision. The signature contract and supported cryptography remain versioned upstream choices.

    Authentication performs no guest evaluation and does not change request identity, canonical outcome or replay eligibility. The same artifact, trust data, algorithm contract and limits produce the same authentication decision unless the physical host fails.

    Inspection establishes a structurally valid record. Authentication establishes the selected issuer binding. Replay compares the actual canonical outcome of the same request. A successful result from one operation does not imply success from either of the others.

    Why

    Trust in an issuer, structural validity and semantic reproducibility express different intentions. Explicit trust data prevents machine configuration from silently changing authentication and keeps authorization in the host application.

    Source evidence

    Authenticate a record with supplied verification keys

    Link
    main.tpzAuthenticate a record with supplied verification keysOpen in Playground
    1. import std.bytes { Bytes }
    2. import std.lispex {
    3. LispexConsumerArtifact,
    4. LispexTrustPolicy,
    5. LispexHostLimits,
    6. LispexAuthentication,
    7. LispexEvidenceError,
    8. authenticateEvidence,
    9. }
    10. function authenticate(artifact: LispexConsumerArtifact, trust: LispexTrustPolicy, host: LispexHostLimits) -> Result<LispexAuthentication, LispexEvidenceError> {
    11. return authenticateEvidence(artifact, trust, host)
    12. }
    13. export function main(args: Array<string>, stdin: string) -> Result<int, string> {
    14. return Ok(0)
    15. }
    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

    Read a completed evaluation and preserve its failure class

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

    Read a completed evaluation and preserve its failure class

    evaluate(rule, input, limits) returns Result<LispexEvaluation, LispexAttemptError>. It submits the immutable prepared program, one canonical input value, and the complete declared evaluation limits. It snapshots caller owned data before entry and performs no external action on behalf of the guest.

    Ok contains a completed evaluation even when the rule fails. LispexEvaluation.request records the verified semantic request and its identity. LispexEvaluation.settlement records the completed canonical outcome of that request. The result carries no successful value when its settlement is a failure.

    LispexSettlement.Complete(value) contains exactly one canonical LispexValue. A false Boolean or an application value named deny or review remains a successful language result. The adapter neither interprets that value as a host command nor performs an external action.

    LispexSettlement.SemanticFailure(condition) records an uncaught deterministic language or domain failure. The condition retains its stable phase, stable code, typed canonical parameters, and canonical failure site. Returning a procedure or multiple values across the single Datum result boundary cannot produce Complete.

    LispexSettlement.LimitExhaustion(condition) records a deterministic stop under the selected evaluation resource model and limits. Its condition identifies the first exhausted resource axis and canonical failure site. It preserves the first cause and returns no successful result prefix.

    A LispexCondition identifies a failure through its phase and stable code together. Its parameters retain their canonical types and values. Its site follows the selected canonical site contract. A resource condition also carries the exhausted axis required by that contract.

    Translated messages, source coordinates, host paths, and displayed stacks are diagnostic presentation. They do not replace condition parameters or alter the canonical settlement. A code or human message alone is insufficient to compare failures.

    LispexAttemptError.Admission(report) reports a refused submission. The report records the submitted request data and identities verified before refusal. Admission refusal produces neither a canonical evaluation outcome nor an evaluation receipt.

    LispexAttemptError.Interrupted(fault) reports a host interruption that prevented evaluation completion. Cancellation, a host deadline, or loss of host resources cannot be relabeled as a deterministic Lispex limit stop. The attempt supplies no canonical evaluation outcome or evaluation receipt.

    LispexAttemptError.EngineDefect(report) identifies an evaluator defect that prevented a conforming completed evaluation. It remains distinct from an admitted program's language failure. The attempt supplies no canonical evaluation outcome or evaluation receipt.

    A boundary report states its stage and stable reason with named presentation fields. It cites only identities already verified at that stage. It does not synthesize a canonical input, program identity, evaluation request identity, or failure site that validation has not established.

    A preparation read or normalization failure before canonical code exists produces a report bound to the exact submitted source. It stops before entry evaluation. Source locations in that report describe the supplied source and do not claim a canonical evaluation location.

    Canonical input decoding and canonical result or failure encoding remain evaluation work. A deterministic resource stop during those evaluation events is LimitExhaustion. Whether the guest entry was called does not by itself determine the outcome class.

    A lexical guest guard can recover from ordinary runtime and domain conditions under the Lispex condition contract. Preparation, admission, resource, operational, and internal failures remain outside guest recovery. Resource exhaustion runs no guest recovery or cleanup and preserves its first cause.

    Every call starts a fresh evaluation account. Reusing a prepared rule preserves its program while supplying an independent input and declared budget. An earlier value, failure, or host cache state cannot become hidden input to a later evaluation.

    A conforming execution of the same admitted semantic request produces the same Complete value or the same complete failure condition. The comparison includes the phase, code, typed parameters, canonical site, and resource axis when present. It excludes host execution observations.

    Deterministic language failures and evaluation resource stops remain eligible for portable receipts and exact replay. An outer attempt error does not become a receipt eligible settlement merely because its report is structured or reproducible.

    SemanticFailure carries resource as None(). LimitExhaustion carries Some of the first exhausted axis. Channel names identify the input, result or diagnostics channel declared by the selected versioned model. They are not locale dependent messages.

    Each evaluation performs the required guest and module initialization under its evaluation budget before the selected entry runs. A reused prepared handle contains no guest state from an earlier call. Preparation performs no guest computation.

    Validate the evaluation limit record and supported contract before entry. A canonical input whose codec or contract differs from the prepared rule produces Admission. A valid handle does not permit a caller to reinterpret its bytes under another codec.

    Why

    A caller must distinguish a completed rule decision from a request that never produced a canonical evaluation outcome. Typed conditions preserve the same meaning across products and presentation settings. Keeping admission and operational attempts outside LispexSettlement prevents a report from masquerading as a replayable rule result.

    Source evidence

    Return a language failure as an outcome

    Link
    main.tpzReturn a language failure as an outcomeOpen in Playground
    1. import std.bytes { Bytes }
    2. import std.io
    3. import std.test
    4. import std.lispex {
    5. LispexPackage,
    6. LispexBoundaryReport,
    7. LispexLimitPreset,
    8. LispexLimits,
    9. LispexSource,
    10. LispexSourceBundle,
    11. PreparedLispexRule,
    12. LispexPreparationError,
    13. LispexDatumView,
    14. LispexValue,
    15. LispexValueError,
    16. LispexEvaluation,
    17. LispexAttemptError,
    18. LispexSettlement,
    19. applicationPackage,
    20. defaultLimits,
    21. prepare,
    22. valueFromDatum,
    23. canonicalBytes,
    24. evaluate,
    25. }
    26. export function main(args: Array<string>, stdin: string) -> Result<int, string> {
    27. let packageResult: Result<LispexPackage, LispexBoundaryReport> = applicationPackage()
    28. let application: LispexPackage = test.assertOk(packageResult)
    29. let preset: LispexLimitPreset = defaultLimits()
    30. let source: LispexSource = LispexSource {
    31. name: "source.scm",
    32. bytes: "(define rule (lambda (input) (+ input 1)))\n".encodeUtf8(),
    33. }
    34. let bundle: LispexSourceBundle = LispexSourceBundle {
    35. entryModule: "source.scm",
    36. entryBinding: "rule",
    37. sources: [source],
    38. }
    39. let prepared: Result<PreparedLispexRule, LispexPreparationError> = prepare(application, bundle, preset.preparation)
    40. let rule: PreparedLispexRule = test.assertOk(prepared)
    41. let converted: Result<LispexValue, LispexValueError> = valueFromDatum(application, LispexDatumView.Boolean(true), preset.host)
    42. let input: LispexValue = test.assertOk(converted)
    43. let attempt: Result<LispexEvaluation, LispexAttemptError> = evaluate(rule, input, preset.evaluation)
    44. let evaluation: LispexEvaluation = test.assertOk(attempt)
    45. match (evaluation.settlement) {
    46. case SemanticFailure(_) => io.writeLine("language failure")
    47. case _ => io.writeLine("unexpected outcome")
    48. }
    49. return Ok(0)
    50. }
    Expected outputexit 0
    language failure
    
    $ topaz run main.tpz --locked · target product 5.21.3
    Expected result

    Expected result

    Execution completes. Exit code 0.

    Expected stdout
    1. language failure

    Run this source inside the verified Lispex application supplied through TOPAZ_LISPEX_APPLICATION. The example expects the Lispex 2.0 host contract.

    Source evidence

    Distinguish interrupted attempts from completed failures

    Link
    main.tpzDistinguish interrupted attempts from completed failuresOpen in Playground
    1. import std.lispex { LispexAttemptError, LispexOperationalFault, LispexSettlement, LispexResourceAxis }
    2. function attemptReason(error: LispexAttemptError) -> string {
    3. return match (error) {
    4. case Admission(report) => report.code
    5. case Interrupted(fault) => match (fault) {
    6. case Cancelled() => "cancelled"
    7. case DeadlineExceeded() => "deadline"
    8. case SafetyPreemption() => "physical safety"
    9. }
    10. case EngineDefect(report) => report.code
    11. }
    12. }
    13. function resource(outcome: LispexSettlement) -> Option<LispexResourceAxis> {
    14. return match (outcome) {
    15. case Complete(value) => None()
    16. case SemanticFailure(condition) => condition.resource
    17. case LimitExhaustion(condition) => condition.resource
    18. }
    19. }
    20. export function main(args: Array<string>, stdin: string) -> Result<int, string> {
    21. return Ok(0)
    22. }
    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.

    Check this source in the verified application fixture. Host interruption has no canonical settlement. A completed deterministic failure remains inside LispexEvaluation.

    Source evidence

    Identify source, programs, requests, artifacts, and profile work

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

    Identify source, programs, requests, artifacts, and profile work

    LispexIdentity is a typed immutable identity in a versioned domain. Its domain identifies the contract under which its value is interpreted. Equality compares the domain and the complete identity value under that contract. Matching display text from different domains does not establish identity equality.

    Source identity identifies the exact submitted source bytes under the source contract. A source edit can change that identity while leaving canonical program identity unchanged. Source identity remains available for failures that occur before a canonical program exists.

    Program identity identifies the canonical resolved program under its fixed dependencies. Canonicalization identifies one resolved form. It does not establish arbitrary program equivalence from equal values on one or more inputs.

    Artifact identity identifies the exact bytes of an engine artifact under its artifact domain. It remains distinct from source and program identity. Two admitted engine artifacts can execute the same semantic request and produce the same canonical outcome.

    LispexRequest.identity binds the complete evaluation request. That request fixes the canonical program, selected entry, input Datum, language and library semantics, Unicode semantics, resource model, and finite evaluation limits. Changing any semantic input creates a different request even when the result remains equal.

    The request records effective limits after preset selection and before evaluation. Equal final values under different declared limits do not make the requests identical. A host cannot change the limits and preserve the original request identity.

    Preparation and evaluation retain their own requests and budgets. Preparation reuse, a warm cache, and source presentation do not change the identity or charges of the admitted evaluation request. A preparation report does not stand in for an evaluation request.

    Product, engine, platform, host paths, cache state, source layout, and display settings are outside the identity of an admitted semantic evaluation request. Their observations belong to source provenance or execution evidence as applicable.

    Profile work identity binds the submitted request data, versioned profile work contract, and separate finite host budget. The profile work contract identifies the profile, schemas, required evidence, and host check rules. Changing that contract or host budget changes profile work identity without altering the base preparation or evaluation request.

    Admission and later qualification or evidence reports retain the profile work identity of their submission. Each report cites only semantic identities already verified at its stage. An early refusal cannot manufacture a canonical input or program identity to complete its report.

    Lispex 2.0 records use new identity domains. Historical Lispex 1.x records retain their original domains and meanings. Reading a historical record never promotes its identity or execution observations into Lispex 2.0 evidence.

    Canonical Lispex value equality preserves exact mathematical numbers and raw Unicode scalar sequences. Aggregates compare their canonical kinds and ordered elements. Procedures, host references, physical storage identity, and floating point coercion do not participate in canonical value equality.

    Canonical settlement equality compares the complete successful value or complete structured failure. It does not compare source formatting, diagnostic wording, engine selection, runtime counters, or evidence issuer. Identity equality and settlement equality answer different questions.

    Inspection returns identity data already verified for the inspected object. Reading those fields performs no guest evaluation, fresh replay, network discovery, or authority acquisition. A caller supplied label cannot replace validation of an artifact or package identity.

    Identity domain tags, digest algorithms, and serialized inputs follow their selected Lispex 2.0 contracts. The Topaz binding neither derives them from current Lispex 1.x encodings nor assigns hashes to contracts whose encoding remains unresolved.

    LispexSemanticContract.standardLibrary names the selected library semantic contract. It is distinct from the standard library artifact bytes checked during package admission. The additional host profile selector belongs to LispexProfileRequest and profile work identity rather than the base semantic request.

    LispexRuleIdentity.source is Some of the exact submitted source identity when source provenance was verified and None for a transported rule without verified source provenance. program identifies the canonical resolved code. artifact identifies the prepared artifact bytes returned by preparedBytes. contract names the verified semantic contracts. The evaluator artifact identity remains separate package and execution evidence.

    LispexIdentity and LispexCanonicalSite are sealed values. Callers can compare them but cannot construct a verified identity or site from arbitrary text. Record inspections expose detached values and never change the sealed rule, request or artifact.

    The opaque identity type exposes equality rather than a constructor from text. Each named field states its identity domain. A dependency submission uses a manifest name and raw bytes so admission can establish its identity without a caller forging a verified value.

    Why

    Source provenance, program meaning, submitted requests, engine bytes, and profile checks identify different objects. Equal results do not erase those distinct intents. Separate identities let callers change presentation or execution products while retaining the exact semantic request they intend to compare.

    Source evidence

    Repeat the same request and outcome

    Link
    main.tpzRepeat the same request and outcomeOpen in Playground
    1. import std.bytes { Bytes }
    2. import std.io
    3. import std.test
    4. import std.lispex {
    5. LispexPackage,
    6. LispexBoundaryReport,
    7. LispexLimitPreset,
    8. LispexLimits,
    9. LispexSource,
    10. LispexSourceBundle,
    11. PreparedLispexRule,
    12. LispexPreparationError,
    13. LispexDatumView,
    14. LispexValue,
    15. LispexValueError,
    16. LispexEvaluation,
    17. LispexAttemptError,
    18. LispexSettlement,
    19. LispexRuleIdentity,
    20. inspectRule,
    21. applicationPackage,
    22. defaultLimits,
    23. prepare,
    24. valueFromDatum,
    25. canonicalBytes,
    26. evaluate,
    27. }
    28. export function main(args: Array<string>, stdin: string) -> Result<int, string> {
    29. let packageResult: Result<LispexPackage, LispexBoundaryReport> = applicationPackage()
    30. let application: LispexPackage = test.assertOk(packageResult)
    31. let preset: LispexLimitPreset = defaultLimits()
    32. let source: LispexSource = LispexSource {
    33. name: "source.scm",
    34. bytes: "(define rule (lambda (input) input))\n".encodeUtf8(),
    35. }
    36. let bundle: LispexSourceBundle = LispexSourceBundle {
    37. entryModule: "source.scm",
    38. entryBinding: "rule",
    39. sources: [source],
    40. }
    41. let prepared: Result<PreparedLispexRule, LispexPreparationError> = prepare(application, bundle, preset.preparation)
    42. let rule: PreparedLispexRule = test.assertOk(prepared)
    43. let identity: LispexRuleIdentity = inspectRule(rule)
    44. let converted: Result<LispexValue, LispexValueError> = valueFromDatum(application, LispexDatumView.Boolean(true), preset.host)
    45. let input: LispexValue = test.assertOk(converted)
    46. let firstAttempt: Result<LispexEvaluation, LispexAttemptError> = evaluate(rule, input, preset.evaluation)
    47. let first: LispexEvaluation = test.assertOk(firstAttempt)
    48. let secondAttempt: Result<LispexEvaluation, LispexAttemptError> = evaluate(rule, input, preset.evaluation)
    49. let second: LispexEvaluation = test.assertOk(secondAttempt)
    50. io.writeLine("{first.request.identity == second.request.identity}")
    51. match (first.settlement) {
    52. case Complete(left) => {
    53. match (second.settlement) {
    54. case Complete(right) => {
    55. let leftBytes: Bytes = canonicalBytes(left)
    56. let rightBytes: Bytes = canonicalBytes(right)
    57. io.writeLine("{leftBytes.toHex() == rightBytes.toHex()}")
    58. }
    59. case _ => io.writeLine("unexpected second outcome")
    60. }
    61. }
    62. case _ => io.writeLine("unexpected first outcome")
    63. }
    64. io.writeLine("{first.request.program == identity.program}")
    65. return Ok(0)
    66. }
    Expected outputexit 0
    true
    true
    true
    
    $ topaz run main.tpz --locked · target product 5.21.3
    Expected result

    Expected result

    Execution completes. Exit code 0.

    Expected stdout
    1. true
    2. true
    3. true

    Run this source inside the verified Lispex application supplied through TOPAZ_LISPEX_APPLICATION. The example expects the Lispex 2.0 host contract.

    Source evidence

    Distinguish requests with equal returned values

    Link
    main.tpzDistinguish requests with equal returned valuesOpen in Playground
    1. import std.bytes { Bytes }
    2. import std.io
    3. import std.test
    4. import std.lispex {
    5. LispexPackage,
    6. LispexBoundaryReport,
    7. LispexLimitPreset,
    8. LispexLimits,
    9. LispexSource,
    10. LispexSourceBundle,
    11. PreparedLispexRule,
    12. LispexPreparationError,
    13. LispexDatumView,
    14. LispexValue,
    15. LispexValueError,
    16. LispexEvaluation,
    17. LispexAttemptError,
    18. LispexSettlement,
    19. applicationPackage,
    20. defaultLimits,
    21. prepare,
    22. valueFromDatum,
    23. canonicalBytes,
    24. evaluate,
    25. }
    26. export function main(args: Array<string>, stdin: string) -> Result<int, string> {
    27. let packageResult: Result<LispexPackage, LispexBoundaryReport> = applicationPackage()
    28. let application: LispexPackage = test.assertOk(packageResult)
    29. let preset: LispexLimitPreset = defaultLimits()
    30. let source: LispexSource = LispexSource {
    31. name: "source.scm",
    32. bytes: "(define rule (lambda (input) #t))\n".encodeUtf8(),
    33. }
    34. let bundle: LispexSourceBundle = LispexSourceBundle {
    35. entryModule: "source.scm",
    36. entryBinding: "rule",
    37. sources: [source],
    38. }
    39. let prepared: Result<PreparedLispexRule, LispexPreparationError> = prepare(application, bundle, preset.preparation)
    40. let rule: PreparedLispexRule = test.assertOk(prepared)
    41. let converted: Result<LispexValue, LispexValueError> = valueFromDatum(application, LispexDatumView.Boolean(true), preset.host)
    42. let input: LispexValue = test.assertOk(converted)
    43. let otherResult: Result<LispexValue, LispexValueError> = valueFromDatum(application, LispexDatumView.Boolean(false), preset.host)
    44. let otherInput: LispexValue = test.assertOk(otherResult)
    45. let firstAttempt: Result<LispexEvaluation, LispexAttemptError> = evaluate(rule, input, preset.evaluation)
    46. let first: LispexEvaluation = test.assertOk(firstAttempt)
    47. let secondAttempt: Result<LispexEvaluation, LispexAttemptError> = evaluate(rule, otherInput, preset.evaluation)
    48. let second: LispexEvaluation = test.assertOk(secondAttempt)
    49. io.writeLine("{first.request.identity == second.request.identity}")
    50. match (first.settlement) {
    51. case Complete(left) => {
    52. match (second.settlement) {
    53. case Complete(right) => {
    54. let leftBytes: Bytes = canonicalBytes(left)
    55. let rightBytes: Bytes = canonicalBytes(right)
    56. io.writeLine("{leftBytes.toHex() == rightBytes.toHex()}")
    57. }
    58. case _ => io.writeLine("unexpected second outcome")
    59. }
    60. }
    61. case _ => io.writeLine("unexpected first outcome")
    62. }
    63. return Ok(0)
    64. }
    Expected outputexit 0
    false
    true
    
    $ topaz run main.tpz --locked · target product 5.21.3
    Expected result

    Expected result

    Execution completes. Exit code 0.

    Expected stdout
    1. false
    2. true

    Run this source inside the verified Lispex application supplied through TOPAZ_LISPEX_APPLICATION. The example expects the Lispex 2.0 host contract.

    Source evidence

    Replay a complete request and compare the whole outcome

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

    Replay a complete request and compare the whole outcome

    freshReplay(rule, input, limits, artifact, hostLimits) returns Result<LispexEvaluation, LispexReplayError>. The prepared rule, canonical input, and complete evaluation limits supply the request to reproduce. The artifact supplies the retained portable receipt and any attached evidence. hostLimits bounds separate replay validation and comparison work.

    Replay first verifies that the required canonical program, selected entry, input, fixed semantics, resource model, and finite limits are available and supported. It reconstructs the candidate request under the recorded identity contract. It compares that request with the recorded request before guest evaluation.

    LispexReplayError.MissingRequest(report) identifies required request material that cannot be reconstructed or verified. No guest entry runs and no successful replay is reported. The adapter does not invent missing values, reuse current live facts, or substitute current defaults.

    LispexReplayError.RequestMismatch(report) reports a difference between the candidate and recorded semantic requests. Changed canonical input, program, semantics, model, or declared limits cause mismatch even when the program would return the same value. No guest entry runs after that mismatch is established.

    After the requests match and admission succeeds, replay performs a fresh evaluation with the supplied declared evaluation limits. It neither prepares a replacement program nor runs a modified request to obtain agreement. Prepared reuse and host cache state preserve the same normative evaluation events and charges.

    Replay compares the complete canonical settlements. A successful value must match the recorded value. A semantic failure must match its phase, code, typed parameters, and canonical site. A resource stop must additionally match the exhausted axis.

    Ok contains the fresh LispexEvaluation when the complete settlements agree. A reproduced SemanticFailure or LimitExhaustion is a successful replay comparison and remains that failure in the returned settlement. The adapter does not turn a reproduced failure into a Complete value.

    LispexReplayError.OutcomeMismatch(report, evaluation) records a completed fresh evaluation whose canonical settlement differs from the retained settlement. The error retains the fresh evaluation as typed data and the report identifies its difference from the recorded binding. Equal diagnostic messages or equal final values from different failure paths cannot suppress this error.

    LispexReplayError.AttemptFailed(error) preserves the admission, operational interruption, or engine defect returned by the fresh evaluation attempt. An incomplete attempt cannot be reported as either matching or different completed semantic outcomes.

    LispexReplayError.HostWorkRefused(report, observation) reports a host budget refusal during replay validation or comparison. The report records the failed stage. observation is None before a completed fresh evaluation exists and Some of that evaluation after completion. It does not imply that semantic comparison completed and never becomes guest LimitExhaustion.

    An admitted alternative engine artifact can replay the same semantic request. Engine bytes, source presentation, cache state, display locale, host paths, and execution timing do not enter canonical outcome comparison.

    Replay consumes captured input values. A changed live clock, exchange rate, random source, or host environment cannot alter the retained input. A caller that captures a new value submits a different semantic request.

    Replay does not authenticate an issuer, infer a trust policy, fetch keys, or authorize an external action. Attached evidence remains separately inspectable and authenticatable. Successful authentication does not bypass request reconstruction or settlement comparison.

    The concrete replay report and receipt encodings follow the selected versioned contracts. Missing or unsupported contract versions produce explicit failure. A historical record is compared only under its original supported meaning and is never silently rewritten into a Lispex 2.0 request.

    Why

    Replay asks whether a complete recorded request produces the same canonical outcome. Artifact inspection asks whether retained data is structurally valid, and authentication asks who signed it. Keeping these operations distinct preserves their different intents even when all three succeed for one artifact.

    Source evidence

    Replay the same input and declared limits

    Link
    main.tpzReplay the same input and declared limitsOpen in Playground
    1. import std.bytes { Bytes }
    2. import std.lispex {
    3. PreparedLispexRule,
    4. LispexValue,
    5. LispexLimits,
    6. LispexHostLimits,
    7. LispexConsumerArtifact,
    8. LispexEvaluation,
    9. LispexReplayError,
    10. freshReplay,
    11. }
    12. function reproduce(rule: PreparedLispexRule, input: LispexValue, limits: LispexLimits, artifact: LispexConsumerArtifact, host: LispexHostLimits) -> Result<LispexEvaluation, LispexReplayError> {
    13. return freshReplay(rule, input, limits, artifact, host)
    14. }
    15. function observation(error: LispexReplayError) -> Option<LispexEvaluation> {
    16. return match (error) {
    17. case OutcomeMismatch(report, evaluation) => Some(evaluation)
    18. case HostWorkRefused(report, observed) => observed
    19. case _ => None()
    20. }
    21. }
    22. export function main(args: Array<string>, stdin: string) -> Result<int, string> {
    23. return Ok(0)
    24. }
    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

    Keep portable receipts, profile work, and authentication distinct

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

    Keep portable receipts, profile work, and authentication distinct

    A portable receipt binds the complete semantic request identity to its completed canonical settlement. Complete values, deterministic SemanticFailure outcomes, and deterministic LimitExhaustion outcomes are eligible. Admission refusal, interrupted evaluation, and engine defect do not produce evaluation receipts.

    The portable receipt request identity binds the complete semantic request, including its resource model and declared finite limits. Retain LispexRequest separately when its decoded fields are needed to interpret or reconstruct the request. It excludes work_used, cache state, wall time, host paths, engine identity, and issuance details. Source provenance and execution observations attach separately.

    LispexConsumerArtifact is an immutable validated container for a portable receipt and optional execution evidence. The portable core records the semantic request and settlement. Attached execution evidence describes the product and engine artifact and binds that description to the same request and outcome.

    Issuer identity, issuance time, and signatures belong to a separate evidence envelope. Their presence does not change the portable receipt or canonical settlement. Optional absent evidence is represented as absent data rather than fabricated authentication success.

    evaluateWithEvidence(rule, input, limits, profile, hostLimits) returns Result<LispexEvidenceOutcome, LispexAttemptError>. It uses the same base request, guest evaluation events, and evaluation limits as evaluate. The LispexProfileRequest selects additional profile requirements and their versioned check contract.

    Additional profile admission, input schema checks, output qualification, and evidence work use hostLimits as one separate finite profile host budget. The budget is recorded with profile work identity. It never increases or reduces the preparation or evaluation budgets and cannot change the first guest language failure.

    Profile work identity binds the submitted request data, the versioned profile work contract, and the complete declared host budget. The contract fixes the profile, schemas, evidence requirements, and host checks. Reports preserve that identity across admission, qualification, and evidence stages.

    Input schema refusal or exhausted profile host budget before guest entry returns Admission with a boundary report. That report retains the refused submission and verified identities. It produces no canonical evaluation outcome or evaluation receipt.

    Canonical input decoding and canonical result or failure encoding remain evaluation work. They are not charged to the profile host budget. A narrower profile can require additional checks without changing the accepted request's canonical evaluation charges.

    After a Complete settlement, output qualification checks the returned Datum against the selected output schema. It preserves exact values and text and performs no coercion. A schema mismatch refuses the profile result while preserving the original Complete settlement. Qualification does not rerun the guest.

    A SemanticFailure or LimitExhaustion settlement remains that canonical failure during later host work. Evidence refusal cannot replace it with a business decision, a host budget resource stop, or a different language failure. The report retains the original failure class.

    LispexEvidenceOutcome.Portable(evidence) is returned when the required profile work completes and an artifact is available. LispexConsumerEvidence.request and settlement are the same verified request and canonical settlement produced by the base evaluation. Its artifact binds exactly those values.

    LispexEvidenceOutcome.Unrecorded(evaluation, report) preserves a completed LispexEvaluation when required qualification or evidence work refuses or cannot produce the artifact. The report identifies the profile work, stage, and reason. It preserves evaluation receipt eligibility without claiming that a receipt artifact exists.

    An outer Interrupted or EngineDefect error applies when a conforming evaluation did not complete. A later host failure in qualification or evidence work returns Unrecorded with the completed evaluation and its profile report. It does not discard a known canonical settlement.

    inspectConsumerArtifact(package, bytes, hostLimits) snapshots the supplied bytes and validates structure, integrity, supported contracts, request and outcome bindings, and any included execution evidence bindings. It returns an inspection containing the admitted artifact, portable receipt, and optional execution evidence. Invalid or incompatible bytes return a typed boundary or evidence failure.

    Artifact inspection uses the selected package and separate finite host limits. It performs no guest evaluation or fresh replay and does not fetch replacement components. It preserves the artifact's domain and never promotes a historical portable core to a new language contract.

    Artifact inspection does not authenticate the issuer or apply an unstated trust policy. A declared issuer, signature field, or binding to a receipt is descriptive data until the caller requests authentication under an explicit policy.

    authenticateEvidence(artifact, trust, hostLimits) returns Result<LispexAuthentication, LispexEvidenceError>. It validates the envelope against the exact signed request and outcome binding and the supplied LispexTrustPolicy. A successful result identifies the authenticated artifact, issuer, key and algorithm. The caller retains the explicit trust policy supplied for that decision.

    Absent required evidence, malformed envelopes, invalid signatures, mismatched bindings, unsupported signing contracts, rejected trust policy inputs, and exhausted authentication host limits return the applicable typed evidence failure. The operation preserves the admitted artifact and canonical outcome and performs no guest evaluation.

    Authentication uses the caller supplied policy and captured verification inputs. It performs no implicit key discovery, network retrieval, trust widening, or guest callback. Its result establishes authentication of that record under that policy and does not establish policy correctness or authorize a host action.

    Artifact and portable receipt serialization occur within the finite host work and result limits of the creating operation. Failure returns no artifact or successful byte prefix. consumerArtifactBytes and portableCoreBytes read retained immutable bytes without fresh serialization or another budget.

    Receipt, envelope, signature, identity, and profile report encodings remain owned by their selected Lispex 2.0 contracts. Topaz preserves their distinctions without assigning current Lispex 1.x bytes, hashing conventions, or observed usage counters to the new contract.

    LispexProfileRequest.profile and evidence are exact selectors from a supported admitted profile work contract. None() for a schema adds no caller supplied schema. Mandatory schemas from the selected profile still apply. Some(bytes) adds a schema constraint interpreted under that contract. Every mandatory profile constraint still applies, so both the profile and supplied schema must accept the value. Unknown selectors and malformed schemas refuse before guest entry.

    An early profile admission report includes the established profile work identity in LispexBoundaryReport.verified even when canonical program or input identities are not yet available. It never inserts a proposed identity as a verified fact.

    These APIs perform no implicit signing and read no hidden signing credentials. If the selected evidence contract requires an unavailable signature, evidence work refuses explicitly while preserving the completed evaluation. A host may supply an externally signed artifact to inspectConsumerArtifact and authenticateEvidence.

    Why

    A language result, a qualified application result, and an authenticated execution record serve different caller intents. Separate reports preserve the completed rule outcome when later host work refuses. A single artifact inspection operation avoids duplicate structural validation names while authentication and replay remain separate because they answer different questions.

    Source evidence

    Keep a completed outcome when evidence refuses

    Link
    main.tpzKeep a completed outcome when evidence refusesOpen in Playground
    1. import std.bytes { Bytes }
    2. import std.lispex {
    3. PreparedLispexRule,
    4. LispexValue,
    5. LispexLimits,
    6. LispexHostLimits,
    7. LispexProfileRequest,
    8. LispexEvidenceOutcome,
    9. LispexAttemptError,
    10. LispexSettlement,
    11. evaluateWithEvidence,
    12. consumerArtifactBytes,
    13. }
    14. function withEvidence(rule: PreparedLispexRule, input: LispexValue, limits: LispexLimits, profile: LispexProfileRequest, host: LispexHostLimits) -> Result<LispexEvidenceOutcome, LispexAttemptError> {
    15. return evaluateWithEvidence(rule, input, limits, profile, host)
    16. }
    17. function completed(outcome: LispexEvidenceOutcome) -> LispexSettlement {
    18. return match (outcome) {
    19. case Portable(evidence) => evidence.settlement
    20. case Unrecorded(evaluation, report) => evaluation.settlement
    21. }
    22. }
    23. function artifact(outcome: LispexEvidenceOutcome) -> Option<Bytes> {
    24. return match (outcome) {
    25. case Portable(evidence) => {
    26. let bytes: Bytes = consumerArtifactBytes(evidence.artifact)
    27. Some(bytes)
    28. }
    29. case Unrecorded(evaluation, report) => None()
    30. }
    31. }
    32. export function main(args: Array<string>, stdin: string) -> Result<int, string> {
    33. return Ok(0)
    34. }
    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

    Apply finite budgets in the declared resource order

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

    Apply finite budgets in the declared resource order

    LispexLimits contains the six named int fields work, logicalAllocation, semanticFrames, input, result, and diagnostics. LispexPreparationLimits and LispexHostLimits contain the same six named fields in their independent accounting domains. Every field is required and has no implicit unlimited form.

    Each limit is a nonnegative Topaz int within the selected contract's supported representation bounds. Zero is an explicit finite bound and is never replaced by a default. Negative values, overflow, missing required fields, and unknown fields are refused before the affected operation begins.

    The work field bounds cumulative normative computation. Native arithmetic, traversal, source processing, decoding, and encoding retain the charges assigned by their selected phase and contract. Host elapsed time and machine instruction counts do not replace work accounting.

    The logicalAllocation field bounds cumulative logical allocation, including intermediate values. Sharing, garbage collection, and returning from a call do not refund committed charges. Physical allocation behavior does not change a logical charge.

    The semanticFrames field bounds active semantic control state under the selected contract. A guest tail call replaces its current call frame. Nontail calls and active guard control consume their declared frames. Host stack layout does not redefine this budget.

    The input, result, and diagnostics fields bound their respective channels in units defined by the selected versioned contract. The field names do not promise byte units. Preparation and host operations apply the channel meanings declared by their own contracts.

    defaultLimits() returns LispexLimitPreset with preparation, evaluation, and host records. The preparation and evaluation records use the published common finite preset shared with Lispex 2.0 products. The host record uses the declared finite host work preset. The call returns complete values and performs no guest evaluation or discovery.

    A preset selection is resolved before admission and execution. The request records the effective declared evaluation limits. Copying a preset and changing one field creates an explicit new selection. No invalid field is repaired from a preset and no host silently reduces the selection.

    Preparation uses its own finite account for the closed source bundle. Evaluation starts a new account for the immutable prepared program and supplied input. Warm caches and reused preparation cannot move work into the evaluation account, increase its allowance, or change its normative charges.

    Package admission, value conversion, artifact inspection, replay validation, authentication and additional profile checks use the separate finite host account assigned to each operation. Transported prepared rule validation uses the explicit preparation account. Their host limits cannot serve as an unlimited fallback for guest work.

    Canonical input decoding and canonical result or failure encoding remain evaluation work. Additional profile schema and evidence checks remain host work. A host helper that validates or retains data in advance does not remove the evaluation's declared logical events or charges.

    At each atomic resource event, check work first, logicalAllocation next, semanticFrames next, and the applicable channel last. Skip axes the event does not require. An event reserves at most its declared semantic channel and work across several channels follows the contract's event sequence.

    Commit an event's charges and effect only after every required reservation succeeds. If one reservation fails, perform none of that event's effect or charges. Retain charges committed by earlier events. Releasing an active frame does not refund cumulative work or allocation.

    A reservation accepts a resulting charge equal to its limit. It rejects a resulting charge above the limit before the effect. Accounting uses checked exact arithmetic and cannot wrap or vary with host word size.

    Checks and reservations follow semantic event order. A later charge cannot hide an earlier domain failure. Work needed to reach or perform an earlier check can itself exhaust a budget before that check completes.

    Optimizations, inlining, native fast paths, and constant sharing preserve normative events and their first observable failure. They preserve the exhausted axis and canonical site for the same admitted semantic request. Equal aggregate usage totals alone do not establish this requirement.

    A result channel failure returns no successful result prefix. Diagnostic production obeys its finite channel budget, and terminal reporting uses the reserved emergency representation defined by the selected contract. Optional tracing cannot change the canonical outcome when its own capacity is exhausted.

    The host admits a request only when its physical envelope can support the selected logical limits. It refuses unsupported envelopes without lowering the request budget or choosing another engine. A later physical failure remains operational or defective execution and cannot be relabeled as deterministic guest exhaustion.

    A deterministic evaluation limit stop returns LimitExhaustion with the first exhausted axis and canonical site. A preparation resource stop remains a preparation failure report. An additional profile host budget refusal remains an admission or profile work report according to its stage.

    Host work after a completed evaluation preserves that evaluation when its own budget is exhausted. It can refuse qualification, evidence creation, validation, or authentication without replacing the guest settlement or changing the original evaluation request identity.

    Replaying a request uses the same resource model and complete evaluation limit record. A different declared limit record is a request mismatch even when the observed value would be unchanged. Host verification and comparison budgets remain separately identified.

    Tariff coefficients, logical allocation units, detailed frame charges, channel units, finite default numbers, emergency capacities, and physical envelope requirements come from their versioned Lispex 2.0 contracts. This binding does not infer them from Lispex 1.x counters or current public product observations.

    Missing and unknown named record fields are Topaz checking errors before a call is formed. A negative field or an unsupported representable value in a complete record causes the typed preflight refusal of the called operation. Neither path repairs the record or begins its phase.

    Why

    Complete named records make a resource request explicit and reproducible. Separate preparation, evaluation, and host budgets prevent cache behavior or extra profile checks from changing guest meaning. Ordered reservations and atomic effects ensure that every conforming product reports the same first semantic stop.

    Source evidence

    Complete with a resource failure at zero work

    Link
    main.tpzComplete with a resource failure at zero workOpen in Playground
    1. import std.bytes { Bytes }
    2. import std.io
    3. import std.test
    4. import std.lispex {
    5. LispexPackage,
    6. LispexBoundaryReport,
    7. LispexLimitPreset,
    8. LispexLimits,
    9. LispexSource,
    10. LispexSourceBundle,
    11. PreparedLispexRule,
    12. LispexPreparationError,
    13. LispexDatumView,
    14. LispexValue,
    15. LispexValueError,
    16. LispexEvaluation,
    17. LispexAttemptError,
    18. LispexSettlement,
    19. applicationPackage,
    20. defaultLimits,
    21. prepare,
    22. valueFromDatum,
    23. canonicalBytes,
    24. evaluate,
    25. }
    26. export function main(args: Array<string>, stdin: string) -> Result<int, string> {
    27. let packageResult: Result<LispexPackage, LispexBoundaryReport> = applicationPackage()
    28. let application: LispexPackage = test.assertOk(packageResult)
    29. let preset: LispexLimitPreset = defaultLimits()
    30. let source: LispexSource = LispexSource {
    31. name: "source.scm",
    32. bytes: "(define rule (lambda (input) (let loop () (loop))))\n".encodeUtf8(),
    33. }
    34. let bundle: LispexSourceBundle = LispexSourceBundle {
    35. entryModule: "source.scm",
    36. entryBinding: "rule",
    37. sources: [source],
    38. }
    39. let prepared: Result<PreparedLispexRule, LispexPreparationError> = prepare(application, bundle, preset.preparation)
    40. let rule: PreparedLispexRule = test.assertOk(prepared)
    41. let converted: Result<LispexValue, LispexValueError> = valueFromDatum(application, LispexDatumView.Boolean(true), preset.host)
    42. let input: LispexValue = test.assertOk(converted)
    43. let zeroWork: LispexLimits = LispexLimits {
    44. work: 0,
    45. logicalAllocation: preset.evaluation.logicalAllocation,
    46. semanticFrames: preset.evaluation.semanticFrames,
    47. input: preset.evaluation.input,
    48. result: preset.evaluation.result,
    49. diagnostics: preset.evaluation.diagnostics,
    50. }
    51. let attempt: Result<LispexEvaluation, LispexAttemptError> = evaluate(rule, input, zeroWork)
    52. let evaluation: LispexEvaluation = test.assertOk(attempt)
    53. match (evaluation.settlement) {
    54. case LimitExhaustion(_) => io.writeLine("resource failure")
    55. case _ => io.writeLine("unexpected outcome")
    56. }
    57. return Ok(0)
    58. }
    Expected outputexit 0
    resource failure
    
    $ topaz run main.tpz --locked · target product 5.21.3
    Expected result

    Expected result

    Execution completes. Exit code 0.

    Expected stdout
    1. resource failure

    Run this source inside the verified Lispex application supplied through TOPAZ_LISPEX_APPLICATION. The example expects the Lispex 2.0 host contract.

    Source evidence

    Menu

    Download