nmarshall commited on
Commit
5b2d5fa
·
1 Parent(s): 6a5d1d8

qvm: trace defuse event lifecycle

Browse files
docs/FINDINGS.md CHANGED
@@ -2049,3 +2049,5 @@ RE-1034–1043 batch validation passed:2,018 Python tests,339 Rust tests,146 det
2049
  - Temporary entities free after their signed event age exceeds 300. At the threshold they remain allocated and skip ordinary entity dispatch. [QVM frame expiry](research/QVM_ENTITY_EVENT_EXPIRY.md).
2050
 
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).
 
 
 
2049
  - Temporary entities free after their signed event age exceeds 300. At the threshold they remain allocated and skip ordinary entity dispatch. [QVM frame expiry](research/QVM_ENTITY_EVENT_EXPIRY.md).
2050
 
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).
docs/PROVISIONAL_TODO.md CHANGED
@@ -2111,3 +2111,5 @@ RE-974–983 completed routing, command rewrite, inactivity, movement-parameter
2111
  - [x] RE-1051 Trace the per-entity frame event expiry, free and unlink branches ([evidence](research/QVM_ENTITY_EVENT_EXPIRY.md)).
2112
 
2113
  - [x] RE-1052 Port the per-entity frame event expiry gate to Rust ([evidence](research/RUST_ENTITY_EVENT_EXPIRY.md)).
 
 
 
2111
  - [x] RE-1051 Trace the per-entity frame event expiry, free and unlink branches ([evidence](research/QVM_ENTITY_EVENT_EXPIRY.md)).
2112
 
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)).
docs/RESEARCH_LEDGER.md CHANGED
@@ -2883,3 +2883,7 @@ Thirty cases recover the signed wrapped difference, the strict 300-time cutoff,
2883
  ## 2026-11-25 — RE-1052 Port the per-entity frame event expiry gate to Rust
2884
 
2885
  Rust applies event expiration, dispatch suppression and release or unlink ordering using the fixed-pool record. The implementation matches all 30 source cases. See [expiry parity](research/RUST_ENTITY_EVENT_EXPIRY.md).
 
 
 
 
 
2883
  ## 2026-11-25 — RE-1052 Port the per-entity frame event expiry gate to Rust
2884
 
2885
  Rust applies event expiration, dispatch suppression and release or unlink ordering using the fixed-pool record. The implementation matches all 30 source cases. See [expiry parity](research/RUST_ENTITY_EVENT_EXPIRY.md).
2886
+
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).
docs/research/QVM_DEFUSE_EVENT_LIFECYCLE.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Defuse event allocation and expiry on one pool
2
+
3
+ [Two seven-frame source sequences](qvm-defuse-event-lifecycle.json) preserve the actor, bomb and fixed pool across start, distant cancellation, restart and completion. Each scheduled frame runs the recovered expiry slice on live temporary slots before the optional defuse callback. Expiry and allocation use the same entity record addresses.
4
+
5
+ The first start extends to slot 64. Its event remains live at age 300 and is freed at 301. Cancellation on that same tick extends to slot 65 because slot 64 has just been freed. The next restart sees slot 64 at a free age of either 999 or 1000. At 999, both freed slots are too recent and allocation extends to slot 66. At 1000, the first eligible record is slot 64 and registration is unnecessary. At completion, the restart event has expired and its freshly freed slot is bypassed in favor of an older free slot. The final frame frees the completion event.
6
+
7
+ The reports retain active event types and payloads, slot numbers, free timestamps, registrations and expiry requests. The fixture supplies frame timing and applies expiry before the callback. Engine calls and remaining feedback children stay as captured requests.
docs/research/QVM_LOCATION_ALLOCATION_BATCH.md CHANGED
@@ -85,3 +85,5 @@ RE-1050 ports [entity free](RUST_ENTITY_RELEASE.md) into the Rust pool and verif
85
  RE-1051 traces [the frame-level event expiry gate](QVM_ENTITY_EVENT_EXPIRY.md). The source retains temporary records through age 300, frees them at age 301 and gives free precedence over the standalone unlink flag.
86
 
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.
 
 
 
85
  RE-1051 traces [the frame-level event expiry gate](QVM_ENTITY_EVENT_EXPIRY.md). The source retains temporary records through age 300, frees them at age 301 and gives free precedence over the standalone unlink flag.
