nmarshall commited on
Commit
58b0eb7
·
1 Parent(s): 638d56b

qvm: history state application

Browse files
docs/ASSET_PIPELINE_TODO.md CHANGED
@@ -598,3 +598,6 @@ Research progress: RE-638 [report](research/QVM_HISTORY_VECTOR_LERP.md); remaini
598
 
599
 
600
  Research progress: RE-639 [report](research/QVM_HISTORY_ANGLE_LERP.md); remaining native/content/runtime/platform scope stays open.
 
 
 
 
598
 
599
 
600
  Research progress: RE-639 [report](research/QVM_HISTORY_ANGLE_LERP.md); remaining native/content/runtime/platform scope stays open.
601
+
602
+
603
+ Research progress: RE-640 [report](research/QVM_REWIND_HISTORY_APPLY.md); remaining native/content/runtime/platform scope stays open.
docs/FINDINGS.md CHANGED
@@ -947,3 +947,6 @@ Bounded qagame paths recover bomb-plant/inactivity correction requests, direct f
947
 
948
 
949
  **RE-639 — History angle interpolation and strict half-turn correction:** 63746 corrects differences strictly beyond±180 by one360 step, then interpolates without normalizing the result or weight. [Evidence](research/QVM_HISTORY_ANGLE_LERP.md).
 
 
 
 
947
 
948
 
949
  **RE-639 — History angle interpolation and strict half-turn correction:** 63746 corrects differences strictly beyond±180 by one360 step, then interpolates without normalizing the result or weight. [Evidence](research/QVM_HISTORY_ANGLE_LERP.md).
950
+
951
+
952
+ **RE-640 — History application vector angle and discrete state map:** 143100 blends velocity/position and angles but copies animations and six client fields directly from the lower selected history row. [Evidence](research/QVM_REWIND_HISTORY_APPLY.md).
docs/PROVISIONAL_TODO.md CHANGED
@@ -918,3 +918,6 @@ Research progress: RE-638 [report](research/QVM_HISTORY_VECTOR_LERP.md); remaini
918
 
919
 
920
  Research progress: RE-639 [report](research/QVM_HISTORY_ANGLE_LERP.md); remaining native/content/runtime/platform scope stays open.
 
 
 
 
918
 
919
 
920
  Research progress: RE-639 [report](research/QVM_HISTORY_ANGLE_LERP.md); remaining native/content/runtime/platform scope stays open.
921
+
922
+
923
+ Research progress: RE-640 [report](research/QVM_REWIND_HISTORY_APPLY.md); remaining native/content/runtime/platform scope stays open.
docs/RESEARCH_LEDGER.md CHANGED
@@ -867,3 +867,8 @@ Whole291641 now follows supplied world/entity traces through retry, ordered reli
867
  ## 2026-10-20 — RE-639 History angle interpolation and strict half-turn correction (separate task commit)
868
 
