gameplay: preserve defuse allocator prefixes
Browse filesFiles changed (12)
- crates/urt-gameplay/src/bin/urt-location-feedback.rs+60-4
- crates/urt-gameplay/src/location_feedback.rs+97-7
- docs/FINDINGS.md+2
- docs/PROVISIONAL_TODO.md+2
- docs/RESEARCH_LEDGER.md+4
- docs/research/QVM_LOCATION_ALLOCATION_BATCH.md+2
- docs/research/README.md+2
- docs/research/RUST_DEFUSE_ALLOCATION_TERMINAL.mdAdded+7
- docs/research/rust-defuse-allocation-terminal.jsonAdded+1239
- scripts/analyze_rust_defuse_allocation_terminal.pyAdded+35
- scripts/test_rust_defuse_allocation_terminal.pyAdded+19
- xtask/checks.tsv+10
23 unmodified lines242526272829245 unmodified lines2752762772782792802812822832842859 unmodified lines29529629729829930030 unmodified lines33133233323 unmodified lines"radio" => println!("{}", radio(&w)),"allocation" => println!("{}", allocation(&w)),"allocated" => println!("{}", allocated(&w)),_ => panic!("unknown contract"),}}245 unmodified linesformat!("{{{}}}", allocation_fields(&pool, &out))}fn allocated(w: &[u32]) -> String {use urt_gameplay::defuse::{DefuseInput, DefuseState};assert!(w.len() >= 14);assert_eq!(w.len(), 14 + w[13] as usize);let mut state = DefuseState {flags: w[0],flags104: w[1],busy: w[2],9 unmodified linesindex: w[9],slot: 2,};let (mut pool, _, start) = decode_pool(&w[14..]);let out = allocated_defuse_start(&mut state,30 unmodified lineslist(&out.links.iter().map(|v| *v as u32).collect::<Vec<_>>()))}23 unmodified lines24252627282930245 unmodified lines2762772782792802812822832842852862872882899 unmodified lines29930030130230330430530630730830931031130 unmodified lines34234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838923 unmodified lines"radio" => println!("{}", radio(&w)),"allocation" => println!("{}", allocation(&w)),"allocated" => println!("{}", allocated(&w)),"defuse-terminal" => println!("{}", defuse_terminal(&w)),_ => panic!("unknown contract"),}}245 unmodified linesformat!("{{{}}}", allocation_fields(&pool, &out))}fn decode_defuse(w: &[u32],) -> (urt_gameplay::defuse::DefuseState,urt_gameplay::defuse::DefuseInput,) {use urt_gameplay::defuse::{DefuseInput, DefuseState};let state = DefuseState {flags: w[0],flags104: w[1],busy: w[2],9 unmodified linesindex: w[9],slot: 2,};(state, input)}fn allocated(w: &[u32]) -> String {assert!(w.len() >= 14);assert_eq!(w.len(), 14 + w[13] as usize);let (mut state, input) = decode_defuse(w);let (mut pool, _, start) = decode_pool(&w[14..]);let out = allocated_defuse_start(&mut state,30 unmodified lineslist(&out.links.iter().map(|v| *v as u32).collect::<Vec<_>>()))}fn defuse_terminal(w: &[u32]) -> String {use urt_gameplay::defuse::DefuseEffect;let (mut state, input) = decode_defuse(w);let branch = match w[10] {0 => DefuseBranch::Start,1 => DefuseBranch::Cancel,2 => DefuseBranch::Finish,_ => panic!("unknown defuse branch"),};let (mut pool, _, start) = decode_pool(&w[11..]);let before_slots = pool.slots.clone();let outcome = allocate_defuse_branch(&mut state, &mut pool, input, branch, start, [0; 3]).unwrap().expect("expected an allocation attempt");assert_eq!(pool.slots, before_slots);assert!(outcome.initialized.is_none());assert!(outcome.links.is_empty());assert!(outcome.after_allocation.is_empty());let effects = outcome.before_allocation.iter().map(|effect| match effect {DefuseEffect::Log { format, slot } => {format!(r#"{{"op":"log","format":"{}","slot":{slot}}}"#, hex(format))}_ => panic!("unexpected effect before defuse allocation"),}).collect::<Vec<_>>().join(",");format!(r#"{{"state":{{"flags":{},"flags104":{},"busy":{},"clock":{},"complete":{},"animation":{},"weapon":{},"event":{}}},"event_kind":{},"effects":[{}],"allocation":{{{}}}}}"#,state.flags,state.flags104,state.busy,state.clock,state.complete,state.animation,state.weapon,list(&state.event),outcome.event_kind,effects,allocation_fields(&pool, &outcome.allocation))}
554 unmodified lines5555565575585595609 unmodified lines570571572573574575576577578579580581582554 unmodified liness.words[o / 4] = v;}}/// Original153774 through153917, stopping before radio. Successful allocation/// domain only; terminal allocator prefixes are exposed by allocate_entity./// Native registration/linking remain plans. Typed errors roll back both states.9 unmodified linescrate::defuse::begin_defuse(&mut next, input)?;let allocation = allocate_entity(&mut p, input.tick, start)?;let index = allocation.selected.ok_or(Error::InvalidInput)?;let initialized = p.slots[index].clone();let mut event = slot_event(&initialized);crate::transition::temporary_event(&mut event, origin, 83, input.tick as i32).map_err(|_| Error::InvalidInput)?;store_event(&mut p.slots[index], &event);p.slots[index].words[184 / 4] = input.duration;p.slots[index].words[424 / 4] |= 32;next.event = [input.duration, p.slots[index].words[424 / 4]];*state = next;*pool = p;554 unmodified lines5555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546559 unmodified lines665666667668669670671672554 unmodified liness.words[o / 4] = v;}}/// Selected branch of the defuse callback after eligibility and bomb lookup.#[derive(Clone, Copy, Debug, PartialEq, Eq)]pub enum DefuseBranch {Start,Cancel,Finish,}/// Allocation and caller effects in their observed order. A terminal allocation/// has no initialized record, links, or effects after allocation.#[derive(Clone, Debug, PartialEq, Eq)]pub struct DefuseAllocation {pub event_kind: u32,pub allocation: AllocationOutcome,pub initialized: Option<EntitySlot>,pub links: Vec<usize>,pub before_allocation: Vec<crate::defuse::DefuseEffect>,pub after_allocation: Vec<crate::defuse::DefuseEffect>,}/// Resolve event allocation for a reached defuse branch. Pending diagnostic/// and fatal outcomes commit the observed caller and allocator prefix. Typed/// errors leave the supplied state untouched. Native effects remain plans.pub fn allocate_defuse_branch(state: &mut crate::defuse::DefuseState,pool: &mut EntityPool,input: crate::defuse::DefuseInput,branch: DefuseBranch,start: u32,origin: [u32; 3],) -> Result<Option<DefuseAllocation>, Error> {use crate::defuse::{DefuseEffect, begin_defuse, cancel_defuse, finish_defuse};let mut caller = *state;let mut effects = match branch {DefuseBranch::Start => begin_defuse(&mut caller, input)?,DefuseBranch::Cancel => cancel_defuse(&mut caller, input)?,DefuseBranch::Finish => finish_defuse(&mut caller, input)?,};let Some((position, event_kind)) =effects.iter().enumerate().find_map(|(position, effect)| match effect {DefuseEffect::Allocate { event } => Some((position, *event)),_ => None,})else {return Ok(None);};let mut after_allocation = effects.split_off(position + 1);effects.truncate(position);let payload = caller.event[0];caller.event = state.event;let mut next_pool = pool.clone();let allocation = allocate_entity(&mut next_pool, input.tick, start)?;let (initialized, links) = if let Some(index) = allocation.selected {let record = &mut next_pool.slots[index];let initialized = construct_defuse_event(record, origin, event_kind, input.tick, payload)?;caller.event = [payload, record.words[424 / 4]];(Some(initialized), vec![index])} else {after_allocation.clear();(None, vec![])};*state = caller;*pool = next_pool;Ok(Some(DefuseAllocation {event_kind,allocation,initialized,links,before_allocation: effects,after_allocation,}))}fn construct_defuse_event(record: &mut EntitySlot,origin: [u32; 3],kind: u32,tick: u32,payload: u32,) -> Result<EntitySlot, Error> {let initialized = record.clone();let mut event = slot_event(&initialized);crate::transition::temporary_event(&mut event, origin, kind, tick as i32).map_err(|_| Error::InvalidInput)?;store_event(record, &event);record.words[184 / 4] = payload;record.words[424 / 4] |= 32;Ok(initialized)}/// Original153774 through153917, stopping before radio. Successful allocation/// domain only; terminal allocator prefixes are exposed by allocate_entity./// Native registration/linking remain plans. Typed errors roll back both states.9 unmodified linescrate::defuse::begin_defuse(&mut next, input)?;let allocation = allocate_entity(&mut p, input.tick, start)?;let index = allocation.selected.ok_or(Error::InvalidInput)?;let initialized =construct_defuse_event(&mut p.slots[index], origin, 83, input.tick, input.duration)?;next.event = [input.duration, p.slots[index].words[424 / 4]];*state = next;*pool = p;
2032 unmodified lines2033203420352032 unmodified linesRE-1034–1043 batch validation passed:2,018 Python tests,339 Rust tests,146 deterministic affected producers and623 documentation files. All ten tasks have individual commits and focused checks. [Location/allocation evidence and next work](research/QVM_LOCATION_ALLOCATION_BATCH.md).- Defuse state updates precede allocation. An elapsed completion also requests its log before allocation. [QVM terminal evidence](research/QVM_DEFUSE_ALLOCATION_TERMINAL.md).2032 unmodified lines203320342035203620372032 unmodified linesRE-1034–1043 batch validation passed:2,018 Python tests,339 Rust tests,146 deterministic affected producers and623 documentation files. All ten tasks have individual commits and focused checks. [Location/allocation evidence and next work](research/QVM_LOCATION_ALLOCATION_BATCH.md).- Defuse state updates precede allocation. An elapsed completion also requests its log before allocation. [QVM terminal evidence](research/QVM_DEFUSE_ALLOCATION_TERMINAL.md).- The Rust defuse adapter preserves allocator-terminal caller writes and the completion log plan. [Rust terminal parity](research/RUST_DEFUSE_ALLOCATION_TERMINAL.md).
2094 unmodified lines2095209620972094 unmodified lines- [ ] RE-1044 combine allocated events and located radio with full lifecycle/native adapters ([scope](research/QVM_LOCATION_ALLOCATION_BATCH.md#next-work-re-1044)).- [x] RE-1044 Trace defuse caller state at allocator terminals ([evidence](research/QVM_DEFUSE_ALLOCATION_TERMINAL.md)).2094 unmodified lines209520962097209820992094 unmodified lines- [ ] RE-1044 combine allocated events and located radio with full lifecycle/native adapters ([scope](research/QVM_LOCATION_ALLOCATION_BATCH.md#next-work-re-1044)).- [x] RE-1044 Trace defuse caller state at allocator terminals ([evidence](research/QVM_DEFUSE_ALLOCATION_TERMINAL.md)).- [x] RE-1045 Preserve defuse caller state across allocator terminals in Rust ([evidence](research/RUST_DEFUSE_ALLOCATION_TERMINAL.md)).
2850 unmodified lines2851285228532850 unmodified lines## 2026-11-21 — RE-1044 Trace defuse caller state at allocator terminalsThe start, both cancellation branches and elapsed completion reach allocator terminals after updating caller state. Completion requests its log before allocation. Sixteen source cases trace the caller, constructor and allocator without supplying a fake entity return. See [caller-state findings](research/QVM_DEFUSE_ALLOCATION_TERMINAL.md).2850 unmodified lines28512852285328542855285628572850 unmodified lines## 2026-11-21 — RE-1044 Trace defuse caller state at allocator terminalsThe start, both cancellation branches and elapsed completion reach allocator terminals after updating caller state. Completion requests its log before allocation. Sixteen source cases trace the caller, constructor and allocator without supplying a fake entity return. See [caller-state findings](research/QVM_DEFUSE_ALLOCATION_TERMINAL.md).## 2026-11-21 — RE-1045 Preserve defuse caller state across allocator terminals in RustRust matches the caller state, earlier log and allocator results in sixteen traced cases. The adapter keeps the event projection and fixed pool records intact while committing the allocator count and caller state. See [Rust terminal integration](research/RUST_DEFUSE_ALLOCATION_TERMINAL.md).
68 unmodified lines69707168 unmodified lines- [ ] Compose full154089 preparation, assistance/self recovery, defusing, movement54475 and timer155714; continue asset conversion, Bevy/Solari rendering and macOS/Linux acceptance.RE-1044 traces the caller and constructor prefixes before diagnostic/fatal allocation in [all four defuse branches](QVM_DEFUSE_ALLOCATION_TERMINAL.md). Rust terminal integration and successful cancel/finish construction remain open.68 unmodified lines697071727368 unmodified lines- [ ] Compose full154089 preparation, assistance/self recovery, defusing, movement54475 and timer155714; continue asset conversion, Bevy/Solari rendering and macOS/Linux acceptance.RE-1044 traces the caller and constructor prefixes before diagnostic/fatal allocation in [all four defuse branches](QVM_DEFUSE_ALLOCATION_TERMINAL.md). Rust terminal integration and successful cancel/finish construction remain open.RE-1045 matches all sixteen prefixes in [the Rust adapter](RUST_DEFUSE_ALLOCATION_TERMINAL.md). The adapter commits the earlier writes at a terminal outcome and exposes the completion log separately from later effects.
1660 unmodified lines1661166216631660 unmodified lines- [Location, formatting and objective allocation: RE-1034–1043](QVM_LOCATION_ALLOCATION_BATCH.md).- [Defuse caller state at allocator terminals](QVM_DEFUSE_ALLOCATION_TERMINAL.md)1660 unmodified lines166116621663166416651660 unmodified lines- [Location, formatting and objective allocation: RE-1034–1043](QVM_LOCATION_ALLOCATION_BATCH.md).- [Defuse caller state at allocator terminals](QVM_DEFUSE_ALLOCATION_TERMINAL.md)- [Defuse allocation terminals in Rust](RUST_DEFUSE_ALLOCATION_TERMINAL.md)
1234567# Defuse allocation terminals in Rust
`allocate_defuse_branch` consumes a selected start, cancellation or finish branch and resolves its event allocation against a fixed pool. The two source cancellation paths use the same Rust branch because their state changes and emitted event agree. The adapter exposes the allocation result, the initialized record and link plan when applicable, and caller effect plans before and after allocation.
At a terminal outcome, the adapter commits the preceding caller and allocator writes. It preserves all entity records and the caller's prior event projection. A completion preserves its earlier log plan and omits subsequent score and counter plans. The existing successful-start API continues to reject terminal cases and shares the event-construction code. Native diagnostic and fatal execution remain external.
The [parity report](rust-defuse-allocation-terminal.json) checks sixteen source cases. The focused check also reruns existing successful-start parity. Source verification for successful cancellation and completion with real allocated records remains open.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239{ "limits": "Caller-state and allocator parity before native diagnostic/fatal handling.", "probes": [ { "input": { "allocation": { "count": 1022, "profile": 8, "slots": [], "start": 0, "tick": 5000 }, "animation": 99, "branch": "start", "busy": 0, "clock": 0, "complete": 0, "duration": 5, "flags": 2147516512, "flags104": 2147483666, "index": 3, "tick": 5000, "weapon": 305397771 }, "rust": { "allocation": { "count": 1022, "record": null, "registrations": [], "retry": 0, "scan_index": 0, "selected": null, "status": "diagnostic-loop-pending" }, "effects": [], "event_kind": 83, "state": { "animation": 2, "busy": 1, "clock": 5000, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516420, "flags104": 2147483666, "weapon": 305397771 } }, "source": { "allocation": { "count": 1022, "record": null, "registrations": [], "retry": 0, "scan_index": 0, "selected": null, "status": "diagnostic-loop-pending" }, "effects": [], "event_kind": 83, "state": { "animation": 2, "busy": 1, "clock": 5000, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516420, "flags104": 2147483666, "weapon": 305397771 } } }, { "input": { "allocation": { "count": 1022, "profile": 8, "slots": [], "start": 0, "tick": 5000 }, "animation": 99, "branch": "start", "busy": 0, "clock": 0, "complete": 0, "duration": 5, "flags": 2147516420, "flags104": 2147483666, "index": 3, "tick": 5000, "weapon": 305397771 }, "rust": { "allocation": { "count": 1022, "record": null, "registrations": [], "retry": 0, "scan_index": 0, "selected": null, "status": "diagnostic-loop-pending" }, "effects": [], "event_kind": 83, "state": { "animation": 99, "busy": 1, "clock": 5000, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516420, "flags104": 2147483666, "weapon": 305397771 } }, "source": { "allocation": { "count": 1022, "record": null, "registrations": [], "retry": 0, "scan_index": 0, "selected": null, "status": "diagnostic-loop-pending" }, "effects": [], "event_kind": 83, "state": { "animation": 99, "busy": 1, "clock": 5000, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516420, "flags104": 2147483666, "weapon": 305397771 } } }, { "input": { "allocation": { "count": 1024, "profile": 10, "slots": [], "start": 0, "tick": 5000 }, "animation": 99, "branch": "start", "busy": 0, "clock": 0, "complete": 0, "duration": 5, "flags": 2147516512, "flags104": 2147483666, "index": 3, "tick": 5000, "weapon": 305397771 }, "rust": { "allocation": { "count": 1025, "record": null, "registrations": [], "retry": 2, "scan_index": 1024, "selected": null, "status": "fatal-error-pending" }, "effects": [], "event_kind": 83, "state": { "animation": 2, "busy": 1, "clock": 5000, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516420, "flags104": 2147483666, "weapon": 305397771 } }, "source": { "allocation": { "count": 1025, "record": null, "registrations": [], "retry": 2, "scan_index": 1024, "selected": null, "status": "fatal-error-pending" }, "effects": [], "event_kind": 83, "state": { "animation": 2, "busy": 1, "clock": 5000, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516420, "flags104": 2147483666, "weapon": 305397771 } } }, { "input": { "allocation": { "count": 1024, "profile": 10, "slots": [], "start": 0, "tick": 5000 }, "animation": 99, "branch": "start", "busy": 0, "clock": 0, "complete": 0, "duration": 5, "flags": 2147516420, "flags104": 2147483666, "index": 3, "tick": 5000, "weapon": 305397771 }, "rust": { "allocation": { "count": 1025, "record": null, "registrations": [], "retry": 2, "scan_index": 1024, "selected": null, "status": "fatal-error-pending" }, "effects": [], "event_kind": 83, "state": { "animation": 99, "busy": 1, "clock": 5000, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516420, "flags104": 2147483666, "weapon": 305397771 } }, "source": { "allocation": { "count": 1025, "record": null, "registrations": [], "retry": 2, "scan_index": 1024, "selected": null, "status": "fatal-error-pending" }, "effects": [], "event_kind": 83, "state": { "animation": 99, "busy": 1, "clock": 5000, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516420, "flags104": 2147483666, "weapon": 305397771 } } }, { "input": { "allocation": { "count": 1022, "profile": 8, "slots": [], "start": 0, "tick": 5000 }, "animation": 99, "branch": "far", "busy": 1, "clock": 0, "complete": 0, "duration": 5, "flags": 2147516512, "flags104": 2147483666, "index": 3, "tick": 5000, "weapon": 305397771 }, "rust": { "allocation": { "count": 1022, "record": null, "registrations": [], "retry": 0, "scan_index": 0, "selected": null, "status": "diagnostic-loop-pending" }, "effects": [], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516512, "flags104": 2147483650, "weapon": 305397771 } }, "source": { "allocation": { "count": 1022, "record": null, "registrations": [], "retry": 0, "scan_index": 0, "selected": null, "status": "diagnostic-loop-pending" }, "effects": [], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516512, "flags104": 2147483650, "weapon": 305397771 } } }, { "input": { "allocation": { "count": 1022, "profile": 8, "slots": [], "start": 0, "tick": 5000 }, "animation": 99, "branch": "far", "busy": 1, "clock": 0, "complete": 0, "duration": 5, "flags": 2147516420, "flags104": 2147483666, "index": 3, "tick": 5000, "weapon": 305397771 }, "rust": { "allocation": { "count": 1022, "record": null, "registrations": [], "retry": 0, "scan_index": 0, "selected": null, "status": "diagnostic-loop-pending" }, "effects": [], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516416, "flags104": 2147483650, "weapon": 305397771 } }, "source": { "allocation": { "count": 1022, "record": null, "registrations": [], "retry": 0, "scan_index": 0, "selected": null, "status": "diagnostic-loop-pending" }, "effects": [], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516416, "flags104": 2147483650, "weapon": 305397771 } } }, { "input": { "allocation": { "count": 1024, "profile": 10, "slots": [], "start": 0, "tick": 5000 }, "animation": 99, "branch": "far", "busy": 1, "clock": 0, "complete": 0, "duration": 5, "flags": 2147516512, "flags104": 2147483666, "index": 3, "tick": 5000, "weapon": 305397771 }, "rust": { "allocation": { "count": 1025, "record": null, "registrations": [], "retry": 2, "scan_index": 1024, "selected": null, "status": "fatal-error-pending" }, "effects": [], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516512, "flags104": 2147483650, "weapon": 305397771 } }, "source": { "allocation": { "count": 1025, "record": null, "registrations": [], "retry": 2, "scan_index": 1024, "selected": null, "status": "fatal-error-pending" }, "effects": [], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516512, "flags104": 2147483650, "weapon": 305397771 } } }, { "input": { "allocation": { "count": 1024, "profile": 10, "slots": [], "start": 0, "tick": 5000 }, "animation": 99, "branch": "far", "busy": 1, "clock": 0, "complete": 0, "duration": 5, "flags": 2147516420, "flags104": 2147483666, "index": 3, "tick": 5000, "weapon": 305397771 }, "rust": { "allocation": { "count": 1025, "record": null, "registrations": [], "retry": 2, "scan_index": 1024, "selected": null, "status": "fatal-error-pending" }, "effects": [], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516416, "flags104": 2147483650, "weapon": 305397771 } }, "source": { "allocation": { "count": 1025, "record": null, "registrations": [], "retry": 2, "scan_index": 1024, "selected": null, "status": "fatal-error-pending" }, "effects": [], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516416, "flags104": 2147483650, "weapon": 305397771 } } }, { "input": { "allocation": { "count": 1022, "profile": 8, "slots": [], "start": 0, "tick": 5000 }, "animation": 99, "branch": "unflagged", "busy": 1, "clock": 0, "complete": 0, "duration": 5, "flags": 2147516512, "flags104": 2147483666, "index": 3, "tick": 5000, "weapon": 305397771 }, "rust": { "allocation": { "count": 1022, "record": null, "registrations": [], "retry": 0, "scan_index": 0, "selected": null, "status": "diagnostic-loop-pending" }, "effects": [], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516512, "flags104": 2147483650, "weapon": 305397771 } }, "source": { "allocation": { "count": 1022, "record": null, "registrations": [], "retry": 0, "scan_index": 0, "selected": null, "status": "diagnostic-loop-pending" }, "effects": [], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516512, "flags104": 2147483650, "weapon": 305397771 } } }, { "input": { "allocation": { "count": 1022, "profile": 8, "slots": [], "start": 0, "tick": 5000 }, "animation": 99, "branch": "unflagged", "busy": 1, "clock": 0, "complete": 0, "duration": 5, "flags": 2147516420, "flags104": 2147483666, "index": 3, "tick": 5000, "weapon": 305397771 }, "rust": { "allocation": { "count": 1022, "record": null, "registrations": [], "retry": 0, "scan_index": 0, "selected": null, "status": "diagnostic-loop-pending" }, "effects": [], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516416, "flags104": 2147483650, "weapon": 305397771 } }, "source": { "allocation": { "count": 1022, "record": null, "registrations": [], "retry": 0, "scan_index": 0, "selected": null, "status": "diagnostic-loop-pending" }, "effects": [], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516416, "flags104": 2147483650, "weapon": 305397771 } } }, { "input": { "allocation": { "count": 1024, "profile": 10, "slots": [], "start": 0, "tick": 5000 }, "animation": 99, "branch": "unflagged", "busy": 1, "clock": 0, "complete": 0, "duration": 5, "flags": 2147516512, "flags104": 2147483666, "index": 3, "tick": 5000, "weapon": 305397771 }, "rust": { "allocation": { "count": 1025, "record": null, "registrations": [], "retry": 2, "scan_index": 1024, "selected": null, "status": "fatal-error-pending" }, "effects": [], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516512, "flags104": 2147483650, "weapon": 305397771 } }, "source": { "allocation": { "count": 1025, "record": null, "registrations": [], "retry": 2, "scan_index": 1024, "selected": null, "status": "fatal-error-pending" }, "effects": [], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516512, "flags104": 2147483650, "weapon": 305397771 } } }, { "input": { "allocation": { "count": 1024, "profile": 10, "slots": [], "start": 0, "tick": 5000 }, "animation": 99, "branch": "unflagged", "busy": 1, "clock": 0, "complete": 0, "duration": 5, "flags": 2147516420, "flags104": 2147483666, "index": 3, "tick": 5000, "weapon": 305397771 }, "rust": { "allocation": { "count": 1025, "record": null, "registrations": [], "retry": 2, "scan_index": 1024, "selected": null, "status": "fatal-error-pending" }, "effects": [], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516416, "flags104": 2147483650, "weapon": 305397771 } }, "source": { "allocation": { "count": 1025, "record": null, "registrations": [], "retry": 2, "scan_index": 1024, "selected": null, "status": "fatal-error-pending" }, "effects": [], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 0, "event": [ 7, 2147483649 ], "flags": 2147516416, "flags104": 2147483650, "weapon": 305397771 } } }, { "input": { "allocation": { "count": 1022, "profile": 8, "slots": [], "start": 0, "tick": 5000 }, "animation": 99, "branch": "finish", "busy": 1, "clock": 0, "complete": 0, "duration": 5, "flags": 2147516512, "flags104": 2147483666, "index": 3, "tick": 5000, "weapon": 305397771 }, "rust": { "allocation": { "count": 1022, "record": null, "registrations": [], "retry": 0, "scan_index": 0, "selected": null, "status": "diagnostic-loop-pending" }, "effects": [ { "format": "426f6d62207761732064656675736564206279202569210a", "op": "log", "slot": 2 } ], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 1, "event": [ 7, 2147483649 ], "flags": 2147516512, "flags104": 2147483650, "weapon": 305397771 } }, "source": { "allocation": { "count": 1022, "record": null, "registrations": [], "retry": 0, "scan_index": 0, "selected": null, "status": "diagnostic-loop-pending" }, "effects": [ { "format": "426f6d62207761732064656675736564206279202569210a", "op": "log", "slot": 2 } ], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 1, "event": [ 7, 2147483649 ], "flags": 2147516512, "flags104": 2147483650, "weapon": 305397771 } } }, { "input": { "allocation": { "count": 1022, "profile": 8, "slots": [], "start": 0, "tick": 5000 }, "animation": 99, "branch": "finish", "busy": 1, "clock": 0, "complete": 0, "duration": 5, "flags": 2147516420, "flags104": 2147483666, "index": 3, "tick": 5000, "weapon": 305397771 }, "rust": { "allocation": { "count": 1022, "record": null, "registrations": [], "retry": 0, "scan_index": 0, "selected": null, "status": "diagnostic-loop-pending" }, "effects": [ { "format": "426f6d62207761732064656675736564206279202569210a", "op": "log", "slot": 2 } ], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 1, "event": [ 7, 2147483649 ], "flags": 2147516416, "flags104": 2147483650, "weapon": 305397771 } }, "source": { "allocation": { "count": 1022, "record": null, "registrations": [], "retry": 0, "scan_index": 0, "selected": null, "status": "diagnostic-loop-pending" }, "effects": [ { "format": "426f6d62207761732064656675736564206279202569210a", "op": "log", "slot": 2 } ], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 1, "event": [ 7, 2147483649 ], "flags": 2147516416, "flags104": 2147483650, "weapon": 305397771 } } }, { "input": { "allocation": { "count": 1024, "profile": 10, "slots": [], "start": 0, "tick": 5000 }, "animation": 99, "branch": "finish", "busy": 1, "clock": 0, "complete": 0, "duration": 5, "flags": 2147516512, "flags104": 2147483666, "index": 3, "tick": 5000, "weapon": 305397771 }, "rust": { "allocation": { "count": 1025, "record": null, "registrations": [], "retry": 2, "scan_index": 1024, "selected": null, "status": "fatal-error-pending" }, "effects": [ { "format": "426f6d62207761732064656675736564206279202569210a", "op": "log", "slot": 2 } ], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 1, "event": [ 7, 2147483649 ], "flags": 2147516512, "flags104": 2147483650, "weapon": 305397771 } }, "source": { "allocation": { "count": 1025, "record": null, "registrations": [], "retry": 2, "scan_index": 1024, "selected": null, "status": "fatal-error-pending" }, "effects": [ { "format": "426f6d62207761732064656675736564206279202569210a", "op": "log", "slot": 2 } ], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 1, "event": [ 7, 2147483649 ], "flags": 2147516512, "flags104": 2147483650, "weapon": 305397771 } } }, { "input": { "allocation": { "count": 1024, "profile": 10, "slots": [], "start": 0, "tick": 5000 }, "animation": 99, "branch": "finish", "busy": 1, "clock": 0, "complete": 0, "duration": 5, "flags": 2147516420, "flags104": 2147483666, "index": 3, "tick": 5000, "weapon": 305397771 }, "rust": { "allocation": { "count": 1025, "record": null, "registrations": [], "retry": 2, "scan_index": 1024, "selected": null, "status": "fatal-error-pending" }, "effects": [ { "format": "426f6d62207761732064656675736564206279202569210a", "op": "log", "slot": 2 } ], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 1, "event": [ 7, 2147483649 ], "flags": 2147516416, "flags104": 2147483650, "weapon": 305397771 } }, "source": { "allocation": { "count": 1025, "record": null, "registrations": [], "retry": 2, "scan_index": 1024, "selected": null, "status": "fatal-error-pending" }, "effects": [ { "format": "426f6d62207761732064656675736564206279202569210a", "op": "log", "slot": 2 } ], "event_kind": 84, "state": { "animation": 99, "busy": 0, "clock": 0, "complete": 1, "event": [ 7, 2147483649 ], "flags": 2147516416, "flags104": 2147483650, "weapon": 305397771 } } } ], "source_report": "docs/research/qvm-defuse-allocation-terminal.json", "source_report_sha256": "9ad67032578ad8257be9f80b8c17ef9ebe70643734c54a57c0509ff0b9de79a3"}1234567891011121314151617181920212223242526272829303132333435"""Compare Rust defuse allocation terminals with the traced QVM prefixes."""import hashlibimport jsonimport osimport subprocessfrom pathlib import Path
from analyze_qvm import write_jsonfrom analyze_rust_defuse_begin import encode as encode_defusefrom analyze_rust_location_allocation import encode as encode_poolfrom rust_lifecycle_support import result
def main(): subprocess.run(['cargo', 'build', '--offline', '--package', 'urt-gameplay', '--bin', 'urt-location-feedback'], check=True) binary = Path(os.environ.get('CARGO_TARGET_DIR', 'target')) / 'debug' / 'urt-location-feedback' path = Path('docs/research/qvm-defuse-allocation-terminal.json') data = path.read_bytes() branches = {'start': 0, 'far': 1, 'unflagged': 1, 'finish': 2} probes = [] for row in json.loads(data)['probes']: a = row['input'] expected = {key: row[key] for key in ('state', 'event_kind', 'effects', 'allocation')} expected['state'] = {key: value for key, value in row['state'].items() if key != 'guards'} args = [*encode_defuse(a), branches[a['branch']], *encode_pool(a['allocation'])] probes.append(dict(input=a, source=expected, rust=result(binary, 'defuse-terminal', args))) write_json(Path('docs/research/rust-defuse-allocation-terminal.json'), { 'source_report': str(path), 'source_report_sha256': hashlib.sha256(data).hexdigest(), 'probes': probes, 'limits': 'Caller-state and allocator parity before native diagnostic/fatal handling.', })
if __name__ == '__main__': main()12345678910111213141516171819import hashlibimport jsonimport unittestfrom pathlib import Path
class DefuseAllocationTerminalParity(unittest.TestCase): def test_terminal_prefixes(self): report = json.loads(Path('docs/research/rust-defuse-allocation-terminal.json').read_text()) digest = hashlib.sha256(Path(report['source_report']).read_bytes()).hexdigest() self.assertEqual(report['source_report_sha256'], digest) self.assertEqual(len(report['probes']), 16) for row in report['probes']: with self.subTest(input=row['input']): self.assertEqual(row['source'], row['rust'])
if __name__ == '__main__': unittest.main()4746 unmodified lines4747474847494746 unmodified linesedge scripts/qvm_location_feedback_oracle.py scripts/test_qvm_defuse_allocation_terminal.pyedge scripts/analyze_qvm_entity_allocate.py scripts/analyze_qvm_defuse_allocation_terminal.pyedge scripts/analyze_qvm_defuse_allocation_terminal.py scripts/analyze_qvm_resumer_audit.py4746 unmodified lines47474748474947504751475247534754475547564757475847594746 unmodified linesedge scripts/qvm_location_feedback_oracle.py scripts/test_qvm_defuse_allocation_terminal.pyedge scripts/analyze_qvm_entity_allocate.py scripts/analyze_qvm_defuse_allocation_terminal.pyedge scripts/analyze_qvm_defuse_allocation_terminal.py scripts/analyze_qvm_resumer_audit.pyreport scripts/analyze_rust_defuse_allocation_terminal.py docs/research/rust-defuse-allocation-terminal.jsonedge docs/research/rust-defuse-allocation-terminal.json scripts/test_rust_defuse_allocation_terminal.pygroup rust-defuse-allocation-terminal scripts/analyze_rust_defuse_allocation_terminal.pygroup rust-defuse-allocation-terminal scripts/analyze_rust_location_allocated_defuse.pygroup gameplay scripts/analyze_rust_defuse_allocation_terminal.pyedge docs/research/qvm-defuse-allocation-terminal.json scripts/analyze_rust_defuse_allocation_terminal.pyedge crates/urt-gameplay/src/location_feedback.rs scripts/analyze_rust_defuse_allocation_terminal.pyedge crates/urt-gameplay/src/bin/urt-location-feedback.rs scripts/analyze_rust_defuse_allocation_terminal.pyedge crates/urt-gameplay/src/defuse.rs scripts/analyze_rust_defuse_allocation_terminal.pyedge crates/urt-gameplay/src/transition.rs scripts/analyze_rust_defuse_allocation_terminal.py
crates/urt-gameplay/src/bin/urt-location-feedback.rs+60-4
crates/urt-gameplay/src/location_feedback.rs+97-7
docs/FINDINGS.md+2
docs/PROVISIONAL_TODO.md+2
docs/RESEARCH_LEDGER.md+4
docs/research/QVM_LOCATION_ALLOCATION_BATCH.md+2
docs/research/README.md+2
docs/research/RUST_DEFUSE_ALLOCATION_TERMINAL.mdAdded+7
docs/research/rust-defuse-allocation-terminal.jsonAdded+1239
scripts/analyze_rust_defuse_allocation_terminal.pyAdded+35
scripts/test_rust_defuse_allocation_terminal.pyAdded+19
xtask/checks.tsv+10