1 import Base 2 import ./ordinary_app_execution_recipe.bend as Exec 3 import ./ordinary_app_execution_run.bend as ExecuteRun 4 import ./execution_context.bend as Ctx 5 import ./trace_facts.bend as Facts 6 import ./schedule.bend as Sch 7 import ./captured_schedule_composition.bend as Choice 8 import ./ordinary_app_composer.bend as Build 9 import ./ordinary_app_recipe.bend as Tree 10 import ./ordinary_app_records.bend as Leaf 11 import ./world.bend as W 12 import ./system.bend as Sys 13 import ./schedule_provision.bend as SP 14 import ./ordinary_service_declaration.bend as D 15 import ./ordinary_app_registration_fields.bend as Records 16 import ./ordinary_app_observation_data.bend as DTO 17 # Native service declaration remains operational; no query mode is fabricated. 18 # Affine registered service owner retaining its actual registry and setup. 19 # The service payload itself stays in World resources, not copied into metadata. 20 type Owner Rest & D.Slot,-put:Rest -> D.Slot -> R,-call:Payload -> Payload,-declaration:D.Declaration,-scan:W.World -> W.World & List<&2,D.Status>> is Type: 21 Owner{registry:Sys.Registry,setup:D.Setup} 22 # Detached provided statuses and declaration-derived required service ids. 23 type View is Data: 24 View{provided:List<&2,D.Status>,required:List<&2,SP.Requirement>} 25 # Advanced owner-returning registration fold deriving ServiceKind metadata from 26 # actual registry and declaration; this does not grant query gameplay operations. 27 def fields(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,owner:Owner) -> Owner & List<&2,Records.Fields>: 28 match owner: 29 case Owner{Sys.Registry{+namespace,+id,+name,+access,+cursor},setup}:(Owner{Sys.Registry{namespace,id,name,access,cursor},setup},[Records.Fields{namespace,id,name,access,cursor,D.key(~S,~R,~Payload,~Rest,~take,~put,~call,declaration),[],Records.ServiceKind{}}]) 30 # Project this declaration's service requirement for execution preflight. 31 def required(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>) -> SP.Requirement: 32 D.requirement(~S,~R,~Payload,~Rest,~take,~put,~call,declaration) 33 def provided_text(~S:Data,value:D.Status) -> String: 34 match value: 35 case D.Status{id,key,ready}:key ++ ":" ++ U32.show(id) ++ ":" ++ Bool.show(ready) 36 def requirement_text(~S:Data,value:SP.Requirement) -> String: 37 match value: 38 case SP.Service{id}:"Service:" ++ U32.show(id) 39 case SP.Resource{id}:"Resource:" ++ U32.show(id) 40 case SP.Component{id}:"Component:" ++ U32.show(id) 41 def observed(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,result:W.World & List<&2,D.Status>) -> W.World & DTO.Observation>: 42 match result: 43 case (world,+provided):(world,DTO.Observation{View{provided,[required(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)]},["services=" ++ List.show(&2,D.Status,provided_text(~S),provided),"requires=" ++ requirement_text(~S,required(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan))]}) 44 # Advanced service observer scanning statuses, returning actual World with View 45 # and presentation text. Does not invoke the service; composer debug gating decides 46 # whether observation runs. 47 def observe(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,world:W.World) -> W.World & DTO.Observation>: 48 observed(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,scan(world)) 49 def dispatched(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,setup:D.Setup,result:Sys.RunResult) -> Owner & Sys.Outcome,Unit,Unit>: 50 match result: 51 case Sys.Completed{registry,outcome}:(Owner{registry,setup},outcome) 52 case Sys.RegistrationRejected{registry,world,_}:(Owner{registry,setup},Sys.Failed{world,Unit{}}) 53 # Invoke tracked registration and return Owner plus actual World outcome. This 54 # low-level entry does not perform schedule service-availability preflight; the 55 # declaration runner is a successful no-op for Missing. No host-effect rollback. 56 def run(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,owner:Owner,world:W.World) -> Owner & Sys.Outcome,Unit,Unit>: 57 match owner: 58 case Owner{registry,setup}:dispatched(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,setup,Sys.run(~S,~C,~R,~E,~Unit,~Unit,~Unit,~D.runner(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration),registry,world,Unit{})) 59 # Composer App type with this service owner and combined prior/service observations. 60 # This type adds service registration metadata, not a fabricated component query. 61 def Application(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,~Owners:Type,~Rows:Data,~prior:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>) -> Type: 62 Build.Registered,Owners & Owner,DTO.Product>,Tree.observe_pair(~W.World,~Rows,~View,~prior,~observe(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)),Leaf.fold_pair(~S,~Owners,~Owner,~fold,~fields(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan))> 63 def defined(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,~Owners:Type,~Rows:Data,~prior:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~Output:Type,done:Build.Registered,Owners & Owner,DTO.Product>,Tree.observe_pair(~W.World,~Rows,~View,~prior,~observe(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)),Leaf.fold_pair(~S,~Owners,~Owner,~fold,~fields(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan))> -> Output,failed:Build.Registered,Owners,Rows,prior,fold> -> Output,setup:D.Setup,owners:Owners,recipe:Tree.Recipe,Rows,prior>,debug:Bool,result:Sys.RegistrationResult) -> Output: 64 match result: 65 case Sys.RegistrationFailed{world}:failed(Build.Registered{world,owners,recipe,debug}) 66 case Sys.Registered{world,registry}:done(Build.appended(~S,~W.World,~Owners,~Rows,~prior,~fold,~Owner,~View,~observe(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan),~fields(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan),world,owners,Owner{registry,setup},debug)) 67 # Register service onto the composer App. done receives extended actual owners; 68 # failed receives the prior App shape and returned World on registration refusal. 69 # Does not call the service; callbacks choose a common Output ownership contract. 70 def install(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,~Owners:Type,~Rows:Data,~prior:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~Output:Type,done:Build.Registered,Owners & Owner,DTO.Product>,Tree.observe_pair(~W.World,~Rows,~View,~prior,~observe(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)),Leaf.fold_pair(~S,~Owners,~Owner,~fold,~fields(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan))> -> Output,failed:Build.Registered,Owners,Rows,prior,fold> -> Output,setup:D.Setup,name:String,app:Build.Registered,Owners,Rows,prior,fold>) -> Output: 71 match app: 72 case Build.Registered{world,owners,recipe,debug}:defined(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,~Owners,~Rows,~prior,~fold,~Output,done,failed,setup,owners,recipe,debug,D.define(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,world,name)) 73 74 # Advanced owner-returning plan: this registry id at condition slot zero with 75 # the declaration's service requirement. Does not invoke P or derive a query grant. 76 def execution_plan(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,owner:Owner) -> Owner & SP.Plan: 77 match owner: 78 case Owner{Sys.Registry{+namespace,+id,+name,+access,+cursor},setup}:(Owner{Sys.Registry{namespace,id,name,access,cursor},setup},SP.Entry{Sch.System{id,0},[required(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)]}) 79 def execution_returned(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,trace:Facts.State,result:Owner & Sys.Outcome,Unit,Unit>) -> Owner & Sys.Outcome>,Unit,Unit>: 80 match result: 81 case (owner,outcome):(owner,ExecuteRun.outcome(~W.World,~Unit,~Unit,trace,outcome)) 82 def execution_allowed(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,allowed:Bool,owner:Owner,context:Ctx.Context>,id:U32) -> Owner & Sys.Outcome>,Unit,Unit>: 83 match allowed context: 84 case False{} context:(owner,Sys.Failed{context,Unit{}}) 85 case True{} Ctx.Context{world,trace}:execution_returned(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,trace,run(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,owner,world)) 86 # Advanced dispatch entry: an unmatched id returns Owner/context with Failed(Unit) 87 # without calling P. Matched routing invokes tracked run; schedule provisioning 88 # performs availability checks separately. 89 def execution_run(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,owner:Owner,context:Ctx.Context>,id:U32) -> Owner & Sys.Outcome>,Unit,Unit>: 90 match owner: 91 case Owner{Sys.Registry{namespace,+actual,name,access,cursor},setup}: 92 +selected=id 93 execution_allowed(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,U32.is_eq(selected,actual),Owner{Sys.Registry{namespace,actual,name,access,cursor},setup},context,selected) 94 # Advanced execution-enabled App type composing prior plan/dispatch/provision 95 # with this service. Actual owners are retained; errors distinguish prior/service. 96 def Executable(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,~Owners:Type,~Rows:Data,~prior:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>) -> Type: 97 Exec.Registered,Owners & Owner,DTO.Product>,Tree.observe_pair(~W.World,~Rows,~View,~prior,~observe(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)),Leaf.fold_pair(~S,~Owners,~Owner,~fold,~fields(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)),Choice.Choice,Exec.plan_pair(~S,~Owners,~Owner,~priorPlan,~execution_plan(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)),Exec.dispatch_pair(~S,~W.World,~Owners,~Owner,~PriorError,~Unit,~fold,~priorDispatch,~execution_run(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)),Exec.provision_pair(~S,~W.World,~priorProvide,~D.provision(~S,~C,~R,~E,~scan))> 98 def execution_added(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,~Owners:Type,~Rows:Data,~prior:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>,~Output:Type,done:Executable(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,~Owners,~Rows,~prior,~fold,~PriorError,~priorPlan,~priorDispatch,~priorProvide) -> Output,app:Application(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,~Owners,~Rows,~prior,~fold)) -> Output: 99 done(Exec.Registered{app,Exec.Recipe{}}) 100 def execution_rejected(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,~Owners:Type,~Rows:Data,~prior:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>,~Output:Type,failed:Exec.Registered,Owners,Rows,prior,fold,PriorError,priorPlan,priorDispatch,priorProvide> -> Output,app:Build.Registered,Owners,Rows,prior,fold>) -> Output: 101 failed(Exec.Registered{app,Exec.Recipe{}}) 102 # Add service registration to an execution-enabled App, composing its plan and 103 # provisioning. done receives the extended App; failed receives the previous App 104 # shape on refusal. Does not run the service or make host effects transactional. 105 def add(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,~Owners:Type,~Rows:Data,~prior:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>,~Output:Type,done:Executable(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,~Owners,~Rows,~prior,~fold,~PriorError,~priorPlan,~priorDispatch,~priorProvide) -> Output,failed:Exec.Registered,Owners,Rows,prior,fold,PriorError,priorPlan,priorDispatch,priorProvide> -> Output,setup:D.Setup,name:String,value:Exec.Registered,Owners,Rows,prior,fold,PriorError,priorPlan,priorDispatch,priorProvide>) -> Output: 106 match value: 107 case Exec.Registered{app,_}:install(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,~Owners,~Rows,~prior,~fold,~Output,execution_added(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,~Owners,~Rows,~prior,~fold,~PriorError,~priorPlan,~priorDispatch,~priorProvide,~Output,done),execution_rejected(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan,~Owners,~Rows,~prior,~fold,~PriorError,~priorPlan,~priorDispatch,~priorProvide,~Output,failed),setup,name,app) 108 # Advanced type projection of prior and actual service registration owners. 109 def execution_owners(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,~Owners:Type,~Rows:Data,~prior:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>) -> Type: 110 Owners & Owner 111 # Advanced detached row shape pairing prior observations with service View. 112 def execution_rows(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,~Owners:Type,~Rows:Data,~prior:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>) -> Data: 113 DTO.Product> 114 # Advanced closed observer composition: prior then service statuses, threading World. 115 def execution_observe(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,~Owners:Type,~Rows:Data,~prior:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>) -> W.World -> W.World & DTO.Observation>>: 116 Tree.observe_pair(~W.World,~Rows,~View,~prior,~observe(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)) 117 # Advanced closed owner fold: prior fields then service metadata, retaining owners. 118 def execution_fold(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,~Owners:Type,~Rows:Data,~prior:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>) -> (Owners & Owner) -> (Owners & Owner) & List<&2,Records.Fields>: 119 Leaf.fold_pair(~S,~Owners,~Owner,~fold,~fields(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)) 120 # Advanced closed plan composition retaining actual prior/service owners in order. 121 def composed_plan(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,~Owners:Type,~Rows:Data,~prior:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>) -> (Owners & Owner) -> (Owners & Owner) & SP.Plan: 122 Exec.plan_pair(~S,~Owners,~Owner,~priorPlan,~execution_plan(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)) 123 # Advanced closed routing composition; selects prior or service runner by retained 124 # registration metadata, preserving both owners and tagging the failure branch. 125 def execution_dispatch(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,~Owners:Type,~Rows:Data,~prior:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>) -> (Owners & Owner) -> Ctx.Context> -> U32 -> (Owners & Owner) & Sys.Outcome>,Choice.Choice,Unit>: 126 Exec.dispatch_pair(~S,~W.World,~Owners,~Owner,~PriorError,~Unit,~fold,~priorDispatch,~execution_run(~S,~C,~R,~E,~Payload,~Rest,~take,~put,~call,~declaration,~scan)) 127 # Advanced closed availability composition, prior then service scan; no host call. 128 # For an ordinary consumer see failedtxn-motion64/consumer/motion-schedule.bend 129 # under test-fixtures/connected-performance. 130 def execution_provide(~S:Data,~C:Type,~R:Type,~E:Data,~Payload:Type,~Rest:Type,~take:R -> Rest & D.Slot,~put:Rest -> D.Slot -> R,~call:Payload -> Payload,~declaration:D.Declaration,~scan:W.World -> W.World & List<&2,D.Status>,~Owners:Type,~Rows:Data,~prior:W.World -> W.World & DTO.Observation,~fold:Owners -> Owners & List<&2,Records.Fields>,~PriorError:Data,~priorPlan:Owners -> Owners & SP.Plan,~priorDispatch:Owners -> Ctx.Context> -> U32 -> Owners & Sys.Outcome>,PriorError,Unit>,~priorProvide:W.World -> W.World & List<&2,SP.Requirement>) -> W.World -> W.World & List<&2,SP.Requirement>: 131 Exec.provision_pair(~S,~W.World,~priorProvide,~D.provision(~S,~C,~R,~E,~scan))