qvm: trace located defuse callback
Browse files- docs/FINDINGS.md +2 -0
- docs/PROVISIONAL_TODO.md +2 -0
- docs/RESEARCH_LEDGER.md +4 -0
- docs/research/QVM_DEFUSE_LOCATED_CALLBACK.md +7 -0
- docs/research/QVM_LOCATION_ALLOCATION_BATCH.md +2 -0
- docs/research/README.md +2 -0
- docs/research/qvm-defuse-located-callback.json +0 -0
- docs/research/qvm-resumer-audit.json +1 -1
- scripts/analyze_qvm_defuse_allocated_callback.py +9 -3
- scripts/analyze_qvm_defuse_located_callback.py +70 -0
- scripts/qvm_location_feedback_support.py +19 -14
- scripts/test_qvm_defuse_located_callback.py +43 -0
- xtask/checks.tsv +6 -0
docs/FINDINGS.md
CHANGED
|
@@ -2039,3 +2039,5 @@ RE-1034–1043 batch validation passed:2,018 Python tests,339 Rust tests,146 det
|
|
| 2039 |
- Defuse event linking precedes the caller's payload and flag writes for start, cancellation and completion. [Full QVM callback evidence](research/QVM_DEFUSE_ALLOCATED_CALLBACK.md).
|
| 2040 |
|
| 2041 |
- The Rust callback exposes a link-time record snapshot and retains the final event in the pool. [Allocated defuse parity](research/RUST_DEFUSE_ALLOCATED_CALLBACK.md).
|
|
|
|
|
|
|
|
|
| 2039 |
- Defuse event linking precedes the caller's payload and flag writes for start, cancellation and completion. [Full QVM callback evidence](research/QVM_DEFUSE_ALLOCATED_CALLBACK.md).
|
| 2040 |
|
| 2041 |
- The Rust callback exposes a link-time record snapshot and retains the final event in the pool. [Allocated defuse parity](research/RUST_DEFUSE_ALLOCATED_CALLBACK.md).
|
| 2042 |
+
|
| 2043 |
+
- Allocated defuse starts run located radio after event construction. Other tested callback branches preserve marker and formatter ring state. [Located callback trace](research/QVM_DEFUSE_LOCATED_CALLBACK.md).
|
docs/PROVISIONAL_TODO.md
CHANGED
|
@@ -2101,3 +2101,5 @@ RE-974–983 completed routing, command rewrite, inactivity, movement-parameter
|
|
| 2101 |
- [x] RE-1046 Trace the complete defuse callback through returned event allocations ([evidence](research/QVM_DEFUSE_ALLOCATED_CALLBACK.md)).
|
| 2102 |
|
| 2103 |
- [x] RE-1047 Port the full allocated defuse callback and its link-time snapshot ([evidence](research/RUST_DEFUSE_ALLOCATED_CALLBACK.md)).
|
|
|
|
|
|
|
|
|
| 2101 |
- [x] RE-1046 Trace the complete defuse callback through returned event allocations ([evidence](research/QVM_DEFUSE_ALLOCATED_CALLBACK.md)).
|
| 2102 |
|
| 2103 |
- [x] RE-1047 Port the full allocated defuse callback and its link-time snapshot ([evidence](research/RUST_DEFUSE_ALLOCATED_CALLBACK.md)).
|
| 2104 |
+
|
| 2105 |
+
- [x] RE-1048 Trace located radio within the allocated defuse callback ([evidence](research/QVM_DEFUSE_LOCATED_CALLBACK.md)).
|
docs/RESEARCH_LEDGER.md
CHANGED
|
@@ -2863,3 +2863,7 @@ Thirty-nine source cases combine eligibility, bomb search, distance routing and
|
|
| 2863 |
## 2026-11-21 — RE-1047 Port the full allocated defuse callback and its link-time snapshot
|
| 2864 |
|
| 2865 |
Rust shares existing callback routing and matches all 39 source cases with actual pool allocations. The link plan retains the event record before payload and flag mutation. See [allocated callback parity](research/RUST_DEFUSE_ALLOCATED_CALLBACK.md).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2863 |
## 2026-11-21 — RE-1047 Port the full allocated defuse callback and its link-time snapshot
|
| 2864 |
|
| 2865 |
Rust shares existing callback routing and matches all 39 source cases with actual pool allocations. The link plan retains the event record before payload and flag mutation. See [allocated callback parity](research/RUST_DEFUSE_ALLOCATED_CALLBACK.md).
|
| 2866 |
+
|
| 2867 |
+
## 2026-11-25 — RE-1048 Trace located radio within the allocated defuse callback
|
| 2868 |
+
|
| 2869 |
+
Forty-eight cases compose successful defuse allocation with location selection and radio formatting. Sixteen starts execute radio. Cached, expired, trigger and missing locations cover warning, command, formatter ring and marker observations. See [located callback findings](research/QVM_DEFUSE_LOCATED_CALLBACK.md).
|
docs/research/QVM_DEFUSE_LOCATED_CALLBACK.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Located radio in the full defuse callback
|
| 2 |
+
|
| 3 |
+
[The source report](qvm-defuse-located-callback.json) follows 48 cases through the existing defuse callback and the actual event allocator. Sixteen starts continue into radio code 7, the location wrapper and the ring formatter. The cases include allocation by pool extension and by full-pool retry, with either of two bomb records selected.
|
| 4 |
+
|
| 5 |
+
The location fixtures use distinct entity slots from the bombs and exercise a valid cached pointer, expiry at the current tick, a trigger returned by the box query, and a list with every candidate rejected by PVS. The expired-cache case clips a 160-byte label to 149 bytes and records one warning. Two same-team recipients receive the commands in slot order and advance the formatter ring twice. Rejected locations produce commands with empty location text. The marker is updated on the send path.
|
| 6 |
+
|
| 7 |
+
Waiting, completion and both cancellation branches leave the radio marker and ring as seeded. QVM code chooses the location and formats commands. Box candidates and PVS are supplied by the fixture, and engine sends, linking and registration are captured. Client playback remains open.
|
docs/research/QVM_LOCATION_ALLOCATION_BATCH.md
CHANGED
|
@@ -75,3 +75,5 @@ RE-1045 matches all sixteen prefixes in [the Rust adapter](RUST_DEFUSE_ALLOCATIO
|
|
| 75 |
RE-1046 combines successful allocation and event construction with [the full source callback](QVM_DEFUSE_ALLOCATED_CALLBACK.md). Link-time and final event fields are captured separately for starts, cancellations and completions.
|
| 76 |
|
| 77 |
RE-1047 matches the 39 source fixtures in [the full Rust callback](RUST_DEFUSE_ALLOCATED_CALLBACK.md). Native link adapters can now consume the record snapshot separately from the final pool contents.
|
|
|
|
|
|
|
|
|
| 75 |
RE-1046 combines successful allocation and event construction with [the full source callback](QVM_DEFUSE_ALLOCATED_CALLBACK.md). Link-time and final event fields are captured separately for starts, cancellations and completions.
|
| 76 |
|
| 77 |
RE-1047 matches the 39 source fixtures in [the full Rust callback](RUST_DEFUSE_ALLOCATED_CALLBACK.md). Native link adapters can now consume the record snapshot separately from the final pool contents.
|
| 78 |
+
|
| 79 |
+
RE-1048 follows [located radio within the allocated callback](QVM_DEFUSE_LOCATED_CALLBACK.md) with separate bomb and location identities. The source verifies formatting and marker state alongside the existing pool and event results.
|
docs/research/README.md
CHANGED
|
@@ -1667,3 +1667,5 @@ The extension collector adds five focused tests for native tail calls, command-r
|
|
| 1667 |
- [Full defuse callback with allocated events](QVM_DEFUSE_ALLOCATED_CALLBACK.md)
|
| 1668 |
|
| 1669 |
- [Allocated defuse callback in Rust](RUST_DEFUSE_ALLOCATED_CALLBACK.md)
|
|
|
|
|
|
|
|
|
| 1667 |
- [Full defuse callback with allocated events](QVM_DEFUSE_ALLOCATED_CALLBACK.md)
|
| 1668 |
|
| 1669 |
- [Allocated defuse callback in Rust](RUST_DEFUSE_ALLOCATED_CALLBACK.md)
|
| 1670 |
+
|
| 1671 |
+
- [Located radio in the full defuse callback](QVM_DEFUSE_LOCATED_CALLBACK.md)
|
docs/research/qvm-defuse-located-callback.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
docs/research/qvm-resumer-audit.json
CHANGED
|
@@ -9436,7 +9436,7 @@
|
|
| 9436 |
],
|
| 9437 |
"explicit_result_offsets": null,
|
| 9438 |
"helper": "qvm_trace_support.resume",
|
| 9439 |
-
"line":
|
| 9440 |
"literal_range": [
|
| 9441 |
153774,
|
| 9442 |
154088
|
|
|
|
| 9436 |
],
|
| 9437 |
"explicit_result_offsets": null,
|
| 9438 |
"helper": "qvm_trace_support.resume",
|
| 9439 |
+
"line": 164,
|
| 9440 |
"literal_range": [
|
| 9441 |
153774,
|
| 9442 |
154088
|
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
|
| 28 |
full_seed(m, b, a)
|
| 29 |
allocation_seed(m, a['allocation'])
|
| 30 |
for index in (64, 65, 66):
|
|
@@ -42,7 +42,9 @@ def probe(ins, m, b, a):
|
|
| 42 |
return event_handler(i, memory, args, bytes_)
|
| 43 |
|
| 44 |
captures[277695] = allocate
|
| 45 |
-
|
|
|
|
|
|
|
| 46 |
row.update(input=a, events=effects, allocation=None, record=None, links=links)
|
| 47 |
if allocations:
|
| 48 |
assert len(allocations) == len(links) == 1
|
|
@@ -52,7 +54,11 @@ def probe(ins, m, b, a):
|
|
| 52 |
row.update(allocation=outcome, record={str(o): m[selected + o] & 0xffffffff for o in FIELDS})
|
| 53 |
row['event'] = [row['record'][key] for key in ('184', '424')]
|
| 54 |
row['guards'] = [row['record'][key] for key in ('180', '188')]
|
| 55 |
-
return row
|
|
|
|
|
|
|
|
|
|
|
|
|
| 56 |
|
| 57 |
|
| 58 |
def main():
|
|
|
|
| 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):
|
|
|
|
| 42 |
return event_handler(i, memory, args, bytes_)
|
| 43 |
|
| 44 |
captures[277695] = allocate
|
| 45 |
+
if prepare is not None:
|
| 46 |
+
prepare(m, b, captures)
|
| 47 |
+
m, row, b = full_run(ins, m, b, a, captures)
|
| 48 |
row.update(input=a, events=effects, allocation=None, record=None, links=links)
|
| 49 |
if allocations:
|
| 50 |
assert len(allocations) == len(links) == 1
|
|
|
|
| 54 |
row.update(allocation=outcome, record={str(o): m[selected + o] & 0xffffffff for o in FIELDS})
|
| 55 |
row['event'] = [row['record'][key] for key in ('184', '424')]
|
| 56 |
row['guards'] = [row['record'][key] for key in ('180', '188')]
|
| 57 |
+
return m, row, b
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
def probe(ins, m, b, a):
|
| 61 |
+
return probe_state(ins, m, b, a)[1]
|
| 62 |
|
| 63 |
|
| 64 |
def main():
|
scripts/analyze_qvm_defuse_located_callback.py
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""Trace live located radio after allocation in the complete defuse callback."""
|
| 2 |
+
from itertools import product
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
from analyze_qvm import write_json
|
| 6 |
+
from analyze_qvm_defuse_allocated_callback import fixtures as callback_fixtures, probe_state as callback
|
| 7 |
+
from qvm_effect_feedback_support import MARK, radio_fixtures, radio_seed
|
| 8 |
+
from qvm_location_feedback_support import POOL, nearest_fixtures, nearest_seed, radio_live, seed
|
| 9 |
+
from qvm_research_support import source
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
LOCATIONS = [POOL + 880 * slot for slot in (8, 9, 10)]
|
| 13 |
+
RADIO_FIELDS = ('commands', 'getter_calls', 'marker', 'ring', 'location_result',
|
| 14 |
+
'location_queries', 'location_pvs', 'warnings')
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
def fixtures():
|
| 18 |
+
# Cache hit, expired cache and PVS, box trigger, and missing location.
|
| 19 |
+
profiles = ((1, b'Site A', 0), (2, b'A' * 160, 0xffffffff),
|
| 20 |
+
(5, b'Site "B"', 1), (9, b'Unused', 0))
|
| 21 |
+
cases = [a for a in callback_fixtures()
|
| 22 |
+
if a['profile'] in (0, 1, 2, 3, 5, 23) and a['allocation']['profile'] in (0, 11)]
|
| 23 |
+
for a, (location_id, text, ring) in product(cases, profiles):
|
| 24 |
+
radio = dict(radio_fixtures()[0], count=a['count'], tick=a['tick'],
|
| 25 |
+
payload=text.hex(), ring=ring, location=nearest_fixtures()[location_id])
|
| 26 |
+
yield dict(a, radio=radio)
|
| 27 |
+
|
| 28 |
+
|
| 29 |
+
def probe(ins, raw, header, a):
|
| 30 |
+
radio = a['radio']
|
| 31 |
+
m, b = seed(raw, header, radio, LOCATIONS)
|
| 32 |
+
observations = []
|
| 33 |
+
traces = []
|
| 34 |
+
|
| 35 |
+
def prepare(memory, bytes_, captures):
|
| 36 |
+
radio_seed(memory, bytes_, radio)
|
| 37 |
+
nearest_seed(memory, bytes_, radio['location'], LOCATIONS)
|
| 38 |
+
capture = captures[193620]
|
| 39 |
+
|
| 40 |
+
def locate(i, memory, args, bs):
|
| 41 |
+
memory, _, _ = capture(i, memory, args, bs)
|
| 42 |
+
memory, row, child_bytes = radio_live(i, memory, dict(bs), radio, LOCATIONS)
|
| 43 |
+
observations.append({key: row[key] for key in RADIO_FIELDS})
|
| 44 |
+
traces.append(row['execution'])
|
| 45 |
+
return memory, 0, {
|
| 46 |
+
'actual_source_child': 193620,
|
| 47 |
+
'child_memory_bytes': {key: value for key, value in child_bytes.items()
|
| 48 |
+
if bs.get(key) != value},
|
| 49 |
+
}
|
| 50 |
+
|
| 51 |
+
captures[193620] = locate
|
| 52 |
+
|
| 53 |
+
m, row, _ = callback(ins, m, b, a, prepare)
|
| 54 |
+
row.update(radio=observations, ring=m[23708] & 0xffffffff,
|
| 55 |
+
marker=[m[MARK + offset] & 0xffffffff for offset in (84, 204)])
|
| 56 |
+
row['execution']['radio'] = traces
|
| 57 |
+
return row
|
| 58 |
+
|
| 59 |
+
|
| 60 |
+
def main():
|
| 61 |
+
meta, raw, header, ins = source()
|
| 62 |
+
probes = [probe(ins, raw, header, a) for a in fixtures()]
|
| 63 |
+
write_json(Path('docs/research/qvm-defuse-located-callback.json'), {
|
| 64 |
+
'source': meta['source'], 'sha256': meta['sha256'], 'probes': probes,
|
| 65 |
+
'limits': 'Complete allocated callback with actual located radio and formatting on start. Box, PVS, send, register and link retain captured or supplied engine boundaries.',
|
| 66 |
+
})
|
| 67 |
+
|
| 68 |
+
|
| 69 |
+
if __name__ == '__main__':
|
| 70 |
+
main()
|
scripts/qvm_location_feedback_support.py
CHANGED
|
@@ -9,7 +9,7 @@ from analyze_qvm_acceleration import word,number
|
|
| 9 |
BASE=ROOT+0x200000
|
| 10 |
LOC=[POOL+880*j for j in [5,6,7]]
|
| 11 |
|
| 12 |
-
def seed(raw,h,a):
|
| 13 |
m,b=old_seed(raw,h,a)
|
| 14 |
for p in [31128,31132,31136]:m[p]=int.from_bytes(raw[h['data_offset']+p:h['data_offset']+p+4],'little')
|
| 15 |
for address in [93224,93227]:put_string(m,b,address,raw[h['data_offset']+address:].split(b'\0')[0])
|
|
@@ -17,7 +17,7 @@ def seed(raw,h,a):
|
|
| 17 |
if 'location' in a:
|
| 18 |
from qvm_formatter_support import formatter_env
|
| 19 |
tables,bytes_=formatter_env(raw,h);m.update(tables);write_bytes(m,b,bytes_);put_string(m,b,TEXT,bytes.fromhex(a['payload']));m[23708]=a['ring']
|
| 20 |
-
for e in
|
| 21 |
return m,b
|
| 22 |
|
| 23 |
def nearest_fixtures():
|
|
@@ -25,29 +25,29 @@ def nearest_fixtures():
|
|
| 25 |
profiles=[{},dict(cache=0),dict(cache=0,expiry=10000),dict(cache=0,expiry=9999),dict(cache=1,tick=0xffffffff,expiry=0),dict(query=[1,0],triggers=[1,1,0]),dict(query=[2,0],triggers=[1,0,0]),dict(query=[0,1]),dict(visible=[1,0,0]),dict(visible=[0,0,0]),dict(order=[]),dict(order=[2,0]),dict(points=[[15000.,0.,0.],[16000.,0.,0.],[17000.,0.,0.]]),dict(visible=[0,1,1]),dict(query=[2],triggers=[0,0,1]),dict(order=[1,0,2],visible=[1,1,0])]
|
| 26 |
return [dict(defaults,**changes,profile=j) for j,changes in enumerate(profiles)]
|
| 27 |
|
| 28 |
-
def nearest_seed(m,b,a):
|
| 29 |
-
m.update({ENTITY+848:0 if a['cache'] is None else
|
| 30 |
for j in range(3):
|
| 31 |
m[ENTITY+488+4*j]=word(0.);m[ENTITY+436+4*j]=word([-16.,-16.,-24.][j]);m[ENTITY+448+4*j]=word([16.,16.,32.][j])
|
| 32 |
-
for j,e in enumerate(
|
| 33 |
name=BASE+0x10000+128*j;node=BASE+0x11000+32*j
|
| 34 |
put_string(m,b,name,b'TRIGGER_LOCATION' if a['triggers'][j] else b'misc_location');m[e+536]=name;m[e+524]=node;m[e+596]=a['expiry'];m[node+24]=0
|
| 35 |
for k,v in enumerate(a['points'][j]):m[e+488+4*k]=word(v)
|
| 36 |
-
for j,index in enumerate(a['order']):m[m[
|
| 37 |
|
| 38 |
-
def nearest_run(ins,m,b,a):
|
| 39 |
queries=[];pvs=[]
|
| 40 |
def box(i,m,args,bs):
|
| 41 |
queries.append([[m[args[o]+4*k]&0xffffffff for k in range(3)] for o in [8,12]])
|
| 42 |
assert args[20]==1024
|
| 43 |
-
changes={args[16]+4*j+k:((
|
| 44 |
return m,len(a['query']),{'engine_box_response_supplied':True,'child_memory_bytes':changes}
|
| 45 |
def compare(i,m,args,bs):
|
| 46 |
m,v,p,b=casecmp(i,m,args,dict(bs),base=BASE+0x30000);return m,v,{'actual_source_child':69386}
|
| 47 |
def visible(i,m,args,bs):
|
| 48 |
-
j=next(j for j,e in enumerate(
|
| 49 |
m,v,p,b=run(ins,m,268248,268635,4228,{8:ENTITY},b,{-33:box,69386:compare,-27:visible},base=BASE)
|
| 50 |
-
return m,dict(selected=None if not v else
|
| 51 |
|
| 52 |
def nearest(ins,m,b,a):nearest_seed(m,b,a);return nearest_run(ins,m,b,a)
|
| 53 |
|
|
@@ -89,15 +89,20 @@ def radio_fixtures():
|
|
| 89 |
rows.append(a);return rows
|
| 90 |
|
| 91 |
def radio(ins,m,b,a):
|
| 92 |
-
from qvm_effect_feedback_support import radio_seed
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 93 |
from qvm_scoreboard_wire_support import row_format,final_format
|
| 94 |
from qvm_formatter_support import formatter
|
| 95 |
-
|
| 96 |
def get(i,m,args,bs):
|
| 97 |
calls.append(1)
|
| 98 |
def locate(i,m,args,bs):
|
| 99 |
-
m,p,b=nearest_run(i,m,dict(bs),a['location']);locations.append(p)
|
| 100 |
-
return m,0 if p['selected'] is None else
|
| 101 |
def bounded(i,m,args,bs):
|
| 102 |
m,v,e=row_format(i,m,args,dict(bs),formatter);warnings.extend(e['diagnostics']);return m,v,e
|
| 103 |
m,v,p,b=run(i,m,268637,268676,32,args,dict(bs),{268248:locate,70386:bounded},base=BASE+0x40000)
|
|
|
|
| 9 |
BASE=ROOT+0x200000
|
| 10 |
LOC=[POOL+880*j for j in [5,6,7]]
|
| 11 |
|
| 12 |
+
def seed(raw,h,a,loc=LOC):
|
| 13 |
m,b=old_seed(raw,h,a)
|
| 14 |
for p in [31128,31132,31136]:m[p]=int.from_bytes(raw[h['data_offset']+p:h['data_offset']+p+4],'little')
|
| 15 |
for address in [93224,93227]:put_string(m,b,address,raw[h['data_offset']+address:].split(b'\0')[0])
|
|
|
|
| 17 |
if 'location' in a:
|
| 18 |
from qvm_formatter_support import formatter_env
|
| 19 |
tables,bytes_=formatter_env(raw,h);m.update(tables);write_bytes(m,b,bytes_);put_string(m,b,TEXT,bytes.fromhex(a['payload']));m[23708]=a['ring']
|
| 20 |
+
for e in loc:m[e+592]=TEXT
|
| 21 |
return m,b
|
| 22 |
|
| 23 |
def nearest_fixtures():
|
|
|
|
| 25 |
profiles=[{},dict(cache=0),dict(cache=0,expiry=10000),dict(cache=0,expiry=9999),dict(cache=1,tick=0xffffffff,expiry=0),dict(query=[1,0],triggers=[1,1,0]),dict(query=[2,0],triggers=[1,0,0]),dict(query=[0,1]),dict(visible=[1,0,0]),dict(visible=[0,0,0]),dict(order=[]),dict(order=[2,0]),dict(points=[[15000.,0.,0.],[16000.,0.,0.],[17000.,0.,0.]]),dict(visible=[0,1,1]),dict(query=[2],triggers=[0,0,1]),dict(order=[1,0,2],visible=[1,1,0])]
|
| 26 |
return [dict(defaults,**changes,profile=j) for j,changes in enumerate(profiles)]
|
| 27 |
|
| 28 |
+
def nearest_seed(m,b,a,loc=LOC):
|
| 29 |
+
m.update({ENTITY+848:0 if a['cache'] is None else loc[a['cache']],34992532:a['tick'],34999640:loc[a['order'][0]] if a['order'] else 0})
|
| 30 |
for j in range(3):
|
| 31 |
m[ENTITY+488+4*j]=word(0.);m[ENTITY+436+4*j]=word([-16.,-16.,-24.][j]);m[ENTITY+448+4*j]=word([16.,16.,32.][j])
|
| 32 |
+
for j,e in enumerate(loc):
|
| 33 |
name=BASE+0x10000+128*j;node=BASE+0x11000+32*j
|
| 34 |
put_string(m,b,name,b'TRIGGER_LOCATION' if a['triggers'][j] else b'misc_location');m[e+536]=name;m[e+524]=node;m[e+596]=a['expiry'];m[node+24]=0
|
| 35 |
for k,v in enumerate(a['points'][j]):m[e+488+4*k]=word(v)
|
| 36 |
+
for j,index in enumerate(a['order']):m[m[loc[index]+524]+24]=loc[a['order'][j+1]] if j+1<len(a['order']) else 0
|
| 37 |
|
| 38 |
+
def nearest_run(ins,m,b,a,loc=LOC):
|
| 39 |
queries=[];pvs=[]
|
| 40 |
def box(i,m,args,bs):
|
| 41 |
queries.append([[m[args[o]+4*k]&0xffffffff for k in range(3)] for o in [8,12]])
|
| 42 |
assert args[20]==1024
|
| 43 |
+
changes={args[16]+4*j+k:(((loc[v]-POOL)//880)>>(8*k))&255 for j,v in enumerate(a['query']) for k in range(4)};write_bytes(m,dict(bs),changes)
|
| 44 |
return m,len(a['query']),{'engine_box_response_supplied':True,'child_memory_bytes':changes}
|
| 45 |
def compare(i,m,args,bs):
|
| 46 |
m,v,p,b=casecmp(i,m,args,dict(bs),base=BASE+0x30000);return m,v,{'actual_source_child':69386}
|
| 47 |
def visible(i,m,args,bs):
|
| 48 |
+
j=next(j for j,e in enumerate(loc) if args[12]==e+488);pvs.append(j);return m,a['visible'][j],{'engine_pvs_response_supplied':True}
|
| 49 |
m,v,p,b=run(ins,m,268248,268635,4228,{8:ENTITY},b,{-33:box,69386:compare,-27:visible},base=BASE)
|
| 50 |
+
return m,dict(selected=None if not v else loc.index(v),queries=queries,pvs=pvs,cache=None if not m[ENTITY+848] else loc.index(m[ENTITY+848]),execution=p['execution']),b
|
| 51 |
|
| 52 |
def nearest(ins,m,b,a):nearest_seed(m,b,a);return nearest_run(ins,m,b,a)
|
| 53 |
|
|
|
|
| 89 |
rows.append(a);return rows
|
| 90 |
|
| 91 |
def radio(ins,m,b,a):
|
| 92 |
+
from qvm_effect_feedback_support import radio_seed
|
| 93 |
+
radio_seed(m,b,a);nearest_seed(m,b,a['location'])
|
| 94 |
+
return radio_live(ins,m,b,a)
|
| 95 |
+
|
| 96 |
+
def radio_live(ins,m,b,a,loc=LOC):
|
| 97 |
+
from qvm_effect_feedback_support import radio_run
|
| 98 |
from qvm_scoreboard_wire_support import row_format,final_format
|
| 99 |
from qvm_formatter_support import formatter
|
| 100 |
+
locations=[];warnings=[];calls=[]
|
| 101 |
def get(i,m,args,bs):
|
| 102 |
calls.append(1)
|
| 103 |
def locate(i,m,args,bs):
|
| 104 |
+
m,p,b=nearest_run(i,m,dict(bs),a['location'],loc);locations.append(p)
|
| 105 |
+
return m,0 if p['selected'] is None else loc[p['selected']],{'actual_source_child':268248}
|
| 106 |
def bounded(i,m,args,bs):
|
| 107 |
m,v,e=row_format(i,m,args,dict(bs),formatter);warnings.extend(e['diagnostics']);return m,v,e
|
| 108 |
m,v,p,b=run(i,m,268637,268676,32,args,dict(bs),{268248:locate,70386:bounded},base=BASE+0x40000)
|
scripts/test_qvm_defuse_located_callback.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import unittest
|
| 3 |
+
from pathlib import Path
|
| 4 |
+
|
| 5 |
+
from qvm_location_feedback_oracle import radio
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
class LocatedCallbackTests(unittest.TestCase):
|
| 9 |
+
def test_radio_is_driven_by_returned_defuse_start(self):
|
| 10 |
+
directory = Path('docs/research')
|
| 11 |
+
baseline = json.loads((directory / 'qvm-defuse-allocated-callback.json').read_text())
|
| 12 |
+
report = json.loads((directory / 'qvm-defuse-located-callback.json').read_text())
|
| 13 |
+
self.assertEqual(report['sha256'], baseline['sha256'])
|
| 14 |
+
self.assertEqual(len(report['probes']), 48)
|
| 15 |
+
base_rows = {(p['input']['profile'], p['input']['allocation']['profile']): p
|
| 16 |
+
for p in baseline['probes']}
|
| 17 |
+
cases = set()
|
| 18 |
+
for row in report['probes']:
|
| 19 |
+
a = row['input']
|
| 20 |
+
radio_input = a['radio']
|
| 21 |
+
key = (a['profile'], a['allocation']['profile'])
|
| 22 |
+
with self.subTest(case=key, location=radio_input['location']['profile']):
|
| 23 |
+
expected = base_rows[key]
|
| 24 |
+
for field in expected.keys() - {'input', 'execution'}:
|
| 25 |
+
self.assertEqual(row[field], expected[field], field)
|
| 26 |
+
starts = any(e['op'] == 'sound' for e in expected['events'])
|
| 27 |
+
if starts:
|
| 28 |
+
result = radio(radio_input)
|
| 29 |
+
# The composed handler executes the real lookup and formatter.
|
| 30 |
+
self.assertEqual(row['radio'], [{k: result[k] for k in row['radio'][0]}])
|
| 31 |
+
self.assertEqual((row['ring'], row['marker']), (result['ring'], result['marker']))
|
| 32 |
+
self.assertGreater(row['execution']['radio'][0]['trace_length'], 0)
|
| 33 |
+
cases.add((key, result['location_result'], result['warnings']))
|
| 34 |
+
else:
|
| 35 |
+
self.assertEqual(row['radio'], [])
|
| 36 |
+
self.assertEqual(row['ring'], radio_input['ring'])
|
| 37 |
+
self.assertEqual(row['marker'], [17, 18])
|
| 38 |
+
self.assertEqual(len(cases), 16)
|
| 39 |
+
self.assertEqual({warnings for _, _, warnings in cases}, {0, 1})
|
| 40 |
+
|
| 41 |
+
|
| 42 |
+
if __name__ == '__main__':
|
| 43 |
+
unittest.main()
|
xtask/checks.tsv
CHANGED
|
@@ -4779,3 +4779,9 @@ edge crates/urt-gameplay/src/bin/support/entity_pool.rs scripts/analyze_rust_def
|
|
| 4779 |
edge crates/urt-gameplay/src/bin/support/entity_pool.rs scripts/analyze_rust_location_allocation.py
|
| 4780 |
edge crates/urt-gameplay/src/bin/support/entity_pool.rs scripts/analyze_rust_location_allocated_defuse.py
|
| 4781 |
edge crates/urt-gameplay/src/bin/support/entity_pool.rs scripts/analyze_rust_health_impulse.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4779 |
edge crates/urt-gameplay/src/bin/support/entity_pool.rs scripts/analyze_rust_location_allocation.py
|
| 4780 |
edge crates/urt-gameplay/src/bin/support/entity_pool.rs scripts/analyze_rust_location_allocated_defuse.py
|
| 4781 |
edge crates/urt-gameplay/src/bin/support/entity_pool.rs scripts/analyze_rust_health_impulse.py
|
| 4782 |
+
report scripts/analyze_qvm_defuse_located_callback.py docs/research/qvm-defuse-located-callback.json
|
| 4783 |
+
edge docs/research/qvm-defuse-located-callback.json scripts/test_qvm_defuse_located_callback.py
|
| 4784 |
+
edge docs/research/qvm-defuse-allocated-callback.json scripts/test_qvm_defuse_located_callback.py
|
| 4785 |
+
group qvm-defuse-located-callback scripts/analyze_qvm_defuse_located_callback.py
|
| 4786 |
+
group qvm-defuse-located-callback scripts/analyze_qvm_location_radio.py
|
| 4787 |
+
edge scripts/analyze_qvm_defuse_located_callback.py scripts/analyze_qvm_resumer_audit.py
|