nmarshall commited on
Commit
fbab93d
·
1 Parent(s): 39c456c

qvm: audit water and gait resumption

Browse files
docs/ASSET_PIPELINE_TODO.md CHANGED
@@ -1012,3 +1012,6 @@ Research progress: RE-785 [report](research/QVM_AWARD_REENTRY.md); original asse
1012
 
1013
 
1014
  Research progress: RE-786 [report](research/QVM_COUNTER_REENTRY.md); original assets unchanged.
 
 
 
 
1012
 
1013
 
1014
  Research progress: RE-786 [report](research/QVM_COUNTER_REENTRY.md); original assets unchanged.
1015
+
1016
+
1017
+ Research progress: RE-787 [report](research/QVM_MOVEMENT_REENTRY.md); original assets unchanged.
docs/FINDINGS.md CHANGED
@@ -1358,3 +1358,6 @@ RE-725–734 batch: [health, contact and Rust impulse findings](research/QVM_HEA
1358
 
1359
 
1360
  **RE-786 — Audited method counters team pairs and dense record clearing:** 278834,279720 and285486 now use corrected reentry; independent counter/alias/address oracles and full legacy tuple comparisons cover160 expanded fixtures. [Evidence](research/QVM_COUNTER_REENTRY.md).
 
 
 
 
1358
 
1359
 
1360
  **RE-786 — Audited method counters team pairs and dense record clearing:** 278834,279720 and285486 now use corrected reentry; independent counter/alias/address oracles and full legacy tuple comparisons cover160 expanded fixtures. [Evidence](research/QVM_COUNTER_REENTRY.md).
1361
+
1362
+
1363
+ **RE-787 — Audited water-entry dynamic returns and locomotion source consumers:** 41486 and selected47884 prefix/ground paths use corrected movement execution, with full returned-memory differential checks and independent water/gait/event expectations. [Evidence](research/QVM_MOVEMENT_REENTRY.md).
docs/PROVISIONAL_TODO.md CHANGED
@@ -1359,3 +1359,6 @@ Research progress: RE-785 [report](research/QVM_AWARD_REENTRY.md); full native/p
1359
 
1360
 
1361
  Research progress: RE-786 [report](research/QVM_COUNTER_REENTRY.md); full native/platform/game scope remains open.
 
 
 
 
1359
 
1360
 
1361
  Research progress: RE-786 [report](research/QVM_COUNTER_REENTRY.md); full native/platform/game scope remains open.
1362
+
1363
+
1364
+ Research progress: RE-787 [report](research/QVM_MOVEMENT_REENTRY.md); full native/platform/game scope remains open.
docs/RESEARCH_LEDGER.md CHANGED
@@ -1592,3 +1592,8 @@ The movement resumer also loses non-command STORE1 writes across calls in legacy
1592
  ## 2026-10-21 — RE-786 Audited method counters team pairs and dense record clearing
1593
 
1594
  278834,279720 and285486 now use corrected reentry; independent counter/alias/address oracles and full legacy tuple comparisons cover160 expanded fixtures. Focused `cargo xtask test-group counter-reentry` passes (34 Python tests); selected reports regenerate twice byte-identically, with storage, links and whitespace guards. New report: 200891 bytes. Full-suite validation is deferred to the tenth batch commit. Three bounded source helpers migrated; independent numeric/address expectations and existing source/Rust regressions check their contracts.
 
 
 
 
 
 
1592
  ## 2026-10-21 — RE-786 Audited method counters team pairs and dense record clearing
1593
 
1594
  278834,279720 and285486 now use corrected reentry; independent counter/alias/address oracles and full legacy tuple comparisons cover160 expanded fixtures. Focused `cargo xtask test-group counter-reentry` passes (34 Python tests); selected reports regenerate twice byte-identically, with storage, links and whitespace guards. New report: 200891 bytes. Full-suite validation is deferred to the tenth batch commit. Three bounded source helpers migrated; independent numeric/address expectations and existing source/Rust regressions check their contracts.
1595
+
1596
+
1597
+ ## 2026-10-21 — RE-787 Audited water-entry dynamic returns and locomotion source consumers
1598
+
1599
+ 41486 and selected47884 prefix/ground paths use corrected movement execution, with full returned-memory differential checks and independent water/gait/event expectations. Focused `cargo xtask test-group movement-reentry` passes (65 Python tests); selected reports regenerate twice byte-identically, with storage, links and whitespace guards. New report: 413676 bytes. Full-suite validation is deferred to the tenth batch commit. Selected movement producers migrated; the shared execute default remains legacy during the wider audit.
docs/REVERSE_ENGINEERING_TODO.md CHANGED
@@ -1408,3 +1408,6 @@ Purpose: turn the supplied installation into an evidence-backed specification of
1408
 
1409
 
1410
  - [x] RE-786 Audited method counters team pairs and dense record clearing ([report](research/QVM_COUNTER_REENTRY.md)).
 
 
 
 
1408
 
1409
 
1410
  - [x] RE-786 Audited method counters team pairs and dense record clearing ([report](research/QVM_COUNTER_REENTRY.md)).
1411
+
1412
+
1413
+ - [x] RE-787 Audited water-entry dynamic returns and locomotion source consumers ([report](research/QVM_MOVEMENT_REENTRY.md)).
docs/research/QVM_MOVEMENT_REENTRY.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Audited water-entry dynamic returns and locomotion source consumers
2
+
3
+ RE-787. Reproduce with `python3 scripts/analyze_qvm_movement_reentry.py`; validate with `cargo xtask test-group movement-reentry`. See the [machine report](qvm-movement-reentry.json).
4
+
5
+ The42 source audit fixtures cover both dynamic contents queries, water launch gates and grounded stance/gait/event combinations. The full existing36 water and120 locomotion report cases, prefix consumers and dependent reports are regenerated and checked through xtask. Both reviewed dynamic result offsets preserve the contents pointer. Supplied native contents and modeled square roots remain explicit. Other movement consumers and arbitrary callback byte effects are still open.
6
+
7
+ No original executable/full VM/native world collision or rendering runs. Supplied callback/native responses and fixture domains remain explicit; complete macOS/Linux Rust/Bevy/Solari gameplay remains open.
docs/research/README.md CHANGED
@@ -948,3 +948,6 @@ The extension collector adds five focused tests for native tail calls, command-r
948
 
949
 
950
  [RE-786: Audited method counters team pairs and dense record clearing](QVM_COUNTER_REENTRY.md).
 
 
 
 
948
 
949
 
950
  [RE-786: Audited method counters team pairs and dense record clearing](QVM_COUNTER_REENTRY.md).
951
+
952
+
953
+ [RE-787: Audited water-entry dynamic returns and locomotion source consumers](QVM_MOVEMENT_REENTRY.md).
docs/research/qvm-movement-reentry.json ADDED
The diff for this file is too large to render. See raw diff
 
docs/research/qvm-resumer-audit.json CHANGED
@@ -2469,7 +2469,7 @@
2469
  48714
2470
  ],