869
  63746 corrects differences strictly beyond±180 by one360 step, then interpolates without normalizing the result or weight. 50 exact f32 boundary/wrap/extrapolation cases match an independent numeric oracle and show large differences remain outside a single turn. Full suite: 1032 tests pass. Report regenerates byte-identically (23452 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
 
 
 
 
 
 
867
  ## 2026-10-20 — RE-639 History angle interpolation and strict half-turn correction (separate task commit)
868
 
869
  63746 corrects differences strictly beyond±180 by one360 step, then interpolates without normalizing the result or weight. 50 exact f32 boundary/wrap/extrapolation cases match an independent numeric oracle and show large differences remain outside a single turn. Full suite: 1032 tests pass. Report regenerates byte-identically (23452 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
870
+
871
+
872
+ ## 2026-10-20 — RE-640 History application vector angle and discrete state map (separate task commit)
873
+
874
+ 143100 blends velocity/position and angles but copies animations and six client fields directly from the lower selected history row. 12 ordinary/equal-time/extrapolation cases independently reconstruct every entity/client word and actual helper/native request order. Full suite: 1035 tests pass. Report regenerates byte-identically (265042 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
docs/REVERSE_ENGINEERING_TODO.md CHANGED
@@ -961,3 +961,6 @@ Purpose: turn the supplied installation into an evidence-backed specification of
961
 
962
 
963
  - [x] RE-639 History angle interpolation and strict half-turn correction ([report](research/QVM_HISTORY_ANGLE_LERP.md)).
 
 
 
 
961
 
962
 
963
  - [x] RE-639 History angle interpolation and strict half-turn correction ([report](research/QVM_HISTORY_ANGLE_LERP.md)).
964
+
965
+
966
+ - [x] RE-640 History application vector angle and discrete state map ([report](research/QVM_REWIND_HISTORY_APPLY.md)).
docs/research/QVM_REWIND_HISTORY_APPLY.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # History application vector angle and discrete state map
2
+
3
+ RE-640. Reproduce with `python3 scripts/analyze_qvm_rewind_history_apply.py`; check with `python3 scripts/test_qvm_rewind_history_apply.py`. The [machine report](qvm-rewind-history-apply.json) retains source identity and bounded fixtures.
4
+
5
+ Actual143582–144079 calls recovered143031 twice for history offsets40→entity36 and12→entity24, then mirrors position into488. Three63746 calls interpolate angles24/28/32→entity60/64/68. Entity200/196 read packed bytes36/37, while client4380/4384/4388/4392/6204/6256 copy row offsets56/52/64/60/72/76 directly. These discrete reads use the lower selected row regardless of interpolation weight. Native−31 is captured after the writes. Full-record independent oracles combine the separately checked f32 helpers with the discrete field map; no snapshot prefix or legal history producer is assumed here.
6
+
7
+ No original executable/full QVM/native collision/physics/rendering executes. Native responses and legal input domains are supplied or unverified where stated; full runtime/macOS/Linux Rust/Bevy/Solari gameplay remains open.
docs/research/README.md CHANGED
@@ -519,3 +519,6 @@ The extension collector adds five focused tests for native tail calls, command-r
519
 
520
 
521
  [RE-639: History angle interpolation and strict half-turn correction](QVM_HISTORY_ANGLE_LERP.md). Reproduce with `python3 scripts/analyze_qvm_history_angle_lerp.py`; check with `python3 scripts/test_qvm_history_angle_lerp.py`.
 
 
 
 
519
 
520
 
521
  [RE-639: History angle interpolation and strict half-turn correction](QVM_HISTORY_ANGLE_LERP.md). Reproduce with `python3 scripts/analyze_qvm_history_angle_lerp.py`; check with `python3 scripts/test_qvm_history_angle_lerp.py`.
522
+
523
+
524
+ [RE-640: History application vector angle and discrete state map](QVM_REWIND_HISTORY_APPLY.md). Reproduce with `python3 scripts/analyze_qvm_rewind_history_apply.py`; check with `python3 scripts/test_qvm_rewind_history_apply.py`.
docs/research/qvm-rewind-history-apply.json ADDED
The diff for this file is too large to render. See raw diff
 
scripts/analyze_qvm_rewind_history_apply.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """143100 history application with actual weighted-vector and angle helpers."""
3
+ import itertools
4
+ from pathlib import Path
5
+ from qvm_research_support import source,execute
6
+ from analyze_qvm_rewind_history_select import history_fixture,select_history
7
+ from analyze_qvm_rewind_snapshot import LOCAL,client_state
8
+ from analyze_qvm_history_vector_lerp import interpolate
9
+ from analyze_qvm_history_angle_lerp import angle
10
+ from analyze_qvm_temp_event import record
11
+ from qvm_server_fire_support import ENTITY
12
+ from analyze_qvm import write_json
13
+
14
+ def apply_history(ins,m,pointer):
15
+ client=m[pointer+520];lo=m[LOCAL+28];hi=m[LOCAL+32];rows={str(j):{str(o):m[client+4492+80*j+o]&0xffffffff for o in range(0,80,4)} for j in {lo,hi}};before=record(m,pointer);before_client=client_state(m,client);requests=[]
16
+ def vector(i,m,a,c):m,e=interpolate(i,m,a);return m,c,0,e
17
+ def angles(i,m,a,c):m,e=angle(i,m,a);return m,c,e['result'],e
18
+ def link(i,m,a,c):e={'arguments':a,'native_effect_not_executed':True};requests.append(e);return m,c,0,e
19
+ byte_inputs={client+4492+80*j+36+k:(m[client+4492+80*j+36]>>(8*k))&255 for j in range(20) for k in range(2)};fraction=m[LOCAL+36]&0xffffffff;m,_,e=execute(ins,143582,144080,m,(0,0,0),LOCAL,{143031:vector,63746:angles,-31:link},byte_inputs=byte_inputs)
20
+ return m,{'pointer':pointer,'lower_index':lo,'upper_index':hi,'fraction':fraction,'selected_rows':rows,'initial_entity':before,'initial_client':before_client,'final_entity':record(m,pointer),'final_client':client_state(m,client),'requests':requests,'execution':e}
21
+
22
+ def main():
23
+ q,raw,h,ins=source();rows=[]
24
+ for times,time in itertools.product([[2000-50*j for j in range(20)],[1500]*20],[-100,1050,1475,1950,2000,3000]):
25
+ m=history_fixture(raw,h,times);m,s=select_history(ins,m,ENTITY,time);_,r=apply_history(ins,m,ENTITY);r['selection']=s;rows.append(r)
26
+ write_json(Path('docs/research/qvm-rewind-history-apply.json'),{'source':q['source'],'sha256':q['sha256'],'probes':rows,'limits':'Actual143582–144079 with actual143031/63746 and supplied history/selected context. Native−31 captured. Snapshot prefix and whole rewind are separate; history producer/legal timing domains unverified.'})
27
+ if __name__=='__main__':main()
scripts/test_qvm_rewind_history_apply.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json,unittest
2
+ from pathlib import Path
3
+ from test_qvm_ground import word,n,f
4
+ from test_qvm_history_angle_lerp import expected as angle_expected
5
+
6
+ def expected(p):
7
+ entity=dict(p['initial_entity']);client=dict(p['initial_client']);lo=p['selected_rows'][str(p['lower_index'])];hi=p['selected_rows'][str(p['upper_index'])];t=n(p['fraction'])
8
+ for dst,src in [(36,40),(24,12)]:
9
+ for j in range(3):entity[str(dst+4*j)]=word(f(f(f(1-t)*n(hi[str(src+4*j)]))+f(t*n(lo[str(src+4*j)]))))
10
+ for j in range(3):entity[str(488+4*j)]=entity[str(24+4*j)];entity[str(60+4*j)]=angle_expected(n(hi[str(24+4*j)]),n(lo[str(24+4*j)]),t)[1]
11
+ entity['200']=lo['36']&255;entity['196']=(lo['36']>>8)&255
12
+ for dst,src in [(4380,56),(4384,52),(4388,64),(4392,60),(6204,72),(6256,76)]:client[str(dst)]=lo[str(src)]
13
+ return entity,client
14
+ class RewindHistoryApplyTests(unittest.TestCase):
15
+ @classmethod
16
+ def setUpClass(cls):cls.r=json.loads(Path('docs/research/qvm-rewind-history-apply.json').read_text())
17
+ def test_independent_full_entity_and_client_application(self):
18
+ self.assertEqual(len(self.r['probes']),12)
19
+ for p in self.r['probes']:self.assertEqual((p['final_entity'],p['final_client']),expected(p))
20
+ def test_actual_child_order(self):
21
+ for p in self.r['probes']:self.assertEqual([c['target'] for c in p['execution']['calls']],[143031,143031,63746,63746,63746,-31]);self.assertEqual(p['requests'],[{'arguments':{'8':p['pointer']},'native_effect_not_executed':True}])
22
+ def test_discrete_fields_select_lower_row_even_when_extrapolating(self):
23
+ for p in self.r['probes']:self.assertEqual(p['final_client']['4380'],p['selected_rows'][str(p['lower_index'])]['56']);self.assertEqual(p['initial_client']['4408'],p['final_client']['4408'])
24
+ if __name__=='__main__':unittest.main()