qvm: complete bounded aim function
Browse filesFiles changed (10)
- docs/ASSET_PIPELINE_TODO.md+3
- docs/FINDINGS.md+3
- docs/PROVISIONAL_TODO.md+3
- docs/RESEARCH_LEDGER.md+5
- docs/REVERSE_ENGINEERING_TODO.md+3
- docs/research/QVM_COMPLETE_AIM.mdAdded+7
- docs/research/README.md+3
- docs/research/qvm-complete-aim.jsonAdded
- scripts/analyze_qvm_complete_aim.pyAdded+42
- scripts/test_qvm_complete_aim.pyAdded+18
531 unmodified lines532533534531 unmodified linesResearch progress: RE-617 [report](research/QVM_AIM_ENDPOINT.md); remaining native/content/runtime/platform scope stays open.531 unmodified lines532533534535536537531 unmodified linesResearch progress: RE-617 [report](research/QVM_AIM_ENDPOINT.md); remaining native/content/runtime/platform scope stays open.Research progress: RE-618 [report](research/QVM_COMPLETE_AIM.md); remaining native/content/runtime/platform scope stays open.
886 unmodified lines887888889886 unmodified lines**RE-617 — Aim endpoint construction and selected alias behavior:** The endpoint adds origin+16384×forward, then horizontal×global right and vertical×global up in distinct f32 write phases. [Evidence](research/QVM_AIM_ENDPOINT.md).886 unmodified lines887888889890891892886 unmodified lines**RE-617 — Aim endpoint construction and selected alias behavior:** The endpoint adds origin+16384×forward, then horizontal×global right and vertical×global up in distinct f32 write phases. [Evidence](research/QVM_AIM_ENDPOINT.md).**RE-618 — Complete bounded shared aim function control flow:** A single bounded source interpreter now follows every branch and call through290493, including rejection loops, added jitter and final endpoint writes. [Evidence](research/QVM_COMPLETE_AIM.md).
851 unmodified lines852853854851 unmodified linesResearch progress: RE-617 [report](research/QVM_AIM_ENDPOINT.md); remaining native/content/runtime/platform scope stays open.851 unmodified lines852853854855856857851 unmodified linesResearch progress: RE-617 [report](research/QVM_AIM_ENDPOINT.md); remaining native/content/runtime/platform scope stays open.Research progress: RE-618 [report](research/QVM_COMPLETE_AIM.md); remaining native/content/runtime/platform scope stays open.
766 unmodified lines767768769766 unmodified lines## 2026-10-20 — RE-617 Aim endpoint construction and selected alias behavior (separate task commit)The endpoint adds origin+16384×forward, then horizontal×global right and vertical×global up in distinct f32 write phases. 27 independent endpoint fixtures cover nonunit vectors and output aliases to origin/forward, retaining actual source effects. Full suite: 961 tests pass. Report regenerates byte-identically (417024 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.766 unmodified lines767768769770771772773774766 unmodified lines## 2026-10-20 — RE-617 Aim endpoint construction and selected alias behavior (separate task commit)The endpoint adds origin+16384×forward, then horizontal×global right and vertical×global up in distinct f32 write phases. 27 independent endpoint fixtures cover nonunit vectors and output aliases to origin/forward, retaining actual source effects. Full suite: 961 tests pass. Report regenerates byte-identically (417024 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.## 2026-10-20 — RE-618 Complete bounded shared aim function control flow (separate task commit)A single bounded source interpreter now follows every branch and call through290493, including rejection loops, added jitter and final endpoint writes. 17 whole-function fixtures agree with independently checked staged calculations and endpoint formulas; zero seed stops at32 candidates with untouched output. Full suite: 965 tests pass. Report regenerates byte-identically (210344 bytes). Storage/filter, links and whitespace checks pass. No assets/Rust runtime/shared VM evaluator changed; native/reference/legal/full platform scope remains open.
894 unmodified lines895896897894 unmodified lines- [x] RE-617 Aim endpoint construction and selected alias behavior ([report](research/QVM_AIM_ENDPOINT.md)).894 unmodified lines895896897898899900894 unmodified lines- [x] RE-617 Aim endpoint construction and selected alias behavior ([report](research/QVM_AIM_ENDPOINT.md)).- [x] RE-618 Complete bounded shared aim function control flow ([report](research/QVM_COMPLETE_AIM.md)).
1234567# Complete bounded shared aim function control flow
RE-618. Reproduce with `python3 scripts/analyze_qvm_complete_aim.py`; check with `python3 scripts/test_qvm_complete_aim.py`. The [machine report](qvm-complete-aim.json) retains source identity and bounded fixtures.
The new driver interprets290494–291638 as one source range, retaining jumps, native call order and actual36717 state across all stages. It explicitly dispatches only recovered RNG and finite math natives, patches source LOCAL result destinations and rejects unexpected children. Calls and source trace hashes remain visible. Sixteen ordinary cases agree with the previously independently validated staged chain; direct f32 endpoint checks provide an additional vector oracle. A zero-seed case records128 RNG calls plus one sqrt,32 rejected candidates, no trig and unchanged output. The32-attempt limit is a harness boundary, not a successful function return. Completion stops before the void epilogue, and establishes aim data flow rather than a hit/damage outcome.
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.452 unmodified lines453454455452 unmodified lines[RE-617: Aim endpoint construction and selected alias behavior](QVM_AIM_ENDPOINT.md). Reproduce with `python3 scripts/analyze_qvm_aim_endpoint.py`; check with `python3 scripts/test_qvm_aim_endpoint.py`.452 unmodified lines453454455456457458452 unmodified lines[RE-617: Aim endpoint construction and selected alias behavior](QVM_AIM_ENDPOINT.md). Reproduce with `python3 scripts/analyze_qvm_aim_endpoint.py`; check with `python3 scripts/test_qvm_aim_endpoint.py`.[RE-618: Complete bounded shared aim function control flow](QVM_COMPLETE_AIM.md). Reproduce with `python3 scripts/analyze_qvm_complete_aim.py`; check with `python3 scripts/test_qvm_complete_aim.py`.
123456789101112131415161718192021222324252627282930313233343536373839404142#!/usr/bin/env python3"""Interpret the entire290493 body with source control flow and bounded sampling."""import itertools,mathfrom pathlib import Pathfrom analyze_deferred_auth import trace_slicefrom analyze_bsp_references import trace_fieldsfrom qvm_research_support import sourcefrom qvm_server_fire_support import seed,ENTITY,RIGHT,UPfrom qvm_shot_math_support import TRIGfrom analyze_qvm_server_shot_setup import random_wordfrom analyze_qvm_spread_parameters import LOCALfrom analyze_qvm_aim_endpoint import inputs,endpoint,ORIGIN,DIRECTION,OUTPUTfrom analyze_qvm_acceleration import PS,word,numberfrom analyze_qvm_slide_prefix import vecfrom analyze_qvm import write_json
def complete_aim(ins,m,origin=ORIGIN,direction=DIRECTION,output=OUTPUT,attempt_limit=32): if not 1<=attempt_limit<=64:raise ValueError('Attempt limit outside1..64') m=dict(m);initial={'origin':vec(m,origin),'forward':vec(m,direction),'right':vec(m,RIGHT),'up':vec(m,UP),'output':vec(m,output),'seed':m[21044]&0xffffffff};m.update({LOCAL+216:ENTITY,LOCAL+220:origin,LOCAL+224:direction,LOCAL+228:output});pc=290494;trace=[];calls=[];effects=[];candidates=[];points=[x['index']+2 for x in ins[290494:291639] if x['opcode']=='CALL']+[291079,291081,291639] for _ in range(512): t=trace_slice(ins,290494,291639,m,{},resume_at=pc,stop_targets=[p for p in points if p!=pc],local_base=LOCAL,capture_stack=True,limit=8192);m=t['memory'];trace+=t['trace'];pc=t['stop'];calls+=t['calls'] for c in t['calls']: target=c['target'] if target==36717:m,e=random_word(ins,m);value=e['result'];effect={k:e[k] for k in ['initial_seed','final_seed','result']};effect['trace_sha256']=e['execution']['trace_sha256'] elif target==-107:value=word(math.sqrt(number(c['args'][8])));effect={'model':'sqrt','input':c['args'][8]&0xffffffff,'result':value} elif target in TRIG:m,_,value,effect=TRIG[target](ins,m,c['args'],(0,0,0)) else:raise ValueError('Unrecovered aim child '+str(target)) assert ins[c['instruction']+1]['opcode']=='STORE4' and ins[c['instruction']-2]['opcode']=='LOCAL' m[LOCAL+ins[c['instruction']-2]['operand']]=value;effects.append({'call':c,'effect':effect}) if 291066 in t['trace']:candidates.append({'x':m[LOCAL+28]&0xffffffff,'y':m[LOCAL+32]&0xffffffff,'radius_squared':m[LOCAL+128]&0xffffffff,'accepted':pc==291081}) if pc==291639:status='void-epilogue';break if pc==291079 and len(candidates)>=attempt_limit:status='attempt-budget-exhausted';break else:raise ValueError('Aim segment bound exceeded') return m,{'initial':initial,'attempt_limit':attempt_limit,'candidates':candidates,'status':status,'execution':{'calls':calls,'children':effects,**trace_fields({'trace':trace},False)},'offsets':{str(o):m[LOCAL+o]&0xffffffff for o in [76,52]} if status=='void-epilogue' else None,'output':vec(m,output),'final_seed':m[21044]&0xffffffff}
def main(): q,raw,h,ins=source();rows=[] for ident,rng,ground in itertools.product([2,10,14,23],[1,0x12345678],[0,1023]): m=seed(raw,h,ident);m[PS+144]=0;m[PS+312]=ident;m[PS+68]=ground;m[PS+216]=10;m[21044]=rng;m=inputs(m,direction=(.6,-.25,.8));_,r=complete_aim(ins,m);_,stages=endpoint(ins,m);r['staged_comparison']={'output':stages['output'],'final_seed':stages['final_seed'],'status':stages['status']};rows.append(r) m=inputs(seed(raw,h));m[21044]=0;rows.append(complete_aim(ins,m)[1]) write_json(Path('docs/research/qvm-complete-aim.json'),{'source':q['source'],'sha256':q['sha256'],'probes':rows,'limits':'Complete290494–291638 source control flow; stop before void epilogue. Actual36717, finite supplied math natives;32-candidate limit. No fabricated completion on budget exhaustion. No engine trace, hit or damage.'})if __name__=='__main__':main()123456789101112131415161718import json,unittestfrom pathlib import Pathfrom test_qvm_aim_endpoint import expectedclass CompleteAimTests(unittest.TestCase): @classmethod def setUpClass(cls):cls.r=json.loads(Path('docs/research/qvm-complete-aim.json').read_text()) def test_independent_endpoint_and_staged_agreement(self): self.assertEqual(len(self.r['probes']),17) for p in self.r['probes'][:-1]: self.assertEqual(p['output'],expected({'initial':p['initial'],'offsets_stage':{'offsets':p['offsets']}}));self.assertEqual({k:p[k] for k in ['output','final_seed','status']},p['staged_comparison']) def test_four_rng_calls_per_candidate_plus_optional_pair(self): for p in self.r['probes'][:-1]: calls=[c for c in p['execution']['calls'] if c['target']==36717];self.assertIn(len(calls)-4*len(p['candidates']),[0,2]);self.assertTrue(p['candidates'][-1]['accepted']);self.assertFalse(any(c['accepted'] for c in p['candidates'][:-1])) def test_zero_seed_no_output_or_trig(self): p=self.r['probes'][-1];self.assertEqual(p['status'],'attempt-budget-exhausted');self.assertEqual(p['output'],p['initial']['output']);self.assertEqual(len(p['candidates']),32);self.assertEqual(len(p['execution']['calls']),129);self.assertFalse(any(c['target'] in [-104,-105] for c in p['execution']['calls'])) def test_unexpected_children_are_not_supplied(self): for p in self.r['probes']:self.assertLessEqual(set(c['target'] for c in p['execution']['calls']),{36717,-107,-104,-105})if __name__=='__main__':unittest.main()docs/ASSET_PIPELINE_TODO.md+3
docs/FINDINGS.md+3
docs/PROVISIONAL_TODO.md+3
docs/RESEARCH_LEDGER.md+5
docs/REVERSE_ENGINEERING_TODO.md+3
docs/research/QVM_COMPLETE_AIM.mdAdded+7
docs/research/README.md+3
docs/research/qvm-complete-aim.jsonAdded
scripts/analyze_qvm_complete_aim.pyAdded+42
scripts/test_qvm_complete_aim.pyAdded+18