2471
  "path": "scripts/analyze_qvm_locomotion.py",
2472
- "repeated_calls_opt_in": false
2473
  },
2474
  {
2475
  "backward_conditional_branches": [],
@@ -2742,7 +2742,7 @@
2742
  48714
2743
  ],
2744
  "path": "scripts/analyze_qvm_locomotion_prefix.py",
2745
- "repeated_calls_opt_in": false
2746
  },
2747
  {
2748
  "backward_conditional_branches": [],
@@ -6258,7 +6258,7 @@
6258
  41766
6259
  ],
6260
  "path": "scripts/analyze_qvm_water_entry.py",
6261
- "repeated_calls_opt_in": false
6262
  },
6263
  {
6264
  "backward_conditional_branches": [],
@@ -8920,7 +8920,7 @@
8920
  "summary": {
8921
  "call_expressions": 179,
8922
  "files": 140,
8923
- "legacy_expressions": 166,
8924
  "nonliteral_ranges": 20
8925
  }
8926
  }
 
2469
  48714
2470
  ],
2471
  "path": "scripts/analyze_qvm_locomotion.py",
2472
+ "repeated_calls_opt_in": true
2473
  },
2474
  {
2475
  "backward_conditional_branches": [],
 
2742
  48714
2743
  ],
2744
  "path": "scripts/analyze_qvm_locomotion_prefix.py",
