~/bend-docscommunity

ordinary_recovery_system.bend checks

raw source on the hub · import bendvy-ecs-core@0.1.0.6/ordinary_recovery_system.bend as Ordinary_recovery_system

8 imports
import Base
import ./world.bend as W
import ./system.bend as Sys
import ./transaction.bend as T
import ./owner_product.bend as Product
import ./ordinary_recovery_declaration.bend as D
import ./ordinary_recoverable_array_resource.bend as F
import ./recovery_journal.bend as Journal

Types

type Request source · line 11 · raw

@Args:Type -> @Capture:Type -> Type

Affine invocation input pairing caller Args with the retained capture. Admission refusal returns both through the registered request protocol.

type Reply source · line 15 · raw

@Capture:Type -> @Recovery:Type -> @Error:Data -> @Out:Type -> Type

Semantic outcome plus retained Out, capture and typed recovery receipts. Body errors stay inside Reply so transport success does not discard owners. Only explicitly journaled recoverable operations participate in restoration.

type Owner source · line 18 · raw

@Registry:Type -> @Capture:Type -> Type

Affine recoverable-system owner pairing actual Registry and capture. Metadata or a printable name cannot substitute for the live registration.

type Run source · line 23 · raw

@World:Type -> @Owner:Type -> @Args:Type -> @Error:Data -> @Out:Type -> @Recovery:Type -> Type

Completed retains World, owner, semantic outcome, Out and recovery. RegistrationRejected returns original Args and owner without running body. TransportFailed retains only World and is unreachable through the canonical closed runner, which returns semantic errors in Reply.

type Defined source · line 29 · raw

@World:Type -> @Owner:Type -> @Capture:Type -> Type

Defined returns World and registered capture owner; DefinitionRejected returns World and initial capture, without invoking the body.

Templates

template finished source · line 32 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Capture:Type -> @-Recovery:Type -> @-Ops:(@_:Type -> Type) -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-builder:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_recovery_declaration.Builder(0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery, Ops) -> @-declaration:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_recovery_declaration.Declaration<S, 0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery, Ops, builder> -> @-body:(@-H:Type -> @-caps:Ops(H) -> @_:Args -> @_:H -> Pair(H, Pair(0x14a72e1c180a5ab1f8a056d43822425c/transaction.Outcome<Error>, Out))) -> @outcome:0x14a72e1c180a5ab1f8a056d43822425c/transaction.Outcome<Error> -> @output:Out -> @result:Pair(0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery) -> 0x14a72e1c180a5ab1f8a056d43822425c/system.Outcome<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Unit, Reply<Capture, Recovery, Error, Out>>

template completing source · line 35 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Capture:Type -> @-Recovery:Type -> @-Ops:(@_:Type -> Type) -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-builder:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_recovery_declaration.Builder(0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery, Ops) -> @-declaration:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_recovery_declaration.Declaration<S, 0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery, Ops, builder> -> @-body:(@-H:Type -> @-caps:Ops(H) -> @_:Args -> @_:H -> Pair(H, Pair(0x14a72e1c180a5ab1f8a056d43822425c/transaction.Outcome<Error>, Out))) -> @state:0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture> -> @journal:List<&1, 0x14a72e1c180a5ab1f8a056d43822425c/recovery_journal.Action(0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery)> -> @result:Pair(0x14a72e1c180a5ab1f8a056d43822425c/transaction.Outcome<Error>, Out) -> 0x14a72e1c180a5ab1f8a056d43822425c/system.Outcome<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Unit, Reply<Capture, Recovery, Error, Out>>

template returned source · line 38 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Capture:Type -> @-Recovery:Type -> @-Ops:(@_:Type -> Type) -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-builder:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_recovery_declaration.Builder(0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery, Ops) -> @-declaration:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_recovery_declaration.Declaration<S, 0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery, Ops, builder> -> @-body:(@-H:Type -> @-caps:Ops(H) -> @_:Args -> @_:H -> Pair(H, Pair(0x14a72e1c180a5ab1f8a056d43822425c/transaction.Outcome<Error>, Out))) -> @result:Pair(0x14a72e1c180a5ab1f8a056d43822425c/ordinary_recoverable_array_resource.Frame<0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery>, Pair(0x14a72e1c180a5ab1f8a056d43822425c/transaction.Outcome<Error>, Out)) -> 0x14a72e1c180a5ab1f8a056d43822425c/system.Outcome<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Unit, Reply<Capture, Recovery, Error, Out>>

