nmarshall commited on
Commit
4ecdaca
·
1 Parent(s): 5b2d5fa

gameplay: verify defuse slot reuse replay

Browse files
crates/urt-gameplay/src/bin/urt-defuse.rs CHANGED
@@ -7,8 +7,8 @@ mod radio_fixture;
7
  use entity_pool::{allocation_fields, decode_pool, record};
8
  use urt_gameplay::defuse::*;
9
  use urt_gameplay::location_feedback::{
10
- DefuseAllocation, DefuseRadioContext, EntityPool, process_allocated_defuse,
11
- process_located_defuse,
12
  };
13
  fn list(v: &[u32]) -> String {
14
  format!(
@@ -100,6 +100,7 @@ fn main() {
100
  }
101
  "full" => println!("{}", full(&w)),
102
  "allocated-full" => println!("{}", allocated_full(&w)),
 
103
  "located-full" => println!("{}", located_full(&w)),
104
  "sequence" => println!("{}", sequence(&w)),
105
  _ => panic!("unknown policy"),
@@ -314,11 +315,11 @@ fn allocated_fields(
314
  0, 4, 12, 16, 20, 24, 28, 32, 36, 40, 44, 84, 140, 180, 184, 188, 400, 424, 488, 492, 496,
315
  512, 532, 536, 540, 564, 568, 572,
316
  ];
317
- routing.effects = allocated.before_allocation;
318
- routing.effects.push(DefuseEffect::Allocate {
319
- event: allocated.event_kind,
320
- });
321
- routing.effects.extend(allocated.after_allocation);
322
  let final_fields = record(final_record, &fields);
323
  let guards = [final_record[180 / 4], final_record[188 / 4]];
324
  pool.slots[slot] = allocated.initialized.unwrap();
@@ -332,3 +333,98 @@ fn allocated_fields(
332
  link.record.words[424 / 4]
333
  )
334
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7
  use entity_pool::{allocation_fields, decode_pool, record};
8
  use urt_gameplay::defuse::*;
9
  use urt_gameplay::location_feedback::{
10
+ DefuseAllocation, DefuseRadioContext, EntityPool, EntityRelease, expire_entity_event,
11
+ process_allocated_defuse, process_located_defuse,
12
  };
13
  fn list(v: &[u32]) -> String {
14
  format!(
 
100
  }
101
  "full" => println!("{}", full(&w)),
102
  "allocated-full" => println!("{}", allocated_full(&w)),
103
+ "event-lifecycle" => println!("{}", event_lifecycle(&w)),
104
  "located-full" => println!("{}", located_full(&w)),
105
  "sequence" => println!("{}", sequence(&w)),
106
  _ => panic!("unknown policy"),
 
315
  0, 4, 12, 16, 20, 24, 28, 32, 36, 40, 44, 84, 140, 180, 184, 188, 400, 424, 488, 492, 496,
316
  512, 532, 536, 540, 564, 568, 572,
317
  ];
318
+ routing.effects = allocation_effects(
319
+ allocated.before_allocation,
320
+ allocated.event_kind,
321
+ allocated.after_allocation,
322
+ );
323
  let final_fields = record(final_record, &fields);
324
  let guards = [final_record[180 / 4], final_record[188 / 4]];
325
  pool.slots[slot] = allocated.initialized.unwrap();
 
333
  link.record.words[424 / 4]
334
  )
335
  }