2745
+ "repeated_calls_opt_in": true
2746
  },
2747
  {
2748
  "backward_conditional_branches": [],
 
6258
  41766
6259
  ],
6260
  "path": "scripts/analyze_qvm_water_entry.py",
6261
+ "repeated_calls_opt_in": true
6262
  },
6263
  {
6264
  "backward_conditional_branches": [],
 
8920
  "summary": {
8921
  "call_expressions": 179,
8922
  "files": 140,
8923
+ "legacy_expressions": 163,
8924
  "nonliteral_ranges": 20
8925
  }
8926
  }
scripts/analyze_qvm_locomotion.py CHANGED
@@ -10,7 +10,7 @@ from analyze_qvm import write_json
10
 
11
  def locomotion(ins,m,cmd=(0,0,0)):
12
  surface=m[35023988];m,p=locomotion_prefix(ins,m,cmd);prefix=p.pop('execution');after=state(m);tail=None
13
- if prefix['stop']==48209:m,c,tail=execute(ins,48209,48714,m,cmd,LOCAL,handlers())
14
  return m,{**p,'surface':surface,'prefix_execution':prefix,'after_prefix':after,'ground_execution':tail,'final':state(m)}
15
 
16
  def main():
 
10
 
11
  def locomotion(ins,m,cmd=(0,0,0)):
12
  surface=m[35023988];m,p=locomotion_prefix(ins,m,cmd);prefix=p.pop('execution');after=state(m);tail=None
13
+ if prefix['stop']==48209:m,c,tail=execute(ins,48209,48714,m,cmd,LOCAL,handlers(),repeated_calls=True)
14
  return m,{**p,'surface':surface,'prefix_execution':prefix,'after_prefix':after,'ground_execution':tail,'final':state(m)}
15
 
16
  def main():
scripts/analyze_qvm_locomotion_prefix.py CHANGED
@@ -11,7 +11,7 @@ LOCAL=0x71000000
11
 
12
  def locomotion_prefix(ins,m,cmd=(0,0,0)):
13
  before=state(m);velocity=vec(m,PS+32);ps216=m[PS+216];cfg=weapon_words(m,before['packed']&255)
14
- m,c,r=execute(ins,47885,48714,m,cmd,LOCAL,handlers(),boundaries=[48209])
15
  return m,{'initial':before,'commands':list(cmd),'buttons':m[FRAME+20],'level':m[FRAME+212],'dt':m[35023932],'kind':m[PS+4],'velocity':velocity,'config':cfg,'ps216_before':ps216,'ps216_after':m[PS+216],'execution':r,'final':state(m)}
16
 
17
  def main():
 
11
 
12
  def locomotion_prefix(ins,m,cmd=(0,0,0)):
13
  before=state(m);velocity=vec(m,PS+32);ps216=m[PS+216];cfg=weapon_words(m,before['packed']&255)
14
+ m,c,r=execute(ins,47885,48714,m,cmd,LOCAL,handlers(),boundaries=[48209],repeated_calls=True)
15
  return m,{'initial':before,'commands':list(cmd),'buttons':m[FRAME+20],'level':m[FRAME+212],'dt':m[35023932],'kind':m[PS+4],'velocity':velocity,'config':cfg,'ps216_before':ps216,'ps216_after':m[PS+216],'execution':r,'final':state(m)}
16
 