86
 
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.
docs/research/README.md CHANGED
@@ -1677,3 +1677,5 @@ The extension collector adds five focused tests for native tail calls, command-r
1677
  - [Per-entity event expiry in the QVM frame loop](QVM_ENTITY_EVENT_EXPIRY.md)
1678
 
1679
  - [Entity event expiry in Rust](RUST_ENTITY_EVENT_EXPIRY.md)
 
 
 
1677
  - [Per-entity event expiry in the QVM frame loop](QVM_ENTITY_EVENT_EXPIRY.md)
1678
 
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)
docs/research/qvm-defuse-event-lifecycle.json ADDED
@@ -0,0 +1,603 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "initial": {
3
+ "allocation": {
4
+ "count": 64,
5
+ "profile": 0,
6
+ "slots": [],
7
+ "start": 0,
8
+ "tick": 10000
9
+ },
10
+ "animation": 99,
11
+ "bomb_first": 0,
12
+ "bomb_missing": 0,
13
+ "busy": 0,
14
+ "busy_slot": 0,
15
+ "client": 1,
16
+ "clock": 123,
17
+ "complete": 0,
18
+ "connection": 2,
19
+ "count": 3,
20
+ "delay": 1,
21
+ "distance": 10.0,
22
+ "duration": 5,
23
+ "enabled_a": 1,
24
+ "enabled_b": 1,
25
+ "entity": 1,
26
+ "event_flags": 305419864,
27
+ "flags": 2147516512,
28
+ "flags104": 2147483650,
29
+ "follow": 0,
30
+ "health": 1,
31
+ "index": 3,
32
+ "other_busy": 0,
33
+ "other_connection": 2,
34
+ "other_follow": 0,
35
+ "other_health": 1,
36
+ "other_team": 0,
37
+ "profile": 0,
38
+ "selector": 0,
39
+ "start": 8000,
40
+ "team": 0,
41
+ "tick": 10000,
42
+ "weapon": 305397771
43
+ },
44
+ "limits": "Shared caller, bomb and fixed-pool state across explicit fixture ticks. Frame expiry precedes callback per fixture schedule. Engine requests captured.",
45
+ "probes": [
46
+ {
47
+ "frames": [
48
+ {
49
+ "active": [
50
+ [
51
+ 64,
52
+ 102,
53
+ 5,
54
+ 10000
55
+ ]
56
+ ],
57
+ "count": 65,
58
+ "events": [
59
+ {
60
+ "event": 83,
61
+ "op": "allocate"
62
+ },
63
+ {
64
+ "op": "sound",
65
+ "slot": 2,
66
+ "sound": 7
67
+ }
68
+ ],
69
+ "expiries": [],
70
+ "free": [],
71
+ "registrations": [
72
+ 65
73
+ ],
74
+ "selected": 64,
75
+ "tick": 10000
76
+ },
77
+ {
78
+ "active": [
79
+ [
80
+ 64,
81
+ 102,
82
+ 5,
83
+ 10000
84
+ ]
85
+ ],
86
+ "count": 65,
87
+ "events": [],
88
+ "expiries": [
89
+ {
90
+ "execution": {
91
+ "stop": 15623,
92
+ "trace_length": 26,
93
+ "trace_sha256": "5853bece9f4514912477730b6ee3bcced80b5081e2b5496bb657fb2921636332"
94
+ },
95
+ "requests": [],
96
+ "slot": 64
97
+ }
98
+ ],
99
+ "free": [],
100
+ "registrations": [],
101
+ "selected": null,
102
+ "tick": 10300
103
+ },
104
+ {
105
+ "active": [
106
+ [
107
+ 65,
108
+ 103,
109
+ 0,
110
+ 10301
111
+ ]
112
+ ],
113
+ "count": 66,
114
+ "events": [
115
+ {
116
+ "event": 84,
117
+ "op": "allocate"
118
+ }
119
+ ],
120
+ "expiries": [
121
+ {
122
+ "execution": {
123
+ "stop": 15623,
124
+ "trace_length": 61,
125
+ "trace_sha256": "e52693786a7387976ee9a7302f5e4a470915e3e4cc6ed5961bf633d7393c8ab6"
126
+ },
127
+ "requests": [
128
+ -32,
129
+ 249639
130
+ ],
131
+ "slot": 64
132
+ }
133
+ ],
134
+ "free": [
135
+ [
136
+ 64,
137
+ 10301
138
+ ]
139
+ ],
140
+ "registrations": [
141
+ 66
142
+ ],
143
+ "selected": 65,
144
+ "tick": 10301
145
+ },
146
+ {
147
+ "active": [],
148
+ "count": 66,
149
+ "events": [],
150
+ "expiries": [
151
+ {
152
+ "execution": {
153
+ "stop": 15623,
154
+ "trace_length": 61,
155
+ "trace_sha256": "e52693786a7387976ee9a7302f5e4a470915e3e4cc6ed5961bf633d7393c8ab6"
156
+ },
157
+ "requests": [
158
+ -32,
159
+ 249639
160
+ ],
161
+ "slot": 65
162
+ }
163
+ ],
164
+ "free": [
165
+ [
166
+ 64,
167
+ 10301
168
+ ],
169
+ [
170
+ 65,
171
+ 10602
172
+ ]
173
+ ],
174
+ "registrations": [],
175
+ "selected": null,
176
+ "tick": 10602
177
+ },
178
+ {
179
+ "active": [
180
+ [
181
+ 66,
182
+ 102,
183
+ 5,
184
+ 11300
185
+ ]
186
+ ],
187
+ "count": 67,
188
+ "events": [
189
+ {
190
+ "event": 83,
191
+ "op": "allocate"
192
+ },
193
+ {
194
+ "op": "sound",
195
+ "slot": 2,
196
+ "sound": 7
197
+ }
198
+ ],
199
+ "expiries": [],
200
+ "free": [
201
+ [
202
+ 64,
203
+ 10301
204
+ ],
205
+ [
206
+ 65,
207
+ 10602
208
+ ]
209
+ ],
210
+ "registrations": [
211
+ 67
212
+ ],
213
+ "selected": 66,
214
+ "tick": 11300
215
+ },
216
+ {
217
+ "active": [
218
+ [
219
+ 64,
220
+ 103,
221
+ 1,
222
+ 16300
223
+ ]
224
+ ],
225
+ "count": 67,
226
+ "events": [
227
+ {
228
+ "format": "426f6d62207761732064656675736564206279202569210a",
229
+ "op": "log",
230
+ "slot": 2
231
+ },
232
+ {
233
+ "event": 84,
234
+ "op": "allocate"
235
+ },
236
+ {
237
+ "op": "teleport",
238
+ "slot": 2
239
+ },
240
+ {
241
+ "op": "award",
242
+ "slot": 2,
243
+ "value": 5
244
+ }
245
+ ],
246
+ "expiries": [
247
+ {
248
+ "execution": {
249
+ "stop": 15623,
250
+ "trace_length": 61,
251
+ "trace_sha256": "e52693786a7387976ee9a7302f5e4a470915e3e4cc6ed5961bf633d7393c8ab6"
252
+ },
253
+ "requests": [
254
+ -32,
255
+ 249639
256
+ ],
257
+ "slot": 66
258
+ }
259
+ ],
260
+ "free": [
261
+ [
262
+ 65,
263
+ 10602
264
+ ],
265
+ [
266
+ 66,
267
+ 16300
268
+ ]
269
+ ],
270
+ "registrations": [],
271
+ "selected": 64,
272
+ "tick": 16300
273
+ },
274
+ {
275
+ "active": [],
276
+ "count": 67,
277
+ "events": [],
278
+ "expiries": [
279
+ {
280
+ "execution": {
281
+ "stop": 15623,
282
+ "trace_length": 39,
283
+ "trace_sha256": "1e9149718ae731afeaa13c52cee6d994af924c17ec15d261a46770040b4f3242"
284
+ },
285
+ "requests": [
286
+ -32,
287
+ 249639
288
+ ],
289
+ "slot": 64
290
+ }
291
+ ],
292
+ "free": [
293
+ [
294
+ 64,
295
+ 16601
296
+ ],
297
+ [
298
+ 65,
299
+ 10602
300
+ ],
301
+ [
302
+ 66,
303
+ 16300
304
+ ]
305
+ ],
306
+ "registrations": [],
307
+ "selected": null,
308
+ "tick": 16601
309
+ }
310
+ ],
311
+ "gap": 999
312
+ },
313
+ {
314
+ "frames": [
315
+ {
316
+ "active": [
317
+ [
318
+ 64,
319
+ 102,
320
+ 5,
321
+ 10000
322
+ ]
323
+ ],
324
+ "count": 65,
325
+ "events": [
326
+ {
327
+ "event": 83,
328
+ "op": "allocate"
329
+ },
330
+ {
331
+ "op": "sound",
332
+ "slot": 2,
333
+ "sound": 7
334
+ }
335
+ ],
336
+ "expiries": [],
337
+ "free": [],
338
+ "registrations": [
339
+ 65
340
+ ],
341
+ "selected": 64,
342
+ "tick": 10000
343
+ },
344
+ {
345
+ "active": [
346
+ [
347
+ 64,
348
+ 102,
349
+ 5,
350
+ 10000
351
+ ]
352
+ ],
353
+ "count": 65,
354
+ "events": [],
355
+ "expiries": [
356
+ {
357
+ "execution": {
358
+ "stop": 15623,
359
+ "trace_length": 26,
360
+ "trace_sha256": "5853bece9f4514912477730b6ee3bcced80b5081e2b5496bb657fb2921636332"
361
+ },
362
+ "requests": [],
363
+ "slot": 64
364
+ }
365
+ ],
366
+ "free": [],
367
+ "registrations": [],
368
+ "selected": null,
369
+ "tick": 10300
370
+ },
371
+ {
372
+ "active": [
373
+ [
374
+ 65,
375
+ 103,
376
+ 0,
377
+ 10301
378
+ ]
379
+ ],
380
+ "count": 66,
381
+ "events": [
382
+ {
383
+ "event": 84,
384
+ "op": "allocate"
385
+ }
386
+ ],
387
+ "expiries": [
388
+ {
389
+ "execution": {
390
+ "stop": 15623,
391
+ "trace_length": 61,
392
+ "trace_sha256": "e52693786a7387976ee9a7302f5e4a470915e3e4cc6ed5961bf633d7393c8ab6"
393
+ },
394
+ "requests": [
395
+ -32,
396
+ 249639
397
+ ],
398
+ "slot": 64
399
+ }
400
+ ],
401
+ "free": [
402
+ [
403
+ 64,
404
+ 10301
405
+ ]
406
+ ],
407
+ "registrations": [
408
+ 66
409
+ ],
410
+ "selected": 65,
411
+ "tick": 10301
412
+ },
413
+ {
414
+ "active": [],
415
+ "count": 66,
416
+ "events": [],
417
+ "expiries": [
418
+ {
419
+ "execution": {
420
+ "stop": 15623,
421
+ "trace_length": 61,
422
+ "trace_sha256": "e52693786a7387976ee9a7302f5e4a470915e3e4cc6ed5961bf633d7393c8ab6"
423
+ },
424
+ "requests": [
425
+ -32,
426
+ 249639
427
+ ],
428
+ "slot": 65
429
+ }
430
+ ],
431
+ "free": [
432
+ [
433
+ 64,
434
+ 10301
435
+ ],
436
+ [
437
+ 65,
438
+ 10602
439
+ ]
440
+ ],
441
+ "registrations": [],
442
+ "selected": null,
443
+ "tick": 10602
444
+ },
445
+ {
446
+ "active": [
447
+ [
448
+ 64,
449
+ 102,
450
+ 5,
451
+ 11301
452
+ ]
453
+ ],
454
+ "count": 66,
455
+ "events": [
456
+ {
457
+ "event": 83,
458
+ "op": "allocate"
459
+ },
460
+ {
461
+ "op": "sound",
462
+ "slot": 2,
463
+ "sound": 7
464
+ }
465
+ ],
466
+ "expiries": [],
467
+ "free": [
468
+ [
469
+ 65,
470
+ 10602
471
+ ]
472
+ ],
473
+ "registrations": [],
474
+ "selected": 64,
475
+ "tick": 11301
476
+ },
477
+ {
478
+ "active": [
479
+ [
480
+ 65,
481
+ 103,
482
+ 1,
483
+ 16301
484
+ ]
485
+ ],
486
+ "count": 66,
487
+ "events": [
488
+ {
489
+ "format": "426f6d62207761732064656675736564206279202569210a",
490
+ "op": "log",
491
+ "slot": 2
492
+ },
493
+ {
494
+ "event": 84,
495
+ "op": "allocate"
496
+ },
497
+ {
498
+ "op": "teleport",
499
+ "slot": 2
500
+ },
501
+ {
502
+ "op": "award",
503
+ "slot": 2,
504
+ "value": 5
505
+ }
506
+ ],
507
+ "expiries": [
508
+ {
509
+ "execution": {
510
+ "stop": 15623,
511
+ "trace_length": 39,
512
+ "trace_sha256": "1e9149718ae731afeaa13c52cee6d994af924c17ec15d261a46770040b4f3242"
513
+ },
514
+ "requests": [
515
+ -32,
516
+ 249639
517
+ ],
518
+ "slot": 64
519
+ }
520
+ ],
521
+ "free": [
522
+ [
523
+ 64,
524
+ 16301
525
+ ]
526
+ ],
527
+ "registrations": [],
528
+ "selected": 65,
529
+ "tick": 16301
530
+ },
531
+ {
532
+ "active": [],
533
+ "count": 66,
534
+ "events": [],
535
+ "expiries": [
536
+ {
537
+ "execution": {
538
+ "stop": 15623,
539
+ "trace_length": 39,
540
+ "trace_sha256": "1e9149718ae731afeaa13c52cee6d994af924c17ec15d261a46770040b4f3242"
541
+ },
542
+ "requests": [
543
+ -32,
544
+ 249639
545
+ ],
546
+ "slot": 65
547
+ }
548
+ ],
549
+ "free": [
550
+ [
551
+ 64,
552
+ 16301
553
+ ],
554
+ [
555
+ 65,
556
+ 16602
557
+ ]
558
+ ],
559
+ "registrations": [],
560
+ "selected": null,
561
+ "tick": 16602
562
+ }
563
+ ],
564
+ "gap": 1000
565
+ }
566
+ ],
567
+ "sha256": "a589351dfe517470a1b121dd2164714987d9e4577bf00c6486e1540035d7a79d",
568
+ "source": {
569
+ "archive": "zUrT43_qvm.pk3",
570
+ "archive_sha256": "b59bf0c5bedf11d50e0edd220da7eade96de40601e98ae14c54c819047df0796",
571
+ "member": {
572
+ "bytes": 983300,
573
+ "comment_hex": "",
574
+ "compressed_bytes": 246560,
575
+ "compression": 8,
576
+ "crc32": "98ea1768",
577
+ "create_system": 0,
578
+ "create_version": 63,
579
+ "date_time": [
580
+ 2018,
581
+ 6,
582
+ 18,
583
+ 22,
584
+ 11,
585
+ 50
586
+ ],
587
+ "directory": false,
588
+ "entry_index": 2,
589
+ "external_attr": 32,
590
+ "extra_hex": "0a0020000000000001001800d1e24e974007d40116dcbf962f1fd20116dcbf962f1fd201",
591
+ "extract_version": 20,
592
+ "flags": 0,
593
+ "header_offset": 221309,
594
+ "internal_attr": 0,
595
+ "occurrence": 0,
596
+ "output": "assets/extracted/zUrT43_qvm.pk3/members/000002/vm/qagame.qvm",
597
+ "path": "vm/qagame.qvm",
598
+ "sha256": "a589351dfe517470a1b121dd2164714987d9e4577bf00c6486e1540035d7a79d",
599
+ "type": "member",
600
+ "volume": 0
601
+ }
602
+ }
603
+ }
docs/research/qvm-resumer-audit.json CHANGED
@@ -1513,7 +1513,7 @@
1513
  ],