template runner source · line 45 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Capture:Type -> @-Recovery:Type -> @-Ops:(@_:Type -> Type) -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-builder:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_recovery_declaration.Builder(0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery, Ops) -> @-declaration:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_recovery_declaration.Declaration<S, 0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery, Ops, builder> -> @-body:(@-H:Type -> @-caps:Ops(H) -> @_:Args -> @_:H -> Pair(H, Pair(0x14a72e1c180a5ab1f8a056d43822425c/transaction.Outcome<Error>, Out))) -> @world:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E> -> @request:Request<Args, Capture> -> 0x14a72e1c180a5ab1f8a056d43822425c/system.Outcome<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Unit, Reply<Capture, Recovery, Error, Out>>

Advanced recoverable runner over World/capture product and shared journal. Canonical declared inverses determine commit/rollback receipts; arbitrary external effects or undeclared mutations are not made reversible. Returns outer Succeeded with semantic outcome and actual owners in Reply.

template Owned source · line 50 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Capture:Type -> @-Recovery:Type -> @-Ops:(@_:Type -> Type) -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-builder:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_recovery_declaration.Builder(0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery, Ops) -> @-declaration:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_recovery_declaration.Declaration<S, 0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery, Ops, builder> -> @-body:(@-H:Type -> @-caps:Ops(H) -> @_:Args -> @_:H -> Pair(H, Pair(0x14a72e1c180a5ab1f8a056d43822425c/transaction.Outcome<Error>, Out))) -> Type

Advanced type alias for the matching Registry/capture owner. Does not create a registration or validate a World by itself.

template registered source · line 51 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Capture:Type -> @-Recovery:Type -> @-Ops:(@_:Type -> Type) -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-builder:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_recovery_declaration.Builder(0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery, Ops) -> @-declaration:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_recovery_declaration.Declaration<S, 0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery, Ops, builder> -> @-body:(@-H:Type -> @-caps:Ops(H) -> @_:Args -> @_:H -> Pair(H, Pair(0x14a72e1c180a5ab1f8a056d43822425c/transaction.Outcome<Error>, Out))) -> @capture:Capture -> @result:0x14a72e1c180a5ab1f8a056d43822425c/system.RegistrationResult<S, C, R, E, Request<Args, Capture>, Unit, Reply<Capture, Recovery, Error, Out>, runner(S, C, R, E, Capture, Recovery, Ops, Args, Error, Out, builder, declaration, body)> -> Defined<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Owner<0x14a72e1c180a5ab1f8a056d43822425c/system.Registry<S, C, R, E, Request<Args, Capture>, Unit, Reply<Capture, Recovery, Error, Out>, runner(S, C, R, E, Capture, Recovery, Ops, Args, Error, Out, builder, declaration, body)>, Capture>, Capture>

template define source · line 59 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Capture:Type -> @-Recovery:Type -> @-Ops:(@_:Type -> Type) -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-builder:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_recovery_declaration.Builder(0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery, Ops) -> @-declaration:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_recovery_declaration.Declaration<S, 0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery, Ops, builder> -> @-body:(@-H:Type -> @-caps:Ops(H) -> @_:Args -> @_:H -> Pair(H, Pair(0x14a72e1c180a5ab1f8a056d43822425c/transaction.Outcome<Error>, Out))) -> @world:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E> -> @name:String -> @capture:Capture -> Defined<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Owner<0x14a72e1c180a5ab1f8a056d43822425c/system.Registry<S, C, R, E, Request<Args, Capture>, Unit, Reply<Capture, Recovery, Error, Out>, runner(S, C, R, E, Capture, Recovery, Ops, Args, Error, Out, builder, declaration, body)>, Capture>, Capture>

Register a recoverable body with access derived from its declaration. Consumes capture on success; definition refusal returns it with World. No body or inverse operation runs at registration. Contract and consumers: docs/parity/recovery.md.