17
  def main():
scripts/analyze_qvm_movement_reentry.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Selected movement source consumers with full returned-memory differential checks."""
3
+ from contextlib import ExitStack
4
+ from unittest.mock import patch
5
+ import itertools
6
+ from pathlib import Path
7
+ import analyze_qvm_water_entry as water
8
+ import analyze_qvm_locomotion as gait
9
+ import analyze_qvm_locomotion_prefix as prefix
10
+ from qvm_research_support import source,memory
11
+ from analyze_qvm_acceleration import PS,FRAME,word
12
+ from qvm_suffix_support import seed,weapon_config
13
+ from analyze_qvm import write_json
14
+
15
+ def compare(invoke):
16
+ def old_call(fn):
17
+ def call(*a,**kw):kw['repeated_calls']=False;return fn(*a,**kw)
18
+ return call
19
+ with ExitStack() as stack:
20
+ for module in [water,gait,prefix]:stack.enter_context(patch.object(module,'execute',old_call(module.execute)))
21
+ old=invoke()
22
+ new=invoke();return new,old==new
23
+
24
+ def main():
25
+ q,raw,h,ins=source();waters=[];gaits=[]
26
+ for timer,level,samples in itertools.product([0,1],[1,2,3],[(0,0),(1,0),(3,8)]):
27
+ def invoke():
28
+ m=memory(raw,h);m.update({PS+16:timer,FRAME+212:level,FRAME+228:-26})
29
+ for j,v in enumerate([3,4,9]):m[35023892+4*j]=word(v)
30
+ return water.water_entry(ins,m,samples=samples)
31
+ new,equal=compare(invoke);waters.append({'legacy_equal':equal,'probe':new[1]})
32
+ for flags,buttons,level in itertools.product([0,1,16384,16385],[0,16,256],[0,2]):
33
+ def invoke():
34
+ cmd=(127,0,0);m=weapon_config(seed(raw,h,cmd),raw,h);m.update({PS+312:22,PS+68:8,PS+12:flags,FRAME+20:buttons,PS+220:128,FRAME+212:level,PS+8:60,35023932:16});return gait.locomotion(ins,m,cmd)
35
+ new,equal=compare(invoke);gaits.append({'legacy_equal':equal,'probe':new[1]})
36
+ write_json(Path('docs/research/qvm-movement-reentry.json'),{'source':q['source'],'sha256':q['sha256'],'water':waters,'gaits':gaits,'limits':'Corrected41486 and selected47884 prefix/ground consumers. Full returned memory/effect equality on18 water and24 gait fixtures. Actual recovered animation/event children, supplied contents and modeled sqrt; no native world physics/animation playback. Other execute consumers remain unaudited.'})
37
+ if __name__=='__main__':main()
scripts/analyze_qvm_water_entry.py CHANGED
@@ -15,7 +15,7 @@ def water_entry(ins,m,cmd=(0,0,0),samples=(1,0)):
15
  initial=snapshot(m);level=m[FRAME+212];basis=vec(m,35023892);queries=[]
16
  def contents(i,m,a,c):
17
  value=samples[len(queries)];r={'point':vec(m,a[8]),'entity':a[12],'value':value};queries.append(r);return m,c,value,r
18
- m,cmd,r=execute(ins,41487,41766,m,cmd,LOCAL,{-26:contents},{41650:52,41691:60})
19
  return m,{'initial':initial,'level':level,'basis':basis,'samples':list(samples),'queries':queries,'return_word':r['return'],'execution':r,'final':snapshot(m)}
20
 
21
 
 
15
  initial=snapshot(m);level=m[FRAME+212];basis=vec(m,35023892);queries=[]
16
  def contents(i,m,a,c):
17
  value=samples[len(queries)];r={'point':vec(m,a[8]),'entity':a[12],'value':value};queries.append(r);return m,c,value,r
18
+ m,cmd,r=execute(ins,41487,41766,m,cmd,LOCAL,{-26:contents},{41650:52,41691:60},repeated_calls=True)
19
  return m,{'initial':initial,'level':level,'basis':basis,'samples':list(samples),'queries':queries,'return_word':r['return'],'execution':r,'final':snapshot(m)}
20
 
21
 
scripts/test_qvm_movement_reentry.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json,copy,unittest
2
+ from pathlib import Path
3
+ from test_qvm_ground import word,n,f
4
+ from test_qvm_locomotion import locomotion_state
5
+ class MovementReentryTests(unittest.TestCase):
6
+ @classmethod
7
+ def setUpClass(cls):cls.r=json.loads(Path('docs/research/qvm-movement-reentry.json').read_text())
8
+ def test_water_launch_state_and_full_memory_compatibility(self):
9
+ self.assertEqual(len(self.r['water']),18)
10
+ for row in self.r['water']:
11
+ p=row['probe'];entered=p['initial']['timer']==0 and p['level']==2 and p['samples'][0]&1 and p['samples'][1]==0;out=copy.deepcopy(p['initial'])
12
+ if entered:out['velocity']=[word(f(n(v)*200)) for v in p['basis'][:2]]+[word(350)];out['flags']|=128;out['timer']=2000
13
+ self.assertEqual(p['final'],out);self.assertEqual(p['return_word'],int(bool(entered)));self.assertTrue(row['legacy_equal'])
14
+ def test_gait_state_event_order_and_memory_compatibility(self):
15
+ self.assertEqual(len(self.r['gaits']),24)
16
+ for row in self.r['gaits']:
17
+ p=row['probe'];state,requests=locomotion_state(p);self.assertEqual(p['final'],state);calls=p['prefix_execution']['calls']+(p['ground_execution']['calls'] if p['ground_execution'] else []);self.assertEqual([(c['target'],None if c['target']==45887 else c['args']['8']) for c in calls if c['target']!=-107],requests);self.assertTrue(row['legacy_equal'])
18
+ def test_dynamic_contents_pointer_and_query_paths(self):
19
+ ps=[r['probe'] for r in self.r['water']];self.assertEqual({len(p['queries']) for p in ps},{0,1,2})
20
+ for p in ps:
21
+ for c in p['execution']['calls']:
22
+ if c['instruction'] in [41650,41691]:self.assertEqual(c['target'],-26)
23
+ if __name__=='__main__':unittest.main()
xtask/checks.tsv CHANGED
@@ -1751,3 +1751,13 @@ report scripts/analyze_qvm_counter_reentry.py docs/research/qvm-counter-reentry.
1751
  edge docs/research/qvm-counter-reentry.json scripts/test_qvm_counter_reentry.py
1752
  edge scripts/analyze_qvm_counter_reentry.py scripts/analyze_qvm_resumer_audit.py
1753
  group counter-reentry scripts/analyze_qvm_counter_reentry.py
 
 
 
 
 
 
 
 
 
 
 
1751
  edge docs/research/qvm-counter-reentry.json scripts/test_qvm_counter_reentry.py
1752
  edge scripts/analyze_qvm_counter_reentry.py scripts/analyze_qvm_resumer_audit.py
1753
  group counter-reentry scripts/analyze_qvm_counter_reentry.py
1754
+
1755
+ group movement-reentry scripts/analyze_qvm_water_entry.py
1756
+
1757
+ group movement-reentry scripts/analyze_qvm_locomotion_prefix.py
1758
+
1759
+ group movement-reentry scripts/analyze_qvm_locomotion.py
1760
+ report scripts/analyze_qvm_movement_reentry.py docs/research/qvm-movement-reentry.json
1761
+ edge docs/research/qvm-movement-reentry.json scripts/test_qvm_movement_reentry.py
1762
+ edge scripts/analyze_qvm_movement_reentry.py scripts/analyze_qvm_resumer_audit.py
1763
+ group movement-reentry scripts/analyze_qvm_movement_reentry.py