ordinary_machine_handler_bundle_context.bend source
ordinary_machine_handler_bundle_context.bend on the hub · documented module
import Baseimport ./machine_handler_phases.bend as Phaseimport ./machine_handler_phases_context.bend as PhaseContextimport ./execution_context.bend as Ctximport ./trace_facts.bend as Factsimport ./world.bend as Wimport ./system.bend as Sysimport ./machine.bend as Mimport ./machine_handlers.bend as Himport ./machine_handler_bundle.bend as Bimport ./schedule.bend as Schimport ./ordinary_machine_schedule.bend as Ordinary# Bundle preflight precedes ordinary barrier; selected registry owners recover authored order.type Owners<S:Data,K:Data,V:Data,Q:Data,C:Type,R:Type,E:Data,-runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>> is Type: Pending{entries:List<&1,B.Scheduled<S,K,V,Q,C,R,E,runner>>,trace:Facts.State} Unavailable{entries:List<&1,B.Scheduled<S,K,V,Q,C,R,E,runner>>,trace:Facts.State} Selected{positions:List<&2,B.Position<S,K,V,Q>>,kept:List<&1,H.Entry<S,C,R,E,V,runner>>,active:Phase.Owners<S,K,V,C,R,E,runner>,phase:H.Phase,trace:Facts.State}type MarkerResult<S:Data,K:Data,V:Data,Q:Data,C:Type,R:Type,E:Data,-runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>> is Type: MarkerResult{result:B.BundleResult<S,K,V,Q,C,R,E,runner>,steps:List<&2,Sch.Step>,observations:List<&2,Sch.Observation>,trace:Facts.State}def unchanged(~S:Data,~C:Type,~R:Type,~E:Data,world:W.World<S,C,R,E>) -> W.World<S,C,R,E>:worlddef phase_returned(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,~observed:Facts.State -> W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit> & Facts.State,~name:String,~take:W.World<S,C,R,E> -> W.World<S,C,R,E> & M.Slot<S,K,V>,~put:W.World<S,C,R,E> -> M.Slot<S,K,V> -> W.World<S,C,R,E>,~publish:W.World<S,C,R,E> -> M.Transition<V> -> W.World<S,C,R,E>,~same:V -> V -> Bool,~requirement_same:Q -> Q -> Bool,~has:W.World<S,C,R,E> -> Q -> W.World<S,C,R,E> & Bool,~frame:W.World<S,C,R,E> -> W.World<S,C,R,E>,positions:List<&2,B.Position<S,K,V,Q>>,kept:List<&1,H.Entry<S,C,R,E,V,runner>>,phase:H.Phase,result:Phase.Owners<S,K,V,C,R,E,runner> & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,String,Unit>) -> Owners<S,K,V,Q,C,R,E,runner> & Sys.Outcome<W.World<S,C,R,E>,String,Unit>: match result: case (active,Sys.Succeeded{Ctx.Context{world,trace},output}):(Selected{positions,kept,active,phase,trace},Sys.Succeeded{world,output}) case (active,Sys.Failed{Ctx.Context{world,trace},error}):(Selected{positions,kept,active,phase,trace},Sys.Failed{world,error})def applied(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,~observed:Facts.State -> W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit> & Facts.State,~name:String,~take:W.World<S,C,R,E> -> W.World<S,C,R,E> & M.Slot<S,K,V>,~put:W.World<S,C,R,E> -> M.Slot<S,K,V> -> W.World<S,C,R,E>,~publish:W.World<S,C,R,E> -> M.Transition<V> -> W.World<S,C,R,E>,~same:V -> V -> Bool,~requirement_same:Q -> Q -> Bool,~has:W.World<S,C,R,E> -> Q -> W.World<S,C,R,E> & Bool,~frame:W.World<S,C,R,E> -> W.World<S,C,R,E>,positions:List<&2,B.Position<S,K,V,Q>>,kept:List<&1,H.Entry<S,C,R,E,V,runner>>,result:Phase.Owners<S,K,V,C,R,E,runner> & Sys.Outcome<Ctx.Context<W.World<S,C,R,E>>,String,Unit>) -> Owners<S,K,V,Q,C,R,E,runner> & Sys.Outcome<W.World<S,C,R,E>,String,Unit>: phase_returned(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame,positions,kept,H.BendvyExit{},result)def selected(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,~observed:Facts.State -> W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit> & Facts.State,~name:String,~take:W.World<S,C,R,E> -> W.World<S,C,R,E> & M.Slot<S,K,V>,~put:W.World<S,C,R,E> -> M.Slot<S,K,V> -> W.World<S,C,R,E>,~publish:W.World<S,C,R,E> -> M.Transition<V> -> W.World<S,C,R,E>,~same:V -> V -> Bool,~requirement_same:Q -> Q -> Bool,~has:W.World<S,C,R,E> -> Q -> W.World<S,C,R,E> & Bool,~frame:W.World<S,C,R,E> -> W.World<S,C,R,E>,world:W.World<S,C,R,E>,partition:B.Partition<S,K,V,Q,C,R,E,runner>,trace:Facts.State) -> Owners<S,K,V,Q,C,R,E,runner> & Sys.Outcome<W.World<S,C,R,E>,String,Unit>: match partition: case B.Partition{positions,kept,handlers}:applied(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame,positions,kept,PhaseContext.apply(~S,~K,~V,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~unchanged(~S,~C,~R,~E),Phase.Owners{handlers,Phase.Idle{}},Ctx.Context{world,trace}))def targeted(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,~observed:Facts.State -> W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit> & Facts.State,~name:String,~take:W.World<S,C,R,E> -> W.World<S,C,R,E> & M.Slot<S,K,V>,~put:W.World<S,C,R,E> -> M.Slot<S,K,V> -> W.World<S,C,R,E>,~publish:W.World<S,C,R,E> -> M.Transition<V> -> W.World<S,C,R,E>,~same:V -> V -> Bool,~requirement_same:Q -> Q -> Bool,~has:W.World<S,C,R,E> -> Q -> W.World<S,C,R,E> & Bool,~frame:W.World<S,C,R,E> -> W.World<S,C,R,E>,entries:List<&1,B.Scheduled<S,K,V,Q,C,R,E,runner>>,pair:W.World<S,C,R,E> & M.Slot<S,K,V>,trace:Facts.State) -> Owners<S,K,V,Q,C,R,E,runner> & Sys.Outcome<W.World<S,C,R,E>,String,Unit>: match pair: case (world,M.Missing{}):(Unavailable{entries,trace},Sys.Succeeded{put(world,M.Missing{}),Unit{}}) case (world,M.Present{current,M.NoPending{},previous,_}):(Pending{entries,trace},Sys.Succeeded{put(world,M.Present{current,M.NoPending{},previous,False{}}),Unit{}}) case (world,M.Present{+current,M.Queued{+to,+skip},previous,changed}):selected(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame,put(world,M.Present{current,M.Queued{to,skip},previous,changed}),B.partition(~S,~K,~V,~Q,~C,~R,~E,~runner,~same,entries,current,to),trace)def apply(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,~observed:Facts.State -> W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit> & Facts.State,~name:String,~take:W.World<S,C,R,E> -> W.World<S,C,R,E> & M.Slot<S,K,V>,~put:W.World<S,C,R,E> -> M.Slot<S,K,V> -> W.World<S,C,R,E>,~publish:W.World<S,C,R,E> -> M.Transition<V> -> W.World<S,C,R,E>,~same:V -> V -> Bool,~requirement_same:Q -> Q -> Bool,~has:W.World<S,C,R,E> -> Q -> W.World<S,C,R,E> & Bool,~frame:W.World<S,C,R,E> -> W.World<S,C,R,E>,owners:Owners<S,K,V,Q,C,R,E,runner>,world:W.World<S,C,R,E>) -> Owners<S,K,V,Q,C,R,E,runner> & Sys.Outcome<W.World<S,C,R,E>,String,Unit>: match owners: case Pending{entries,trace}:targeted(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame,entries,take(frame(world)),trace) case owners:(owners,Sys.Succeeded{world,Unit{}})def exit(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,~observed:Facts.State -> W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit> & Facts.State,~name:String,~take:W.World<S,C,R,E> -> W.World<S,C,R,E> & M.Slot<S,K,V>,~put:W.World<S,C,R,E> -> M.Slot<S,K,V> -> W.World<S,C,R,E>,~publish:W.World<S,C,R,E> -> M.Transition<V> -> W.World<S,C,R,E>,~same:V -> V -> Bool,~requirement_same:Q -> Q -> Bool,~has:W.World<S,C,R,E> -> Q -> W.World<S,C,R,E> & Bool,~frame:W.World<S,C,R,E> -> W.World<S,C,R,E>,owners:Owners<S,K,V,Q,C,R,E,runner>,world:W.World<S,C,R,E>) -> Owners<S,K,V,Q,C,R,E,runner> & Sys.Outcome<W.World<S,C,R,E>,String,Unit>: match owners: case Selected{positions,kept,active,_,trace}:phase_returned(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame,positions,kept,H.BendvyExit{},PhaseContext.exit(~S,~K,~V,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~frame,active,Ctx.Context{world,trace})) case owners:(owners,Sys.Succeeded{world,Unit{}})def transition(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,~observed:Facts.State -> W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit> & Facts.State,~name:String,~take:W.World<S,C,R,E> -> W.World<S,C,R,E> & M.Slot<S,K,V>,~put:W.World<S,C,R,E> -> M.Slot<S,K,V> -> W.World<S,C,R,E>,~publish:W.World<S,C,R,E> -> M.Transition<V> -> W.World<S,C,R,E>,~same:V -> V -> Bool,~requirement_same:Q -> Q -> Bool,~has:W.World<S,C,R,E> -> Q -> W.World<S,C,R,E> & Bool,~frame:W.World<S,C,R,E> -> W.World<S,C,R,E>,owners:Owners<S,K,V,Q,C,R,E,runner>,world:W.World<S,C,R,E>) -> Owners<S,K,V,Q,C,R,E,runner> & Sys.Outcome<W.World<S,C,R,E>,String,Unit>: match owners: case Selected{positions,kept,active,_,trace}:phase_returned(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame,positions,kept,H.Transition{},PhaseContext.transition(~S,~K,~V,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~frame,active,Ctx.Context{world,trace})) case owners:(owners,Sys.Succeeded{world,Unit{}})def enter(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,~observed:Facts.State -> W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit> & Facts.State,~name:String,~take:W.World<S,C,R,E> -> W.World<S,C,R,E> & M.Slot<S,K,V>,~put:W.World<S,C,R,E> -> M.Slot<S,K,V> -> W.World<S,C,R,E>,~publish:W.World<S,C,R,E> -> M.Transition<V> -> W.World<S,C,R,E>,~same:V -> V -> Bool,~requirement_same:Q -> Q -> Bool,~has:W.World<S,C,R,E> -> Q -> W.World<S,C,R,E> & Bool,~frame:W.World<S,C,R,E> -> W.World<S,C,R,E>,owners:Owners<S,K,V,Q,C,R,E,runner>,world:W.World<S,C,R,E>) -> Owners<S,K,V,Q,C,R,E,runner> & Sys.Outcome<W.World<S,C,R,E>,String,Unit>: match owners: case Selected{positions,kept,active,_,trace}:phase_returned(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame,positions,kept,H.Enter{},PhaseContext.enter(~S,~K,~V,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~frame,active,Ctx.Context{world,trace})) case owners:(owners,Sys.Succeeded{world,Unit{}})def recovered(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,~observed:Facts.State -> W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit> & Facts.State,~name:String,~take:W.World<S,C,R,E> -> W.World<S,C,R,E> & M.Slot<S,K,V>,~put:W.World<S,C,R,E> -> M.Slot<S,K,V> -> W.World<S,C,R,E>,~publish:W.World<S,C,R,E> -> M.Transition<V> -> W.World<S,C,R,E>,~same:V -> V -> Bool,~requirement_same:Q -> Q -> Bool,~has:W.World<S,C,R,E> -> Q -> W.World<S,C,R,E> & Bool,~frame:W.World<S,C,R,E> -> W.World<S,C,R,E>,namespace:U32,positions:List<&2,B.Position<S,K,V,Q>>,kept:List<&1,H.Entry<S,C,R,E,V,runner>>,active:Phase.Owners<S,K,V,C,R,E,runner>,world:W.World<S,C,R,E>,status:B.Status<Q>) -> B.BundleResult<S,K,V,Q,C,R,E,runner>: match active: case Phase.Owners{handlers,_}:B.recovered(~S,~K,~V,~Q,~C,~R,~E,~runner,namespace,B.recover(~S,~K,~V,~Q,~C,~R,~E,~runner,positions,kept,handlers),world,status)def finished(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,~observed:Facts.State -> W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit> & Facts.State,~name:String,~take:W.World<S,C,R,E> -> W.World<S,C,R,E> & M.Slot<S,K,V>,~put:W.World<S,C,R,E> -> M.Slot<S,K,V> -> W.World<S,C,R,E>,~publish:W.World<S,C,R,E> -> M.Transition<V> -> W.World<S,C,R,E>,~same:V -> V -> Bool,~requirement_same:Q -> Q -> Bool,~has:W.World<S,C,R,E> -> Q -> W.World<S,C,R,E> & Bool,~frame:W.World<S,C,R,E> -> W.World<S,C,R,E>,namespace:U32,owners:Owners<S,K,V,Q,C,R,E,runner>,world:W.World<S,C,R,E>,error:Maybe<&2,String>) -> B.BundleResult<S,K,V,Q,C,R,E,runner> & Facts.State: match owners error: case Pending{entries,trace} None{}:(B.Returned{B.Bundle{namespace,entries},world,B.Completed{}},trace) case Pending{entries,trace} Some{_}:(B.Returned{B.Bundle{namespace,entries},world,B.ForeignBundle{}},trace) case Unavailable{entries,trace} _:(B.Returned{B.Bundle{namespace,entries},world,B.MachineUnavailable{}},trace) case Selected{positions,kept,active,_,trace} None{}:(recovered(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame,namespace,positions,kept,active,world,B.Completed{}),trace) case Selected{positions,kept,active,phase,trace} Some{error}:(recovered(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame,namespace,positions,kept,active,world,B.HandlerFailed{phase,error}),trace)def marked(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,steps:List<&2,Sch.Step>,observations:List<&2,Sch.Observation>,result:B.BundleResult<S,K,V,Q,C,R,E,runner> & Facts.State) -> MarkerResult<S,K,V,Q,C,R,E,runner>: match result: case (result,trace):MarkerResult{result,steps,observations,trace}def returned(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,~observed:Facts.State -> W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit> & Facts.State,~name:String,~take:W.World<S,C,R,E> -> W.World<S,C,R,E> & M.Slot<S,K,V>,~put:W.World<S,C,R,E> -> M.Slot<S,K,V> -> W.World<S,C,R,E>,~publish:W.World<S,C,R,E> -> M.Transition<V> -> W.World<S,C,R,E>,~same:V -> V -> Bool,~requirement_same:Q -> Q -> Bool,~has:W.World<S,C,R,E> -> Q -> W.World<S,C,R,E> & Bool,~frame:W.World<S,C,R,E> -> W.World<S,C,R,E>,result:Sch.RunResult<S,C,R,E,Owners<S,K,V,Q,C,R,E,runner>,String>) -> MarkerResult<S,K,V,Q,C,R,E,runner>: match result: case Sch.Finished{Sch.Schedule{namespace,_,steps,owners},world,observations}:marked(~S,~K,~V,~Q,~C,~R,~E,~runner,steps,observations,finished(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame,namespace,owners,world,None{})) case Sch.Failed{Sch.Schedule{namespace,_,steps,owners},world,error,observations}:marked(~S,~K,~V,~Q,~C,~R,~E,~runner,steps,observations,finished(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame,namespace,owners,world,Some{error})) case Sch.Rejected{Sch.Schedule{namespace,_,steps,owners},world}:marked(~S,~K,~V,~Q,~C,~R,~E,~runner,steps,[],finished(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame,namespace,owners,world,Some{"schedule-rejected"}))def replaced_trace(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,owners:Owners<S,K,V,Q,C,R,E,runner>,trace:Facts.State) -> Owners<S,K,V,Q,C,R,E,runner>: match owners: case Pending{entries,_}:Pending{entries,trace} case Unavailable{entries,_}:Unavailable{entries,trace} case Selected{positions,kept,active,phase,_}:Selected{positions,kept,active,phase,trace}def barrier_returned(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,owners:Owners<S,K,V,Q,C,R,E,runner>,result:W.World<S,C,R,E> & Facts.State) -> Owners<S,K,V,Q,C,R,E,runner> & W.World<S,C,R,E>: match result: case (world,trace):(replaced_trace(~S,~K,~V,~Q,~C,~R,~E,~runner,owners,Facts.barrier_finished(trace)),world)def barrier(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,owners:Owners<S,K,V,Q,C,R,E,runner>,world:W.World<S,C,R,E>) -> Owners<S,K,V,Q,C,R,E,runner> & W.World<S,C,R,E>: match owners: case Pending{entries,trace}:barrier_returned(~S,~K,~V,~Q,~C,~R,~E,~runner,Pending{entries,Facts.Off{}},W.barrier_traced(~S,~C,~R,~E,world,Facts.barrier_entered(trace))) case Unavailable{entries,trace}:barrier_returned(~S,~K,~V,~Q,~C,~R,~E,~runner,Unavailable{entries,Facts.Off{}},W.barrier_traced(~S,~C,~R,~E,world,Facts.barrier_entered(trace))) case Selected{positions,kept,active,phase,trace}:barrier_returned(~S,~K,~V,~Q,~C,~R,~E,~runner,Selected{positions,kept,active,phase,Facts.Off{}},W.barrier_traced(~S,~C,~R,~E,world,Facts.barrier_entered(trace)))def phase_started(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,owners:Owners<S,K,V,Q,C,R,E,runner>,id:U32) -> Owners<S,K,V,Q,C,R,E,runner>: match owners: case Pending{entries,trace}:Pending{entries,Facts.phase_boundary(trace,Ordinary.phase_name(id))} case Unavailable{entries,trace}:Unavailable{entries,Facts.phase_boundary(trace,Ordinary.phase_name(id))} case Selected{positions,kept,active,phase,trace}:Selected{positions,kept,active,phase,Facts.phase_boundary(trace,Ordinary.phase_name(id))}def dispatch_shared(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,~observed:Facts.State -> W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit> & Facts.State,~name:String,~take:W.World<S,C,R,E> -> W.World<S,C,R,E> & M.Slot<S,K,V>,~put:W.World<S,C,R,E> -> M.Slot<S,K,V> -> W.World<S,C,R,E>,~publish:W.World<S,C,R,E> -> M.Transition<V> -> W.World<S,C,R,E>,~same:V -> V -> Bool,~requirement_same:Q -> Q -> Bool,~has:W.World<S,C,R,E> -> Q -> W.World<S,C,R,E> & Bool,~frame:W.World<S,C,R,E> -> W.World<S,C,R,E>,owners:Owners<S,K,V,Q,C,R,E,runner>,world:W.World<S,C,R,E>,+id:U32) -> Owners<S,K,V,Q,C,R,E,runner> & Sys.Outcome<W.World<S,C,R,E>,String,Unit>: Ordinary.dispatch(~S,~C,~R,~E,~Owners<S,K,V,Q,C,R,E,runner>,~String,~apply(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame),~exit(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame),~transition(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame),~enter(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame),phase_started(~S,~K,~V,~Q,~C,~R,~E,~runner,owners,id),world,id)def dispatch(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,~observed:Facts.State -> W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit> & Facts.State,~name:String,~take:W.World<S,C,R,E> -> W.World<S,C,R,E> & M.Slot<S,K,V>,~put:W.World<S,C,R,E> -> M.Slot<S,K,V> -> W.World<S,C,R,E>,~publish:W.World<S,C,R,E> -> M.Transition<V> -> W.World<S,C,R,E>,~same:V -> V -> Bool,~requirement_same:Q -> Q -> Bool,~has:W.World<S,C,R,E> -> Q -> W.World<S,C,R,E> & Bool,~frame:W.World<S,C,R,E> -> W.World<S,C,R,E>,owners:Owners<S,K,V,Q,C,R,E,runner>,world:W.World<S,C,R,E>,id:U32) -> Owners<S,K,V,Q,C,R,E,runner> & Sys.Outcome<W.World<S,C,R,E>,String,Unit>: dispatch_shared(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame,owners,world,id)def installed(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,~observed:Facts.State -> W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit> & Facts.State,~name:String,~take:W.World<S,C,R,E> -> W.World<S,C,R,E> & M.Slot<S,K,V>,~put:W.World<S,C,R,E> -> M.Slot<S,K,V> -> W.World<S,C,R,E>,~publish:W.World<S,C,R,E> -> M.Transition<V> -> W.World<S,C,R,E>,~same:V -> V -> Bool,~requirement_same:Q -> Q -> Bool,~has:W.World<S,C,R,E> -> Q -> W.World<S,C,R,E> & Bool,~frame:W.World<S,C,R,E> -> W.World<S,C,R,E>,+declaration:Ordinary.Declaration<S>,world:W.World<S,C,R,E>,built:Sch.Build<S,C,R,E,Owners<S,K,V,Q,C,R,E,runner>>) -> MarkerResult<S,K,V,Q,C,R,E,runner>: match built: case Sch.Built{schedule}:returned(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame,Sch.run_with_barrier(~S,~C,~R,~E,~Owners<S,K,V,Q,C,R,E,runner>,~String,~dispatch(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame),~Ordinary.condition(~S,~C,~R,~E),~barrier(~S,~K,~V,~Q,~C,~R,~E,~runner),schedule,world)) case Sch.Invalid{owners}:marked(~S,~K,~V,~Q,~C,~R,~E,~runner,[],[],finished(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame,0,owners,world,Some{"invalid"}))def checked(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,~observed:Facts.State -> W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit> & Facts.State,~name:String,~take:W.World<S,C,R,E> -> W.World<S,C,R,E> & M.Slot<S,K,V>,~put:W.World<S,C,R,E> -> M.Slot<S,K,V> -> W.World<S,C,R,E>,~publish:W.World<S,C,R,E> -> M.Transition<V> -> W.World<S,C,R,E>,~same:V -> V -> Bool,~requirement_same:Q -> Q -> Bool,~has:W.World<S,C,R,E> -> Q -> W.World<S,C,R,E> & Bool,~frame:W.World<S,C,R,E> -> W.World<S,C,R,E>,+declaration:Ordinary.Declaration<S>,namespace:U32,entries:List<&1,B.Scheduled<S,K,V,Q,C,R,E,runner>>,pair:W.World<S,C,R,E> & List<&2,Q>,trace:Facts.State) -> MarkerResult<S,K,V,Q,C,R,E,runner>: match pair: case (world,[]):installed(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame,declaration,world,Ordinary.install(~S,~C,~R,~E,~Owners<S,K,V,Q,C,R,E,runner>,~String,declaration,namespace,Pending{entries,trace})) case (world,missing):MarkerResult{B.Returned{B.Bundle{namespace,entries},world,B.MissingRequirements{missing}},[],[],trace}def gathered(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,~observed:Facts.State -> W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit> & Facts.State,~name:String,~take:W.World<S,C,R,E> -> W.World<S,C,R,E> & M.Slot<S,K,V>,~put:W.World<S,C,R,E> -> M.Slot<S,K,V> -> W.World<S,C,R,E>,~publish:W.World<S,C,R,E> -> M.Transition<V> -> W.World<S,C,R,E>,~same:V -> V -> Bool,~requirement_same:Q -> Q -> Bool,~has:W.World<S,C,R,E> -> Q -> W.World<S,C,R,E> & Bool,~frame:W.World<S,C,R,E> -> W.World<S,C,R,E>,+declaration:Ordinary.Declaration<S>,namespace:U32,world:W.World<S,C,R,E>,pair:List<&1,B.Scheduled<S,K,V,Q,C,R,E,runner>> & List<&2,Q>,trace:Facts.State) -> MarkerResult<S,K,V,Q,C,R,E,runner>: (entries,needs)=pair checked(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame,declaration,namespace,entries,B.missing(~S,~C,~R,~E,~Q,~has,B.collect(~Q,~requirement_same,needs,[]),world),trace)def allowed(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,~observed:Facts.State -> W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit> & Facts.State,~name:String,~take:W.World<S,C,R,E> -> W.World<S,C,R,E> & M.Slot<S,K,V>,~put:W.World<S,C,R,E> -> M.Slot<S,K,V> -> W.World<S,C,R,E>,~publish:W.World<S,C,R,E> -> M.Transition<V> -> W.World<S,C,R,E>,~same:V -> V -> Bool,~requirement_same:Q -> Q -> Bool,~has:W.World<S,C,R,E> -> Q -> W.World<S,C,R,E> & Bool,~frame:W.World<S,C,R,E> -> W.World<S,C,R,E>,+declaration:Ordinary.Declaration<S>,yes:Bool,namespace:U32,entries:List<&1,B.Scheduled<S,K,V,Q,C,R,E,runner>>,world:W.World<S,C,R,E>,trace:Facts.State) -> MarkerResult<S,K,V,Q,C,R,E,runner>: match yes: case False{}:MarkerResult{B.Returned{B.Bundle{namespace,entries},world,B.ForeignBundle{}},[],[],trace} case True{}:gathered(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame,declaration,namespace,world,B.requirements(~S,~K,~V,~Q,~C,~R,~E,~runner,entries),trace)def named(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,~observed:Facts.State -> W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit> & Facts.State,~name:String,~take:W.World<S,C,R,E> -> W.World<S,C,R,E> & M.Slot<S,K,V>,~put:W.World<S,C,R,E> -> M.Slot<S,K,V> -> W.World<S,C,R,E>,~publish:W.World<S,C,R,E> -> M.Transition<V> -> W.World<S,C,R,E>,~same:V -> V -> Bool,~requirement_same:Q -> Q -> Bool,~has:W.World<S,C,R,E> -> Q -> W.World<S,C,R,E> & Bool,~frame:W.World<S,C,R,E> -> W.World<S,C,R,E>,+declaration:Ordinary.Declaration<S>,+namespace:U32,entries:List<&1,B.Scheduled<S,K,V,Q,C,R,E,runner>>,pair:W.World<S,C,R,E> & U32,trace:Facts.State) -> MarkerResult<S,K,V,Q,C,R,E,runner>: (world,actual)=pair allowed(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame,declaration,U32.is_eq(namespace,actual),namespace,entries,world,trace)def run(~S:Data,~K:Data,~V:Data,~Q:Data,~C:Type,~R:Type,~E:Data,~runner:W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit>,~observed:Facts.State -> W.World<S,C,R,E> -> H.Invocation<V> -> Sys.Outcome<W.World<S,C,R,E>,String,Unit> & Facts.State,~name:String,~take:W.World<S,C,R,E> -> W.World<S,C,R,E> & M.Slot<S,K,V>,~put:W.World<S,C,R,E> -> M.Slot<S,K,V> -> W.World<S,C,R,E>,~publish:W.World<S,C,R,E> -> M.Transition<V> -> W.World<S,C,R,E>,~same:V -> V -> Bool,~requirement_same:Q -> Q -> Bool,~has:W.World<S,C,R,E> -> Q -> W.World<S,C,R,E> & Bool,~frame:W.World<S,C,R,E> -> W.World<S,C,R,E>,+declaration:Ordinary.Declaration<S>,bundle:B.Bundle<S,K,V,Q,C,R,E,runner>,world:W.World<S,C,R,E>,trace:Facts.State) -> MarkerResult<S,K,V,Q,C,R,E,runner>: match bundle: case B.Bundle{namespace,entries}:named(~S,~K,~V,~Q,~C,~R,~E,~runner,~observed,~name,~take,~put,~publish,~same,~requirement_same,~has,~frame,declaration,namespace,entries,W.namespace(~S,~C,~R,~E,world),trace)