template done source · line 63 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Capture:Type -> @-Recovery:Type -> @-Ops:(@_:Type -> Type) -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-builder:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_recovery_declaration.Builder(0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery, Ops) -> @-declaration:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_recovery_declaration.Declaration<S, 0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery, Ops, builder> -> @-body:(@-H:Type -> @-caps:Ops(H) -> @_:Args -> @_:H -> Pair(H, Pair(0x14a72e1c180a5ab1f8a056d43822425c/transaction.Outcome<Error>, Out))) -> @outcome:0x14a72e1c180a5ab1f8a056d43822425c/transaction.Outcome<Error> -> @output:Out -> @capture:Capture -> @recovery:Recovery -> @result:Pair(0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, 0x14a72e1c180a5ab1f8a056d43822425c/system.Registry<S, C, R, E, Request<Args, Capture>, Unit, Reply<Capture, Recovery, Error, Out>, runner(S, C, R, E, Capture, Recovery, Ops, Args, Error, Out, builder, declaration, body)>) -> Run<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Owner<0x14a72e1c180a5ab1f8a056d43822425c/system.Registry<S, C, R, E, Request<Args, Capture>, Unit, Reply<Capture, Recovery, Error, Out>, runner(S, C, R, E, Capture, Recovery, Ops, Args, Error, Out, builder, declaration, body)>, Capture>, Args, Error, Out, Recovery>

Completion retains the Registry already advanced to its captured run tick. Semantic failure still returns its explicit Reply and recovery owners.

template completed source · line 66 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Capture:Type -> @-Recovery:Type -> @-Ops:(@_:Type -> Type) -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-builder:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_recovery_declaration.Builder(0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery, Ops) -> @-declaration:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_recovery_declaration.Declaration<S, 0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery, Ops, builder> -> @-body:(@-H:Type -> @-caps:Ops(H) -> @_:Args -> @_:H -> Pair(H, Pair(0x14a72e1c180a5ab1f8a056d43822425c/transaction.Outcome<Error>, Out))) -> @result:0x14a72e1c180a5ab1f8a056d43822425c/system.RunResult<S, C, R, E, Request<Args, Capture>, Unit, Reply<Capture, Recovery, Error, Out>, runner(S, C, R, E, Capture, Recovery, Ops, Args, Error, Out, builder, declaration, body)> -> Run<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Owner<0x14a72e1c180a5ab1f8a056d43822425c/system.Registry<S, C, R, E, Request<Args, Capture>, Unit, Reply<Capture, Recovery, Error, Out>, runner(S, C, R, E, Capture, Recovery, Ops, Args, Error, Out, builder, declaration, body)>, Capture>, Args, Error, Out, Recovery>

template run source · line 77 · raw

@-S:Data -> @-C:Type -> @-R:Type -> @-E:Data -> @-Capture:Type -> @-Recovery:Type -> @-Ops:(@_:Type -> Type) -> @-Args:Type -> @-Error:Data -> @-Out:Type -> @-builder:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_recovery_declaration.Builder(0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery, Ops) -> @-declaration:0x14a72e1c180a5ab1f8a056d43822425c/ordinary_recovery_declaration.Declaration<S, 0x14a72e1c180a5ab1f8a056d43822425c/owner_product.Owner<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Capture>, Recovery, Ops, builder> -> @-body:(@-H:Type -> @-caps:Ops(H) -> @_:Args -> @_:H -> Pair(H, Pair(0x14a72e1c180a5ab1f8a056d43822425c/transaction.Outcome<Error>, Out))) -> @owner:Owner<0x14a72e1c180a5ab1f8a056d43822425c/system.Registry<S, C, R, E, Request<Args, Capture>, Unit, Reply<Capture, Recovery, Error, Out>, runner(S, C, R, E, Capture, Recovery, Ops, Args, Error, Out, builder, declaration, body)>, Capture> -> @world:0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E> -> @args:Args -> Run<0x14a72e1c180a5ab1f8a056d43822425c/world.World<S, C, R, E>, Owner<0x14a72e1c180a5ab1f8a056d43822425c/system.Registry<S, C, R, E, Request<Args, Capture>, Unit, Reply<Capture, Recovery, Error, Out>, runner(S, C, R, E, Capture, Recovery, Ops, Args, Error, Out, builder, declaration, body)>, Capture>, Args, Error, Out, Recovery>

Validate registration and execute with retained capture and affine Args. Admission refusal returns original owners/Args. Completed returns semantic outcome, Out and typed recovery on both body success and failure; inspect outcome instead of assuming outer transport means commit. Every admitted completion consumes its captured lifecycle tick, including semantic failure; recovery ownership remains in Reply.