1514
  "explicit_result_offsets": null,
1515
  "helper": "qvm_trace_support.resume",
1516
- "line": 53,
1517
  "literal_range": [
1518
  15418,
1519
  15623
 
1513
  ],
1514
  "explicit_result_offsets": null,
1515
  "helper": "qvm_trace_support.resume",
1516
+ "line": 62,
1517
  "literal_range": [
1518
  15418,
1519
  15623
scripts/analyze_qvm_defuse_allocated_callback.py CHANGED
@@ -24,7 +24,7 @@ def fixtures():
24
  yield dict(a, allocation=dict(pools[pool_variant], tick=a['tick']), event_flags=0x12345658)
25
 
26
 
27
- def probe_state(ins, m, b, a, prepare=None):
28
  full_seed(m, b, a)
29
  allocation_seed(m, a['allocation'])
30
  for index in (64, 65, 66):
@@ -33,6 +33,9 @@ def probe_state(ins, m, b, a, prepare=None):
33
  for index in range(6, 64):
34
  record = POOL + index * 880
35
  m.update({record + 532: 0, record + 536: 0, record + 540: 0})
 
 
 
36
  effects, allocations, links = [], [], []
37
  event_handler = allocated_event_handler(allocations, links)
38
  captures = handlers(effects)
@@ -57,6 +60,11 @@ def probe_state(ins, m, b, a, prepare=None):
57
  return m, row, b
58
 
59
 
 
 
 
 
 
60
  def probe(ins, m, b, a):
61
  return probe_state(ins, m, b, a)[1]
62
 
 
24
  yield dict(a, allocation=dict(pools[pool_variant], tick=a['tick']), event_flags=0x12345658)
25
 
26
 
27
+ def seed_callback(m, b, a):
28
  full_seed(m, b, a)
29
  allocation_seed(m, a['allocation'])
30
  for index in (64, 65, 66):
 
33
  for index in range(6, 64):
34
  record = POOL + index * 880
35
  m.update({record + 532: 0, record + 536: 0, record + 540: 0})
36
+
37
+
38
+ def run_callback(ins, m, b, a, prepare=None):
39
  effects, allocations, links = [], [], []
40
  event_handler = allocated_event_handler(allocations, links)
41
  captures = handlers(effects)
 
60
  return m, row, b
61
 
62
 
63
+ def probe_state(ins, m, b, a, prepare=None):
64
+ seed_callback(m, b, a)
65
+ return run_callback(ins, m, b, a, prepare)
66
+
67
+
68
  def probe(ins, m, b, a):
69
  return probe_state(ins, m, b, a)[1]
70
 
scripts/analyze_qvm_defuse_event_lifecycle.py ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Follow actual defuse allocations and frame expiry in one shared pool."""
2
+ from pathlib import Path
3
+
4
+ from analyze_qvm import write_json
5
+ from analyze_qvm_acceleration import word
6
+ from analyze_qvm_defuse_allocated_callback import fixtures, run_callback, seed_callback
7
+ from analyze_qvm_entity_event_expiry import run_expiry
8
+ from analyze_qvm_entity_free import FIELDS
9
+ from qvm_byte_memory_support import write_bytes
10
+ from qvm_defuse_support import BOMB
11
+ from qvm_location_feedback_support import POOL, seed
12
+ from qvm_research_support import source
13
+
14
+
15
+ def probe(ins, raw, header, a, gap):
16
+ m, b = seed(raw, header, a)
17
+ seed_callback(m, b, a)
18
+ for slot in range(64, 69):
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
+
26
+ def store(address, value):
27
+ write_bytes(m, b, {address + i: (value >> (8 * i)) & 255 for i in range(4)})
28
+
29
+ def view(tick, row, expiries):
30
+ active = [[slot, m[POOL + 880 * slot + 4], m[POOL + 880 * slot + 184],
31
+ m[POOL + 880 * slot + 568]] for slot in range(64, m[34992508])
32
+ if m[POOL + 880 * slot + 532]]
33
+ free = [[slot, m[POOL + 880 * slot + 564]] for slot in range(64, m[34992508])
34
+ if not m[POOL + 880 * slot + 532]]
35
+ allocation = None if row is None else row['allocation']
36
+ return dict(tick=tick, count=m[34992508], active=active, free=free,
37
+ selected=None if allocation is None else allocation['selected'],
38
+ registrations=[] if allocation is None else allocation['registrations'],
39
+ events=[] if row is None else row['events'], expiries=expiries)
40
+
41
+ for tick, distance in ((10000, 10.), (10300, None), (10301, 75.),
42
+ (10602, None), (10301 + gap, 10.),
43
+ (10301 + gap + 5000, 10.), (10301 + gap + 5301, None)):
44
+ store(34992532, tick)
45
+ expiries = []
46
+ for slot in range(64, m[34992508]):
47
+ pointer = POOL + 880 * slot
48
+ if m[pointer + 532] == 0:
49
+ continue
50
+ m, expiry, b = run_expiry(ins, m, b, pointer)
51
+ expiries.append(dict(slot=slot, requests=expiry['requests'],
52
+ execution=expiry['execution']))
53
+ row = None
54
+ if distance is not None:
55
+ store(BOMB + 24, word(distance))
56
+ m, row, b = run_callback(ins, m, b, dict(a, tick=tick, distance=distance))
57
+ frames.append(view(tick, row, expiries))
58
+ return dict(gap=gap, frames=frames)
59
+
60
+
61
+ def main():
62
+ meta, raw, header, ins = source()
63
+ a = next(a for a in fixtures() if a['profile'] == 0 and a['allocation']['profile'] == 0)
64
+ write_json(Path('docs/research/qvm-defuse-event-lifecycle.json'), {
65
+ 'source': meta['source'], 'sha256': meta['sha256'], 'initial': a,
66
+ 'probes': [probe(ins, raw, header, a, gap) for gap in (999, 1000)],
67
+ 'limits': 'Shared caller, bomb and fixed-pool state across explicit fixture ticks. Frame expiry precedes callback per fixture schedule. Engine requests captured.',
68
+ })
69
+
70
+
71
+ if __name__ == '__main__':
72
+ main()
scripts/analyze_qvm_entity_event_expiry.py CHANGED
@@ -35,27 +35,37 @@ def probe(ins, a):
35
  ENTITY + 568: a['event_time'], ENTITY + 572: int(a['kind'] == 'temporary'),
36
  ENTITY + 576: int(a['kind'] != 'persistent')})
37
  assert all(m[ENTITY + offset] == 0 for offset in FIELDS)
 
 
 
 
 
 
 
 
 
38
  requests = []
39
  free_traces = []
40
 
41
  def free(i, memory, args):
42
- assert args == {8: ENTITY}
43
- memory, child = release(i, memory, ENTITY)
44
  requests.extend(r['target'] for r in child['requests'])
45
  free_traces.append(child['execution']['trace_sha256'])
46
  return memory, 0, {'actual_source_child': 277400}
47
 
48
  def unlink(i, memory, args):
49
- assert args == {8: ENTITY}
50
  requests.append(-32)
51
  return memory, 0, {'native_unlink_captured': True}
52
 
53
  m, trace = resume(ins, 15418, 15623, m, FRAME, boundaries=(15509, 15623),
54
  handlers={277400: free, -32: unlink}, repeated_calls=True,
55
- sync_child_words=True, coherent_memory=True)
56
- return dict(input=a, record={str(o): m[ENTITY + o] & 0xffffffff for o in FIELDS_IN_REPORT},
57
- client_event=m[CLIENT + 128], requests=requests, free_traces=free_traces,
58
  execution={k: trace[k] for k in ('stop', 'trace_length', 'trace_sha256')})
 
59
 
60
 
61
  def main():
 
35
  ENTITY + 568: a['event_time'], ENTITY + 572: int(a['kind'] == 'temporary'),
36
  ENTITY + 576: int(a['kind'] != 'persistent')})
37
  assert all(m[ENTITY + offset] == 0 for offset in FIELDS)
38
+ m, trace, _ = run_expiry(ins, m, {}, ENTITY)
39
+ return dict(input=a, record={str(o): m[ENTITY + o] & 0xffffffff for o in FIELDS_IN_REPORT},
40
+ client_event=m[CLIENT + 128], **trace)
41
+
42
+
43
+ def run_expiry(ins, m, b, pointer):
44
+ from qvm_string_memory_support import frame_args
45
+
46
+ m, b = frame_args(m, b, {FRAME + 24: pointer})
47
  requests = []
48
  free_traces = []
49
 
50
  def free(i, memory, args):
51
+ assert args == {8: pointer}
52
+ memory, child = release(i, memory, pointer)
53
  requests.extend(r['target'] for r in child['requests'])
54
  free_traces.append(child['execution']['trace_sha256'])
55
  return memory, 0, {'actual_source_child': 277400}
56
 
57
  def unlink(i, memory, args):
58
+ assert args == {8: pointer}
59
  requests.append(-32)
60
  return memory, 0, {'native_unlink_captured': True}
61
 
62
  m, trace = resume(ins, 15418, 15623, m, FRAME, boundaries=(15509, 15623),
63
  handlers={277400: free, -32: unlink}, repeated_calls=True,
64
+ sync_child_words=True, coherent_memory=True, byte_inputs=b,
65
+ capture_byte_memory=True)
66
+ view = dict(requests=requests, free_traces=free_traces,
67
  execution={k: trace[k] for k in ('stop', 'trace_length', 'trace_sha256')})
68
+ return m, view, trace['byte_memory']
69
 
70
 
71
  def main():
scripts/test_qvm_defuse_event_lifecycle.py ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import unittest
3
+ from pathlib import Path
4
+
5
+
6
+ class DefuseEventLifecycleTests(unittest.TestCase):
7
+ def test_expiry_and_reuse_on_one_pool(self):
8
+ report = json.loads(Path('docs/research/qvm-defuse-event-lifecycle.json').read_text())
9
+ self.assertEqual([row['gap'] for row in report['probes']], [999, 1000])
10
+ for row in report['probes']:
11
+ gap = row['gap']
12
+ late_slot = 66 if gap == 999 else 64
13
+ finish_slot = 64 if gap == 999 else 65
14
+ start_tick = 10301 + gap
15
+ finish_tick = start_tick + 5000
16
+ with self.subTest(gap=gap):
17
+ frames = row['frames']
18
+ self.assertEqual([f['tick'] for f in frames],
19
+ [10000, 10300, 10301, 10602, start_tick, finish_tick, finish_tick + 301])
20
+ self.assertEqual([f['selected'] for f in frames],
21
+ [64, None, 65, None, late_slot, finish_slot, None])
22
+ self.assertEqual([f['registrations'] for f in frames],
23
+ [[65], [], [66], [], [67] if gap == 999 else [], [], []])
24
+ self.assertEqual([f['active'] for f in frames], [
25
+ [[64, 102, 5, 10000]], [[64, 102, 5, 10000]],
26
+ [[65, 103, 0, 10301]], [], [[late_slot, 102, 5, start_tick]],
27
+ [[finish_slot, 103, 1, finish_tick]], [],
28
+ ])
29
+ self.assertEqual([[(e['slot'], e['requests']) for e in f['expiries']] for f in frames],
30
+ [[], [(64, [])], [(64, [-32, 249639])], [(65, [-32, 249639])],
31
+ [], [(late_slot, [-32, 249639])], [(finish_slot, [-32, 249639])]])
32
+ self.assertIn([64, 10301], frames[2]['free'])
33
+ self.assertIn([65, 10602], frames[3]['free'])
34
+ self.assertIn([late_slot, finish_tick], frames[5]['free'])
35
+ self.assertIn([finish_slot, finish_tick + 301], frames[6]['free'])
36
+ self.assertEqual([[e['op'] for e in f['events']] for f in frames],
37
+ [['allocate', 'sound'], [], ['allocate'], [], ['allocate', 'sound'],
38
+ ['log', 'allocate', 'teleport', 'award'], []])
39
+
40
+
41
+ if __name__ == '__main__':
42
+ unittest.main()
xtask/checks.tsv CHANGED
@@ -4821,3 +4821,8 @@ group gameplay scripts/analyze_rust_entity_event_expiry.py
4821
  edge docs/research/qvm-entity-event-expiry.json scripts/analyze_rust_entity_event_expiry.py
4822
  edge crates/urt-gameplay/src/location_feedback.rs scripts/analyze_rust_entity_event_expiry.py
4823
  edge crates/urt-gameplay/src/bin/urt-location-feedback.rs scripts/analyze_rust_entity_event_expiry.py
 
 
 
 
 
 
4821
  edge docs/research/qvm-entity-event-expiry.json scripts/analyze_rust_entity_event_expiry.py
4822
  edge crates/urt-gameplay/src/location_feedback.rs scripts/analyze_rust_entity_event_expiry.py
4823
  edge crates/urt-gameplay/src/bin/urt-location-feedback.rs scripts/analyze_rust_entity_event_expiry.py
4824
+ report scripts/analyze_qvm_defuse_event_lifecycle.py docs/research/qvm-defuse-event-lifecycle.json
4825
+ edge docs/research/qvm-defuse-event-lifecycle.json scripts/test_qvm_defuse_event_lifecycle.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