336
+
337
+ fn allocation_effects(
338
+ mut before: Vec<DefuseEffect>,
339
+ event: u32,
340
+ after: Vec<DefuseEffect>,
341
+ ) -> Vec<DefuseEffect> {
342
+ before.push(DefuseEffect::Allocate { event });
343
+ before.extend(after);
344
+ before
345
+ }
346
+
347
+ fn event_lifecycle(w: &[u32]) -> String {
348
+ let (mut world, mut input) = decode_full(&w[..31]);
349
+ let gap = w[31];
350
+ let (mut pool, _, start) = decode_pool(&w[32..]);
351
+ for slot in &mut pool.slots[64..69] {
352
+ for offset in [
353
+ 180, 520, 528, 548, 576, 556, 536, 560, 604, 608, 592, 612, 616, 620,
354
+ ] {
355
+ slot.words[offset / 4] = 0;
356
+ }
357
+ slot.words[424 / 4] = 0x12345658;
358
+ }
359
+ let resume_tick = 10301 + gap;
360
+ let schedule = [
361
+ (10000, Some(10f32)),
362
+ (10300, None),
363
+ (10301, Some(75f32)),
364
+ (10602, None),
365
+ (resume_tick, Some(10f32)),
366
+ (resume_tick + 5000, Some(10f32)),
367
+ (resume_tick + 5301, None),
368
+ ];
369
+ let mut frames = Vec::new();
370
+ for (tick, distance) in schedule {
371
+ let mut expiries = Vec::new();
372
+ for index in 64..pool.count as usize {
373
+ let slot = &mut pool.slots[index];
374
+ if slot.words[532 / 4] == 0 {
375
+ continue;
376
+ }
377
+ let expiry = expire_entity_event(slot, tick, None, |_| None).unwrap();
378
+ let requests = expiry
379
+ .releases
380
+ .iter()
381
+ .map(|release| match release {
382
+ EntityRelease::Unlink => "-32",
383
+ EntityRelease::ReleaseObject(_) => "16934",
384
+ EntityRelease::ReleaseResource(_) => "249639",
385
+ })
386
+ .collect::<Vec<_>>()
387
+ .join(",");
388
+ expiries.push(format!(r#"{{"slot":{index},"requests":[{requests}]}}"#));
389
+ }
390
+ let mut registrations = vec![];
391
+ let mut selected = "null".to_string();
392
+ let mut effects = Vec::new();
393
+ if let Some(distance) = distance {
394
+ input.base.tick = tick;
395
+ world.bombs[4].point[0] = distance.to_bits();
396
+ if let (_, Some(outcome)) =
397
+ process_allocated_defuse(&mut world, &mut pool, input, start).unwrap()
398
+ {
399
+ selected = outcome.allocation.selected.unwrap().to_string();
400
+ registrations = outcome.allocation.registrations;
401
+ effects = allocation_effects(
402
+ outcome.before_allocation,
403
+ outcome.event_kind,
404
+ outcome.after_allocation,
405
+ );
406
+ }
407
+ }
408
+ let mut active = Vec::new();
409
+ let mut free = Vec::new();
410
+ for index in 64..pool.count as usize {
411
+ let words = &pool.slots[index].words;
412
+ if words[532 / 4] != 0 {
413
+ active.push(list(&[
414
+ index as u32,
415
+ words[4 / 4],
416
+ words[184 / 4],
417
+ words[568 / 4],
418
+ ]));
419
+ } else {
420
+ free.push(list(&[index as u32, words[564 / 4]]));
421
+ }
422
+ }
423
+ frames.push(format!(
424
+ r#"{{"tick":{tick},"count":{},"selected":{selected},"registrations":{},"active":[{}],"free":[{}],"events":[{}],"expiries":[{}]}}"#,
425
+ pool.count, list(&registrations), active.join(","), free.join(","),
426
+ events(&effects), expiries.join(",")
427
+ ));
428
+ }
429
+ format!(r#"{{"gap":{gap},"frames":[{}]}}"#, frames.join(","))
430
+ }
docs/FINDINGS.md CHANGED
@@ -2051,3 +2051,5 @@ RE-1034–1043 batch validation passed:2,018 Python tests,339 Rust tests,146 det
2051
  - Rust can advance the temporary-event lifetime independently of entity dispatch and expose the resulting free and unlink plans. [Rust frame expiry](research/RUST_ENTITY_EVENT_EXPIRY.md).
2052
 
2053
  - On the held defuse sequence, moving restart from free age 999 to 1000 changes the selected slot from a new record to the original freed slot. [Shared-pool lifecycle trace](research/QVM_DEFUSE_EVENT_LIFECYCLE.md).
 
 
 
2051
  - Rust can advance the temporary-event lifetime independently of entity dispatch and expose the resulting free and unlink plans. [Rust frame expiry](research/RUST_ENTITY_EVENT_EXPIRY.md).
2052
 
2053
  - On the held defuse sequence, moving restart from free age 999 to 1000 changes the selected slot from a new record to the original freed slot. [Shared-pool lifecycle trace](research/QVM_DEFUSE_EVENT_LIFECYCLE.md).
2054
+
2055
+ - The Rust expiry and allocated defuse APIs agree with source slot reuse, free timestamps and request ordering across both replay schedules. [Rust lifecycle parity](research/RUST_DEFUSE_EVENT_LIFECYCLE.md).
docs/PROVISIONAL_TODO.md CHANGED
@@ -2113,3 +2113,5 @@ RE-974–983 completed routing, command rewrite, inactivity, movement-parameter
2113
  - [x] RE-1052 Port the per-entity frame event expiry gate to Rust ([evidence](research/RUST_ENTITY_EVENT_EXPIRY.md)).
2114
 
2115
  - [x] RE-1053 Trace defuse allocation, expiry and slot reuse across a shared pool ([evidence](research/QVM_DEFUSE_EVENT_LIFECYCLE.md)).
 
 
 
2113
  - [x] RE-1052 Port the per-entity frame event expiry gate to Rust ([evidence](research/RUST_ENTITY_EVENT_EXPIRY.md)).
2114
 
2115
  - [x] RE-1053 Trace defuse allocation, expiry and slot reuse across a shared pool ([evidence](research/QVM_DEFUSE_EVENT_LIFECYCLE.md)).
2116
+
2117
+ - [x] RE-1054 Verify Rust shared-pool defuse event lifecycle parity ([evidence](research/RUST_DEFUSE_EVENT_LIFECYCLE.md)).
docs/RESEARCH_LEDGER.md CHANGED
@@ -2887,3 +2887,7 @@ Rust applies event expiration, dispatch suppression and release or unlink orderi
2887
  ## 2026-11-25 — RE-1053 Trace defuse allocation, expiry and slot reuse across a shared pool
2888
 
2889
  Two seven-frame sequences verify actual start, cancel, restart and completion with shared expiry and allocation state. The 999-to-1000 free-age boundary changes whether defuse extends the pool or reuses slot 64. See [lifecycle findings](research/QVM_DEFUSE_EVENT_LIFECYCLE.md).
 
 
 
 
 
2887
  ## 2026-11-25 — RE-1053 Trace defuse allocation, expiry and slot reuse across a shared pool
2888
 
2889
  Two seven-frame sequences verify actual start, cancel, restart and completion with shared expiry and allocation state. The 999-to-1000 free-age boundary changes whether defuse extends the pool or reuses slot 64. See [lifecycle findings](research/QVM_DEFUSE_EVENT_LIFECYCLE.md).
2890
+
2891
+ ## 2026-11-25 — RE-1054 Verify Rust shared-pool defuse event lifecycle parity
2892
+
2893
+ The allocated callback and per-entity expiry gate match both seven-frame source sequences when driven against one Rust pool. See [lifecycle parity](research/RUST_DEFUSE_EVENT_LIFECYCLE.md).
docs/research/QVM_LOCATION_ALLOCATION_BATCH.md CHANGED
@@ -87,3 +87,5 @@ RE-1051 traces [the frame-level event expiry gate](QVM_ENTITY_EVENT_EXPIRY.md).
87
  RE-1052 matches the 30 traced frame cases in [the Rust expiry gate](RUST_ENTITY_EVENT_EXPIRY.md), reusing the ported entity free routine for temporary events.
88
 
89
  RE-1053 traces [defuse allocation, expiry and reuse across seven frames](QVM_DEFUSE_EVENT_LIFECYCLE.md). At restart, a one-tick difference changes the selected slot and registration count.
 
 
 
87
  RE-1052 matches the 30 traced frame cases in [the Rust expiry gate](RUST_ENTITY_EVENT_EXPIRY.md), reusing the ported entity free routine for temporary events.
88
 
89
  RE-1053 traces [defuse allocation, expiry and reuse across seven frames](QVM_DEFUSE_EVENT_LIFECYCLE.md). At restart, a one-tick difference changes the selected slot and registration count.
90
+
91
+ RE-1054 verifies [the Rust shared-pool replay](RUST_DEFUSE_EVENT_LIFECYCLE.md) against both seven-frame schedules. The fixture explicitly initializes the temporary slots with no client pointer or pending client event.
docs/research/README.md CHANGED
@@ -1679,3 +1679,5 @@ The extension collector adds five focused tests for native tail calls, command-r
1679
  - [Entity event expiry in Rust](RUST_ENTITY_EVENT_EXPIRY.md)
1680
 
1681
  - [Defuse event allocation and expiry on one pool](QVM_DEFUSE_EVENT_LIFECYCLE.md)
 
 
 
1679
  - [Entity event expiry in Rust](RUST_ENTITY_EVENT_EXPIRY.md)
1680
 
1681
  - [Defuse event allocation and expiry on one pool](QVM_DEFUSE_EVENT_LIFECYCLE.md)
1682
+
1683
+ - [Defuse temporary-event lifecycle in Rust](RUST_DEFUSE_EVENT_LIFECYCLE.md)
docs/research/RUST_DEFUSE_EVENT_LIFECYCLE.md ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ # Defuse temporary-event lifecycle in Rust
2
+
3
+ The `urt-defuse event-lifecycle` fixture advances one actor, bomb and pool through the seven source frames. It applies the Rust expiry gate to live event slots, then calls the allocated callback where the fixture schedules one. Both source and Rust explicitly seed these temporary records without attached clients or pending client events.
4
+
5
+ The [parity report](rust-defuse-event-lifecycle.json) compares both schedules at free ages 999 and 1000, including live slot identity, timestamps, caller effect ordering, allocation registration and expiry requests. It verifies the composition through the existing Rust entry points. Frame ordering comes from the fixture. Runtime scheduling and native effect dispatch remain open.
docs/research/qvm-defuse-event-lifecycle.json CHANGED
@@ -121,8 +121,8 @@
121
  {
122
  "execution": {
123
  "stop": 15623,
124
- "trace_length": 61,
125
- "trace_sha256": "e52693786a7387976ee9a7302f5e4a470915e3e4cc6ed5961bf633d7393c8ab6"
126
  },
127
  "requests": [
128
  -32,
@@ -151,8 +151,8 @@
151
  {
152
  "execution": {
153
  "stop": 15623,
154
- "trace_length": 61,
155
- "trace_sha256": "e52693786a7387976ee9a7302f5e4a470915e3e4cc6ed5961bf633d7393c8ab6"
156
  },
157
  "requests": [
158
  -32,
@@ -247,8 +247,8 @@
247
  {
248
  "execution": {
249
  "stop": 15623,
250
- "trace_length": 61,
251
- "trace_sha256": "e52693786a7387976ee9a7302f5e4a470915e3e4cc6ed5961bf633d7393c8ab6"
252
  },
253
  "requests": [
254
  -32,
@@ -388,8 +388,8 @@
388
  {
389
  "execution": {
390
  "stop": 15623,
391
- "trace_length": 61,
392
- "trace_sha256": "e52693786a7387976ee9a7302f5e4a470915e3e4cc6ed5961bf633d7393c8ab6"
393
  },
394
  "requests": [
395
  -32,
@@ -418,8 +418,8 @@
418
  {
419
  "execution": {
420
  "stop": 15623,
421
- "trace_length": 61,
422
- "trace_sha256": "e52693786a7387976ee9a7302f5e4a470915e3e4cc6ed5961bf633d7393c8ab6"
423
  },
424
  "requests": [
425
  -32,
 
121
  {
122
  "execution": {
123
  "stop": 15623,
124
+ "trace_length": 39,
125
+ "trace_sha256": "1e9149718ae731afeaa13c52cee6d994af924c17ec15d261a46770040b4f3242"
126
  },
127
  "requests": [
128
  -32,
 
151
  {
152
  "execution": {
153
  "stop": 15623,
154
+ "trace_length": 39,
155
+ "trace_sha256": "1e9149718ae731afeaa13c52cee6d994af924c17ec15d261a46770040b4f3242"
156
  },
157
  "requests": [
158
  -32,
 
247
  {
248
  "execution": {
249
  "stop": 15623,
250
+ "trace_length": 39,
251
+ "trace_sha256": "1e9149718ae731afeaa13c52cee6d994af924c17ec15d261a46770040b4f3242"
252
  },
253
  "requests": [
254
  -32,
 
388
  {
389
  "execution": {
390
  "stop": 15623,
391
+ "trace_length": 39,
392
+ "trace_sha256": "1e9149718ae731afeaa13c52cee6d994af924c17ec15d261a46770040b4f3242"
393
  },
394
  "requests": [
395
  -32,
 
418
  {
419
  "execution": {
420
  "stop": 15623,
421
+ "trace_length": 39,
422
+ "trace_sha256": "1e9149718ae731afeaa13c52cee6d994af924c17ec15d261a46770040b4f3242"
423
  },
424
  "requests": [
425
  -32,
docs/research/rust-defuse-event-lifecycle.json ADDED
@@ -0,0 +1,951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14
+ ]
15
+ ],
16
+ "count": 65,
17
+ "events": [
18
+ {
19
+ "event": 83,
20
+ "op": "allocate"
21
+ },
22
+ {
23
+ "op": "sound",
24
+ "slot": 2,
25
+ "sound": 7
26
+ }
27
+ ],
28
+ "expiries": [],
29
+ "free": [],
30
+ "registrations": [
31
+ 65
32
+ ],
33
+ "selected": 64,
34
+ "tick": 10000
35
+ },
36
+ {
37
+ "active": [
38
+ [
39
+ 64,
40
+ 102,
41
+ 5,
42
+ 10000
43
+ ]
44
+ ],
45
+ "count": 65,
46
+ "events": [],
47
+ "expiries": [
48
+ {
49
+ "requests": [],
50
+ "slot": 64
51
+ }
52
+ ],
53
+ "free": [],
54
+ "registrations": [],
55
+ "selected": null,
56
+ "tick": 10300
57
+ },
58
+ {
59
+ "active": [
60
+ [
61
+ 65,
62
+ 103,
63
+ 0,
64
+ 10301
65
+ ]
66
+ ],
67
+ "count": 66,
68
+ "events": [
69
+ {
70
+ "event": 84,
71
+ "op": "allocate"
72
+ }
73
+ ],
74
+ "expiries": [
75
+ {
76
+ "requests": [
77
+ -32,
78
+ 249639
79
+ ],
80
+ "slot": 64
81
+ }
82
+ ],
83
+ "free": [
84
+ [
85
+ 64,
86
+ 10301
87
+ ]
88
+ ],
89
+ "registrations": [
90
+ 66
91
+ ],
92
+ "selected": 65,
93
+ "tick": 10301
94
+ },
95
+ {
96
+ "active": [],
97
+ "count": 66,
98
+ "events": [],
99
+ "expiries": [
100
+ {
101
+ "requests": [
102
+ -32,
103
+ 249639
104
+ ],
105
+ "slot": 65
106
+ }
107
+ ],
108
+ "free": [
109
+ [
110
+ 64,
111
+ 10301
112
+ ],
113
+ [
114
+ 65,
115
+ 10602
116
+ ]
117
+ ],
118
+ "registrations": [],
119
+ "selected": null,
120
+ "tick": 10602
121
+ },
122
+ {
123
+ "active": [
124
+ [
125
+ 66,
126
+ 102,
127
+ 5,
128
+ 11300
129
+ ]
130
+ ],
131
+ "count": 67,
132
+ "events": [
133
+ {
134
+ "event": 83,
135
+ "op": "allocate"
136
+ },
137
+ {
138
+ "op": "sound",
139
+ "slot": 2,
140
+ "sound": 7
141
+ }
142
+ ],
143
+ "expiries": [],
144
+ "free": [
145
+ [
146
+ 64,
147
+ 10301
148
+ ],
149
+ [
150
+ 65,
151
+ 10602
152
+ ]
153
+ ],
154
+ "registrations": [
155
+ 67
156
+ ],
157
+ "selected": 66,
158
+ "tick": 11300
159
+ },
160
+ {
161
+ "active": [
162
+ [
163
+ 64,
164
+ 103,
165
+ 1,
166
+ 16300
167
+ ]
168
+ ],
169
+ "count": 67,
170
+ "events": [
171
+ {
172
+ "format": "426f6d62207761732064656675736564206279202569210a",
173
+ "op": "log",
174
+ "slot": 2
175
+ },
176
+ {
177
+ "event": 84,
178
+ "op": "allocate"
179
+ },
180
+ {
181
+ "op": "teleport",
182
+ "slot": 2
183
+ },
184
+ {
185
+ "op": "award",
186
+ "slot": 2,
187
+ "value": 5
188
+ }
189
+ ],
190
+ "expiries": [
191
+ {
192
+ "requests": [
193
+ -32,
194
+ 249639
195
+ ],
196
+ "slot": 66
197
+ }
198
+ ],
199
+ "free": [
200
+ [
201
+ 65,
202
+ 10602
203
+ ],
204
+ [
205
+ 66,
206
+ 16300
207
+ ]
208
+ ],
209
+ "registrations": [],
210
+ "selected": 64,
211
+ "tick": 16300
212
+ },
213
+ {
214
+ "active": [],
215
+ "count": 67,
216
+ "events": [],
217
+ "expiries": [
218
+ {
219
+ "requests": [
220
+ -32,
221
+ 249639
222
+ ],
223
+ "slot": 64
224
+ }
225
+ ],
226
+ "free": [
227
+ [
228
+ 64,
229
+ 16601
230
+ ],
231
+ [
232
+ 65,
233
+ 10602
234
+ ],
235
+ [
236
+ 66,
237
+ 16300
238
+ ]
239
+ ],
240
+ "registrations": [],
241
+ "selected": null,
242
+ "tick": 16601
243
+ }
244
+ ],
245
+ "gap": 999
246
+ },
247
+ "source": {
248
+ "frames": [
249
+ {
250
+ "active": [
251
+ [
252
+ 64,
253
+ 102,
254
+ 5,
255
+ 10000
256
+ ]
257
+ ],
258
+ "count": 65,
259
+ "events": [
260
+ {
261
+ "event": 83,
262
+ "op": "allocate"
263
+ },
264
+ {
265
+ "op": "sound",
266
+ "slot": 2,
267
+ "sound": 7
268
+ }
269
+ ],
270
+ "expiries": [],
271
+ "free": [],
272
+ "registrations": [
273
+ 65
274
+ ],
275
+ "selected": 64,
276
+ "tick": 10000
277
+ },
278
+ {
279
+ "active": [
280
+ [
281
+ 64,
282
+ 102,
283
+ 5,
284
+ 10000
285
+ ]
286
+ ],
287
+ "count": 65,
288
+ "events": [],
289
+ "expiries": [
290
+ {
291
+ "requests": [],
292
+ "slot": 64
293
+ }
294
+ ],
295
+ "free": [],
296
+ "registrations": [],
297
+ "selected": null,
298
+ "tick": 10300
299
+ },
300
+ {
301
+ "active": [
302
+ [
303
+ 65,
304
+ 103,
305
+ 0,
306
+ 10301
307
+ ]
308
+ ],
309
+ "count": 66,
310
+ "events": [
311
+ {
312
+ "event": 84,
313
+ "op": "allocate"
314
+ }
315
+ ],
316
+ "expiries": [
317
+ {
318
+ "requests": [
319
+ -32,
320
+ 249639
321
+ ],
322
+ "slot": 64
323
+ }
324
+ ],
325
+ "free": [
326
+ [
327
+ 64,
328
+ 10301
329
+ ]
330
+ ],
331
+ "registrations": [
332
+ 66
333
+ ],
334
+ "selected": 65,
335
+ "tick": 10301
336
+ },
337
+ {
338
+ "active": [],
339
+ "count": 66,
340
+ "events": [],
341
+ "expiries": [
342
+ {
343
+ "requests": [
344
+ -32,
345
+ 249639
346
+ ],
347
+ "slot": 65
348
+ }
349
+ ],
350
+ "free": [
351
+ [
352
+ 64,
353
+ 10301
354
+ ],
355
+ [
356
+ 65,
357
+ 10602
358
+ ]
359
+ ],
360
+ "registrations": [],
361
+ "selected": null,
362
+ "tick": 10602
363
+ },
364
+ {
365
+ "active": [
366
+ [
367
+ 66,
368
+ 102,
369
+ 5,
370
+ 11300
371
+ ]
372
+ ],
373
+ "count": 67,
374
+ "events": [
375
+ {
376
+ "event": 83,
377
+ "op": "allocate"
378
+ },
379
+ {
380
+ "op": "sound",
381
+ "slot": 2,
382
+ "sound": 7
383
+ }
384
+ ],
385
+ "expiries": [],
386
+ "free": [
387
+ [
388
+ 64,
389
+ 10301
390
+ ],
391
+ [
392
+ 65,
393
+ 10602
394
+ ]
395
+ ],
396
+ "registrations": [
397
+ 67
398
+ ],
399
+ "selected": 66,
400
+ "tick": 11300
401
+ },
402
+ {
403
+ "active": [
404
+ [
405
+ 64,
406
+ 103,
407
+ 1,
408
+ 16300
409
+ ]
410
+ ],
411
+ "count": 67,
412
+ "events": [
413
+ {
414
+ "format": "426f6d62207761732064656675736564206279202569210a",
415
+ "op": "log",
416
+ "slot": 2
417
+ },
418
+ {
419
+ "event": 84,
420
+ "op": "allocate"
421
+ },
422
+ {
423
+ "op": "teleport",
424
+ "slot": 2
425
+ },
426
+ {
427
+ "op": "award",
428
+ "slot": 2,
429
+ "value": 5
430
+ }
431
+ ],
432
+ "expiries": [
433
+ {
434
+ "requests": [
435
+ -32,
436
+ 249639
437
+ ],
438
+ "slot": 66
439
+ }
440
+ ],
441
+ "free": [
442
+ [
443
+ 65,
444
+ 10602
445
+ ],
446
+ [
447
+ 66,
448
+ 16300
449
+ ]
450
+ ],
451
+ "registrations": [],
452
+ "selected": 64,
453
+ "tick": 16300
454
+ },
455
+ {
456
+ "active": [],
457
+ "count": 67,
458
+ "events": [],
459
+ "expiries": [
460
+ {
461
+ "requests": [
462
+ -32,
463
+ 249639
464
+ ],
465
+ "slot": 64
466
+ }
467
+ ],
468
+ "free": [
469
+ [
470
+ 64,
471
+ 16601
472
+ ],
473
+ [
474
+ 65,
475
+ 10602
476
+ ],
477
+ [
478
+ 66,
479
+ 16300
480
+ ]
481
+ ],
482
+ "registrations": [],
483
+ "selected": null,
484
+ "tick": 16601
485
+ }
486
+ ],
487
+ "gap": 999
488
+ }
489
+ },
490
+ {
491
+ "rust": {
492
+ "frames": [
493
+ {
494
+ "active": [
495
+ [
496
+ 64,
497
+ 102,
498
+ 5,
499
+ 10000
500
+ ]
501
+ ],
502
+ "count": 65,
503
+ "events": [
504
+ {
505
+ "event": 83,
506
+ "op": "allocate"
507
+ },
508
+ {
509
+ "op": "sound",
510
+ "slot": 2,
511
+ "sound": 7
512
+ }
513
+ ],
514
+ "expiries": [],
515
+ "free": [],
516
+ "registrations": [
517
+ 65
518
+ ],
519
+ "selected": 64,
520
+ "tick": 10000
521
+ },
522
+ {
523
+ "active": [
524
+ [
525
+ 64,
526
+ 102,
527
+ 5,
528
+ 10000
529
+ ]
530
+ ],
531
+ "count": 65,
532
+ "events": [],
533
+ "expiries": [
534
+ {
535
+ "requests": [],
536
+ "slot": 64
537
+ }
538
+ ],
539
+ "free": [],
540
+ "registrations": [],
541
+ "selected": null,
542
+ "tick": 10300
543
+ },
544
+ {
545
+ "active": [
546
+ [
547
+ 65,
548
+ 103,
549
+ 0,
550
+ 10301
551
+ ]
552
+ ],
553
+ "count": 66,
554
+ "events": [
555
+ {
556
+ "event": 84,
557
+ "op": "allocate"
558
+ }
559
+ ],
560
+ "expiries": [
561
+ {
562
+ "requests": [
563
+ -32,
564
+ 249639
565
+ ],
566
+ "slot": 64
567
+ }
568
+ ],
569
+ "free": [
570
+ [
571
+ 64,
572
+ 10301
573
+ ]
574
+ ],
575
+ "registrations": [
576
+ 66
577
+ ],
578
+ "selected": 65,
579
+ "tick": 10301
580
+ },
581
+ {
582
+ "active": [],
583
+ "count": 66,
584
+ "events": [],
585
+ "expiries": [
586
+ {
587
+ "requests": [
588
+ -32,
589
+ 249639
590
+ ],
591
+ "slot": 65
592
+ }
593
+ ],
594
+ "free": [
595
+ [
596
+ 64,
597
+ 10301
598
+ ],
599
+ [
600
+ 65,
601
+ 10602
602
+ ]
603
+ ],
604
+ "registrations": [],
605
+ "selected": null,
606
+ "tick": 10602
607
+ },
608
+ {
609
+ "active": [
610
+ [
611
+ 64,
612
+ 102,
613
+ 5,
614
+ 11301
615
+ ]
616
+ ],
617
+ "count": 66,
618
+ "events": [
619
+ {
620
+ "event": 83,
621
+ "op": "allocate"
622
+ },
623
+ {
624
+ "op": "sound",
625
+ "slot": 2,
626
+ "sound": 7
627
+ }
628
+ ],
629
+ "expiries": [],
630
+ "free": [
631
+ [
632
+ 65,
633
+ 10602
634
+ ]
635
+ ],
636
+ "registrations": [],
637
+ "selected": 64,
638
+ "tick": 11301
639
+ },
640
+ {
641
+ "active": [
642
+ [
643
+ 65,
644
+ 103,
645
+ 1,
646
+ 16301
647
+ ]
648
+ ],
649
+ "count": 66,
650
+ "events": [
651
+ {
652
+ "format": "426f6d62207761732064656675736564206279202569210a",
653
+ "op": "log",
654
+ "slot": 2
655
+ },
656
+ {
657
+ "event": 84,
658
+ "op": "allocate"
659
+ },
660
+ {
661
+ "op": "teleport",
662
+ "slot": 2
663
+ },
664
+ {
665
+ "op": "award",
666
+ "slot": 2,
667
+ "value": 5
668
+ }
669
+ ],
670
+ "expiries": [
671
+ {
672
+ "requests": [
673
+ -32,
674
+ 249639
675
+ ],
676
+ "slot": 64
677
+ }
678
+ ],
679
+ "free": [
680
+ [
681
+ 64,
682
+ 16301
683
+ ]
684
+ ],
685
+ "registrations": [],
686
+ "selected": 65,
687
+ "tick": 16301
688
+ },
689
+ {
690
+ "active": [],
691
+ "count": 66,
692
+ "events": [],
693
+ "expiries": [
694
+ {
695
+ "requests": [
696
+ -32,
697
+ 249639
698
+ ],
699
+ "slot": 65
700
+ }
701
+ ],
702
+ "free": [
703
+ [
704
+ 64,
705
+ 16301
706
+ ],
707
+ [
708
+ 65,
709
+ 16602
710
+ ]
711
+ ],
712
+ "registrations": [],
713
+ "selected": null,
714
+ "tick": 16602
715
+ }
716
+ ],
717
+ "gap": 1000
718
+ },
719
+ "source": {
720
+ "frames": [
721
+ {
722
+ "active": [
723
+ [
724
+ 64,
725
+ 102,
726
+ 5,
727
+ 10000
728
+ ]
729
+ ],
730
+ "count": 65,
731
+ "events": [
732
+ {
733
+ "event": 83,
734
+ "op": "allocate"
735
+ },
736
+ {
737
+ "op": "sound",
738
+ "slot": 2,
739
+ "sound": 7
740
+ }
741
+ ],
742
+ "expiries": [],
743
+ "free": [],
744
+ "registrations": [
745
+ 65
746
+ ],
747
+ "selected": 64,
748
+ "tick": 10000
749
+ },
750
+ {
751
+ "active": [
752
+ [
753
+ 64,
754
+ 102,
755
+ 5,
756
+ 10000
757
+ ]
758
+ ],
759
+ "count": 65,
760
+ "events": [],
761
+ "expiries": [
762
+ {
763
+ "requests": [],
764
+ "slot": 64
765
+ }
766
+ ],
767
+ "free": [],
768
+ "registrations": [],
769
+ "selected": null,
770
+ "tick": 10300
771
+ },
772
+ {
773
+ "active": [
774
+ [
775
+ 65,
776
+ 103,
777
+ 0,
778
+ 10301
779
+ ]
780
+ ],
781
+ "count": 66,
782
+ "events": [
783
+ {
784
+ "event": 84,
785
+ "op": "allocate"
786
+ }
787
+ ],
788
+ "expiries": [
789
+ {
790
+ "requests": [
791
+ -32,
792
+ 249639
793
+ ],
794
+ "slot": 64
795
+ }
796
+ ],
797
+ "free": [
798
+ [
799
+ 64,
800
+ 10301
801
+ ]
802
+ ],
803
+ "registrations": [
804
+ 66
805
+ ],
806
+ "selected": 65,
807
+ "tick": 10301
808
+ },
809
+ {
810
+ "active": [],
811
+ "count": 66,
812
+ "events": [],
813
+ "expiries": [
814
+ {
815
+ "requests": [
816
+ -32,
817
+ 249639
818
+ ],
819
+ "slot": 65
820
+ }
821
+ ],
822
+ "free": [
823
+ [
824
+ 64,
825
+ 10301
826
+ ],
827
+ [
828
+ 65,
829
+ 10602
830
+ ]
831
+ ],
832
+ "registrations": [],
833
+ "selected": null,
834
+ "tick": 10602
835
+ },
836
+ {
837
+ "active": [
838
+ [
839
+ 64,
840
+ 102,
841
+ 5,
842
+ 11301
843
+ ]
844
+ ],
845
+ "count": 66,
846
+ "events": [
847
+ {
848
+ "event": 83,
849
+ "op": "allocate"
850
+ },
851
+ {
852
+ "op": "sound",
853
+ "slot": 2,
854
+ "sound": 7
855
+ }
856
+ ],
857
+ "expiries": [],
858
+ "free": [
859
+ [
860
+ 65,
861
+ 10602
862
+ ]
863
+ ],
864
+ "registrations": [],
865
+ "selected": 64,
866
+ "tick": 11301
867
+ },
868
+ {
869
+ "active": [
870
+ [
871
+ 65,
872
+ 103,
873
+ 1,
874
+ 16301
875
+ ]
876
+ ],
877
+ "count": 66,
878
+ "events": [
879
+ {
880
+ "format": "426f6d62207761732064656675736564206279202569210a",
881
+ "op": "log",
882
+ "slot": 2
883
+ },
884
+ {
885
+ "event": 84,
886
+ "op": "allocate"
887
+ },
888
+ {
889
+ "op": "teleport",
890
+ "slot": 2
891
+ },
892
+ {
893
+ "op": "award",
894
+ "slot": 2,
895
+ "value": 5
896
+ }
897
+ ],
898
+ "expiries": [
899
+ {
900
+ "requests": [
901
+ -32,
902
+ 249639
903
+ ],
904
+ "slot": 64
905
+ }
906
+ ],
907
+ "free": [
908
+ [
909
+ 64,
910
+ 16301
911
+ ]
912
+ ],
913
+ "registrations": [],
914
+ "selected": 65,
915
+ "tick": 16301
916
+ },
917
+ {
918
+ "active": [],
919
+ "count": 66,
920
+ "events": [],
921
+ "expiries": [
922
+ {
923
+ "requests": [
924
+ -32,
925
+ 249639
926
+ ],
927
+ "slot": 65
928
+ }
929
+ ],
930
+ "free": [
931
+ [
932
+ 64,
933
+ 16301
934
+ ],
935
+ [
936
+ 65,
937
+ 16602
938
+ ]
939
+ ],
940
+ "registrations": [],
941
+ "selected": null,
942
+ "tick": 16602
943
+ }
944
+ ],
945
+ "gap": 1000
946
+ }
947
+ }
948
+ ],
949
+ "source_report": "docs/research/qvm-defuse-event-lifecycle.json",
950
+ "source_report_sha256": "5c64be3c674b061ea810ee7029b7172135f9f661d874646c000a28d1f05318fd"
951
+ }
scripts/analyze_qvm_defuse_event_lifecycle.py CHANGED
@@ -19,7 +19,7 @@ def probe(ins, raw, header, a, gap):
19
  pointer = POOL + slot * 880
20
  for offset in range(0, 880, 4):
21
  m.setdefault(pointer + offset, 0x12345678)
22
- for offset in (528, 548, 576, *FIELDS):
23
  m[pointer + offset] = 0
24
  frames = []
25
 
 
19
  pointer = POOL + slot * 880
20
  for offset in range(0, 880, 4):
21
  m.setdefault(pointer + offset, 0x12345678)
22
+ for offset in (180, 520, 528, 548, 576, *FIELDS):
23
  m[pointer + offset] = 0
24
  frames = []
25
 
scripts/analyze_rust_defuse_event_lifecycle.py ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Compare the shared-pool Rust replay against source scheduling fixtures."""
2
+ import hashlib
3
+ import json
4
+ import os
5
+ import subprocess
6
+ from pathlib import Path
7
+
8
+ from analyze_qvm import write_json
9
+ from analyze_rust_defuse_complete import encode as encode_callback
10
+ from analyze_rust_location_allocation import encode as encode_pool
11
+ from rust_lifecycle_support import result
12
+
13
+
14
+ def main():
15
+ subprocess.run(['cargo', 'build', '--offline', '-p', 'urt-gameplay',
16
+ '--bin', 'urt-defuse'], check=True)
17
+ binary = Path(os.environ.get('CARGO_TARGET_DIR', 'target')) / 'debug' / 'urt-defuse'
18
+ path = Path('docs/research/qvm-defuse-event-lifecycle.json')
19
+ data = path.read_bytes()
20
+ source = json.loads(data)
21
+ a = source['initial']
22
+ probes = []
23
+ for row in source['probes']:
24
+ for frame in row['frames']:
25
+ for expiry in frame['expiries']:
26
+ del expiry['execution']
27
+ args = [*encode_callback(a), row['gap'], *encode_pool(a['allocation'])]
28
+ probes.append(dict(source=row, rust=result(binary, 'event-lifecycle', args)))
29
+ write_json(Path('docs/research/rust-defuse-event-lifecycle.json'), {
30
+ 'source_report': str(path), 'source_report_sha256': hashlib.sha256(data).hexdigest(),
31
+ 'probes': probes, 'limits': 'Fixture scheduling drives public Rust expiry and callback APIs. Engine effects remain plans.',
32
+ })
33
+
34
+
35
+ if __name__ == '__main__':
36
+ main()
scripts/test_rust_defuse_event_lifecycle.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import hashlib
2
+ import json
3
+ import unittest
4
+ from pathlib import Path
5
+
6
+
7
+ class DefuseEventLifecycleParity(unittest.TestCase):
8
+ def test_event_lifecycle(self):
9
+ report = json.loads(Path('docs/research/rust-defuse-event-lifecycle.json').read_text())
10
+ digest = hashlib.sha256(Path(report['source_report']).read_bytes()).hexdigest()
11
+ self.assertEqual(report['source_report_sha256'], digest)
12
+ self.assertEqual(len(report['probes']), 2)
13
+ for row in report['probes']:
14
+ with self.subTest(gap=row['source']['gap']):
15
+ self.assertEqual(row['source'], row['rust'])
16
+
17
+
18
+ if __name__ == '__main__':
19
+ unittest.main()
xtask/checks.tsv CHANGED
@@ -4826,3 +4826,13 @@ edge docs/research/qvm-defuse-event-lifecycle.json scripts/test_qvm_defuse_event
4826
  group qvm-defuse-event-lifecycle scripts/analyze_qvm_defuse_event_lifecycle.py
4827
  group qvm-defuse-event-lifecycle scripts/analyze_qvm_entity_event_expiry.py
4828
  edge scripts/analyze_qvm_defuse_event_lifecycle.py scripts/analyze_qvm_resumer_audit.py
 
 
 
 
 
 
 
 
 
 
 
4826
  group qvm-defuse-event-lifecycle scripts/analyze_qvm_defuse_event_lifecycle.py
4827
  group qvm-defuse-event-lifecycle scripts/analyze_qvm_entity_event_expiry.py
4828
  edge scripts/analyze_qvm_defuse_event_lifecycle.py scripts/analyze_qvm_resumer_audit.py
4829
+ report scripts/analyze_rust_defuse_event_lifecycle.py docs/research/rust-defuse-event-lifecycle.json
4830
+ edge docs/research/rust-defuse-event-lifecycle.json scripts/test_rust_defuse_event_lifecycle.py
4831
+ group rust-defuse-event-lifecycle scripts/analyze_qvm_defuse_event_lifecycle.py
4832
+ group rust-defuse-event-lifecycle scripts/analyze_rust_defuse_event_lifecycle.py
4833
+ group gameplay scripts/analyze_rust_defuse_event_lifecycle.py
4834
+ edge docs/research/qvm-defuse-event-lifecycle.json scripts/analyze_rust_defuse_event_lifecycle.py
4835
+ edge crates/urt-gameplay/src/defuse.rs scripts/analyze_rust_defuse_event_lifecycle.py
4836
+ edge crates/urt-gameplay/src/location_feedback.rs scripts/analyze_rust_defuse_event_lifecycle.py
4837
+ edge crates/urt-gameplay/src/bin/urt-defuse.rs scripts/analyze_rust_defuse_event_lifecycle.py
4838
+ edge crates/urt-gameplay/src/bin/support/entity_pool.rs scripts/analyze_rust_defuse_event_lifecycle.py