nmarshall commited on
Commit
78388ea
·
1 Parent(s): 171bd70

qvm: recover fallback spawn ranking

Browse files
docs/FINDINGS.md CHANGED
@@ -1589,3 +1589,6 @@ RE-813–822 replaces the scoreboard decimal assumption with actual37914 executi
1589
 
1590
 
1591
  **RE-863:** Rust matches all96 composed source setup/placement fixtures across searches, actual RNG state transitions, checked angle-math transcripts and resolved player indirection. Fallible resolution stages RNG before committing it and performs placement only after success. Fallback selection and native math parity remain explicit boundaries; intermission/respawn/runtime integration is still open. [Evidence](research/RUST_CAMERA_WORLD.md).
 
 
 
 
1589
 
1590
 
1591
  **RE-863:** Rust matches all96 composed source setup/placement fixtures across searches, actual RNG state transitions, checked angle-math transcripts and resolved player indirection. Fallible resolution stages RNG before committing it and performs placement only after success. Fallback selection and native math parity remain explicit boundaries; intermission/respawn/runtime integration is still open. [Evidence](research/RUST_CAMERA_WORLD.md).
1592
+
1593
+
1594
+ **RE-864:** 112 original168114 cases execute actual class-hash search and RNG, recovering stable farthest-first insertion,64-entry cap, far-half draw at8+, first-class fallback when blocked, +9 Z and a no-spawn fatal boundary. Telefrag answers and finite sqrt remain supplied; collision/native/runtime parity is open. [Evidence](research/QVM_SPAWN_FALLBACK.md).
docs/PROVISIONAL_TODO.md CHANGED
@@ -1614,3 +1614,6 @@ RE-863: Rust matches all96 composed source setup/placement fixtures across searc
1614
 
1615
 
1616
  - [ ] RE-864: Recover fallback/native math, compose camera into respawn/intermission, resolve map/allocation/publication effects and validate actual macOS/Linux game traces. [Scope](research/QVM_CAMERA_WORLD_BATCH.md).
 
 
 
 
1614
 
1615
 
1616
  - [ ] RE-864: Recover fallback/native math, compose camera into respawn/intermission, resolve map/allocation/publication effects and validate actual macOS/Linux game traces. [Scope](research/QVM_CAMERA_WORLD_BATCH.md).
1617
+
1618
+
1619
+ RE-864: 112 original168114 cases execute actual class-hash search and RNG, recovering stable farthest-first insertion,64-entry cap, far-half draw at8+, first-class fallback when blocked, +9 Z and a no-spawn fatal boundary. Telefrag answers and finite sqrt remain supplied; collision/native/runtime parity is open. Full runtime completion remains open. [Evidence](research/QVM_SPAWN_FALLBACK.md).
docs/RESEARCH_LEDGER.md CHANGED
@@ -2014,3 +2014,8 @@ Batch RE-854–863 boundary: the single `cargo xtask test-full --since cedc6d02`
2014
  Prompt investigation found the ordinary shell resolves python3 to /usr/bin/python3, while xtask still had a PATH fallback and two Rust integration tests invoked that name directly. The Git hooks were already guarded. The runner and real Python-using tests now require the explicit Nix-store interpreter, rejecting missing/system paths without launching them. Direct analysis-script shebangs still require the documented flake shell. No active Python/xcrun process was observed at inspection; that snapshot cannot attribute an already-dispatched installer prompt.
2015
 
2016
  Validation: all30 xtask tests and the focused storage group (21 Python tests) pass using the flake-declared Nix Python. A real runner invocation with PYTHON unset exits with nix-develop guidance before starting Python. Full suite was not repeated for this focused runner correction.
 
 
 
 
 
 
2014
  Prompt investigation found the ordinary shell resolves python3 to /usr/bin/python3, while xtask still had a PATH fallback and two Rust integration tests invoked that name directly. The Git hooks were already guarded. The runner and real Python-using tests now require the explicit Nix-store interpreter, rejecting missing/system paths without launching them. Direct analysis-script shebangs still require the documented flake shell. No active Python/xcrun process was observed at inspection; that snapshot cannot attribute an already-dispatched installer prompt.
2015
 
2016
  Validation: all30 xtask tests and the focused storage group (21 Python tests) pass using the flake-declared Nix Python. A real runner invocation with PYTHON unset exits with nix-develop guidance before starting Python. Full suite was not repeated for this focused runner correction.
2017
+
2018
+
2019
+ ## 2026-10-27 — RE-864 Original fallback spawn distance ranking and selection
2020
+
2021
+ 112 original168114 cases execute actual class-hash search and RNG, recovering stable farthest-first insertion,64-entry cap, far-half draw at8+, first-class fallback when blocked, +9 Z and a no-spawn fatal boundary. Telefrag answers and finite sqrt remain supplied; collision/native/runtime parity is open. Focused `cargo xtask test-group spawn-fallback` passes (5 Python tests); selected reports regenerate twice deterministically, with storage, documentation links and whitespace guards. Full suite deferred to task ten. Original assets unchanged; source fixtures do not establish complete native/runtime parity.
docs/REVERSE_ENGINEERING_TODO.md CHANGED
@@ -1651,3 +1651,6 @@ Purpose: turn the supplied installation into an evidence-backed specification of
1651
 
1652
 
1653
  - [ ] RE-864: Recover fallback/native math, compose camera into respawn/intermission, resolve map/allocation/publication effects and validate actual macOS/Linux game traces. [Scope](research/QVM_CAMERA_WORLD_BATCH.md).
 
 
 
 
1651
 
1652
 
1653
  - [ ] RE-864: Recover fallback/native math, compose camera into respawn/intermission, resolve map/allocation/publication effects and validate actual macOS/Linux game traces. [Scope](research/QVM_CAMERA_WORLD_BATCH.md).
1654
+
1655
+
1656
+ - [x] RE-864 Original fallback spawn distance ranking and selection ([evidence](research/QVM_SPAWN_FALLBACK.md)).
docs/research/QVM_SPAWN_FALLBACK.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Original fallback spawn distance ranking and selection
2
+
3
+ RE-864. Reproduce with `python3 scripts/analyze_qvm_spawn_fallback.py`; focused validation: `cargo xtask test-group spawn-fallback`. [Machine report](qvm-spawn-fallback.json).
4
+
5
+ 112 original168114 cases execute actual class-hash search and RNG, recovering stable farthest-first insertion,64-entry cap, far-half draw at8+, first-class fallback when blocked, +9 Z and a no-spawn fatal boundary. Telefrag answers and finite sqrt remain supplied; collision/native/runtime parity is open.
6
+
7
+ Original executable/native runtime and complete Linux/macOS Rust/Bevy/Solari acceptance remain unverified.
docs/research/README.md CHANGED
@@ -1187,3 +1187,6 @@ The extension collector adds five focused tests for native tail calls, command-r
1187
  [RE-863: Rust composed camera world selection and placement](RUST_CAMERA_WORLD.md).
1188
 
1189
  - [RE-854–863 entity search and composed world camera batch](QVM_CAMERA_WORLD_BATCH.md).
 
 
 
 
1187
  [RE-863: Rust composed camera world selection and placement](RUST_CAMERA_WORLD.md).
1188
 
1189
  - [RE-854–863 entity search and composed world camera batch](QVM_CAMERA_WORLD_BATCH.md).
1190
+
1191
+
1192
+ [RE-864: Original fallback spawn distance ranking and selection](QVM_SPAWN_FALLBACK.md).
docs/research/qvm-spawn-fallback.json ADDED
The diff for this file is too large to render. See raw diff
 
scripts/analyze_qvm_spawn_fallback.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ import itertools
3
+ from pathlib import Path
4
+ from qvm_research_support import source
5
+ from qvm_spawn_support import select,seed,entities,AVOID,OUT,POOL
6
+ from qvm_transition_support import words
7
+ from analyze_qvm_acceleration import word
8
+ from analyze_qvm import write_json
9
+
10
+ def main():
11
+ q,raw,h,ins=source();rows=[]
12
+ for n,pattern,random,profile in itertools.product([0,1,7,8,9,64,65],range(4),[0,1],range(2)):
13
+ avoid=[word(v) for v in ([0,0,0] if profile==0 else [5,-7,3])];c=entities(n,pattern);m=seed(c,avoid,random);m,v,p,b=select(ins,m,{8:AVOID,12:OUT,16:OUT+12},blocked=[e['blocked'] for e in c]);p.update(input=dict(count=n,pattern=pattern,seed=random,avoid=avoid),result=-1 if not v else (v-POOL)//880,rng_state=m[21044]&0xffffffff,origin=words(m,OUT,3),angles=words(m,OUT+12,3));rows.append(p)
14
+ write_json(Path('docs/research/qvm-spawn-fallback.json'),{'source':q['source'],'sha256':q['sha256'],'probes':rows,'limits':'Actual168114 with actual276433 and36717 over112 cases. Telefrag167638 answers and finite sqrt supplied. Stable descending distance insertion,64 cap, far-half random choice at8+, all-blocked first-class fallback, +9 Z and no-spawn fatal boundary verified. Native collision/math and runtime integration remain open.'})
15
+ if __name__=='__main__':main()
scripts/qvm_spawn_support.py ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Actual168114 fallback selection; telefrag answers and native sqrt are supplied."""
2
+ from qvm_camera_world_support import B,S,POOL,run,find_class,random_word
3
+ from qvm_transition_support import vector,words
4
+ from analyze_qvm_acceleration import word,number
5
+ import math
6
+ BASE=B+0x10000
7
+ AVOID=S+0x70000
8
+ OUT=AVOID+32
9
+ SPAWN=(-103258081)&0xffffffff
10
+ class NoSpawn(Exception):pass
11
+
12
+ def select(ins,m,args,b=None,blocked=()):
13
+ searches=[];checks=[];math_calls=[];rng=[];fatal=[];saved={}
14
+ def search(i,m,a,bs):
15
+ m,v,p,b=find_class(i,m,a,bs);searches.append(-1 if not v else (v-POOL)//880);return m,v,{'actual_source_child':276433}
16
+ def telefrag(i,m,a,bs):
17
+ j=(a[8]-POOL)//880;checks.append(j);return m,int(bool(blocked[j])),{'telefrag_supplied':True}
18
+ def root(i,m,a,bs):
19
+ x=number(a[8]);v=word(math.sqrt(x));math_calls.append({'target':-107,'arguments':{'8':a[8]&0xffffffff},'result':v});return m,v,{'finite_sqrt_model':True}
20
+ def random(i,m,a,bs):
21
+ m,v,p,b=random_word(i,m,a,bs);rng.append(v);return m,v,{'actual_source_child':36717}
22
+ def error(i,m,a,bs):saved.update(memory=m,bytes=dict(bs));fatal.append(a);raise NoSpawn()
23
+ try:m,v,p,b=run(ins,m,168114,168502,592,args,b,{276433:search,167638:telefrag,-107:root,36717:random,2319:error},base=BASE)
24
+ except NoSpawn:m=saved['memory'];b=saved['bytes'];v=0;p={'execution':None,'changes':[]}
25
+ n=m[BASE+536];p.update(searches=searches,checks=checks,math=math_calls,random_calls=rng,fatal=bool(fatal),candidates=[(m[BASE+276+4*j]-POOL)//880 for j in range(n)],distances=[m[BASE+20+4*j]&0xffffffff for j in range(n)]);return m,v,p,b
26
+
27
+ def entities(n,pattern):
28
+ out=[]
29
+ for j in range(n):
30
+ origin=[0,0,4] if pattern==3 else [j%7-3,j*2-11,j%5]
31
+ out.append(dict(active=0 if pattern==1 and j%3==1 else 1,name=1,hash=SPAWN if j%11!=10 else 7,blocked=pattern==2 or pattern==1 and j%2==1,origin=[word(v) for v in origin],angles=[word(j),word(-j),0]))
32
+ return out
33
+
34
+ def seed(c,avoid,random):
35
+ m={34992508:len(c),21044:random};vector(m,AVOID,avoid);vector(m,OUT,[0x12345678]*6)
36
+ for j,e in enumerate(c):m.update({POOL+880*j+532:e['active'],POOL+880*j+536:e['name'],POOL+880*j+540:e['hash']});vector(m,POOL+880*j+92,e['origin']);vector(m,POOL+880*j+116,e['angles'])
37
+ return m
scripts/test_qvm_spawn_fallback.py ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json,math,unittest
2
+ from pathlib import Path
3
+ from qvm_spawn_support import entities,SPAWN
4
+ from analyze_qvm_acceleration import word,number
5
+ from test_qvm_target_pick import draw
6
+
7
+ def policy(c,avoid,state):
8
+ f=lambda v:number(word(v));eligible=[];allclass=[j for j,e in enumerate(c) if e['active'] and e['name'] and e['hash']==SPAWN]
9
+ for j in allclass:
10
+ e=c[j]
11
+ if e['blocked']:continue
12
+ d=[f(number(x)-number(y)) for x,y in zip(e['origin'],avoid)];s=f(f(f(d[0]*d[0])+f(d[1]*d[1]))+f(d[2]*d[2]));eligible.append((j,word(math.sqrt(s))))
13
+ eligible.sort(key=lambda v:-number(v[1]));eligible=eligible[:64];ids=[j for j,d in eligible]
14
+ if ids:state,r=draw(state);selected=ids[r%(len(ids)//2 if len(ids)>=8 else len(ids))]
15
+ else:selected=allclass[0] if allclass else -1
16
+ origin=[0x12345678]*3;angles=origin.copy()
17
+ if selected>=0:origin=list(c[selected]['origin']);origin[2]=word(number(origin[2])+9);angles=c[selected]['angles']
18
+ return dict(result=selected,rng_state=state,candidates=ids,distances=[d for j,d in eligible],fatal=selected<0,origin=origin,angles=angles)
19
+ class SpawnTests(unittest.TestCase):
20
+ def test_independent_sort_cap_draw_and_view(self):
21
+ rows=json.loads(Path('docs/research/qvm-spawn-fallback.json').read_text())['probes'];self.assertEqual(len(rows),112)
22
+ for p in rows:
23
+ a=p['input'];expected=policy(entities(a['count'],a['pattern']),a['avoid'],a['seed'])
24
+ for k,v in expected.items():self.assertEqual(p[k],v)
25
+ def test_rng_consumption_and_telefrag_candidate_filter(self):
26
+ for p in json.loads(Path('docs/research/qvm-spawn-fallback.json').read_text())['probes']:
27
+ c=entities(p['input']['count'],p['input']['pattern']);ids=[j for j,e in enumerate(c) if e['active'] and e['name'] and e['hash']==SPAWN];self.assertEqual(p['checks'],ids);self.assertEqual(len(p['random_calls']),int(bool(p['candidates'])));self.assertEqual(len(p['math']),sum(not c[j]['blocked'] for j in ids))
28
+ if __name__=='__main__':unittest.main()
xtask/checks.tsv CHANGED
@@ -2424,3 +2424,8 @@ group rust-camera-world scripts/analyze_rust_camera_world.py
2424
  edge scripts/analyze_rust_camera_world.py scripts/analyze_qvm_resumer_audit.py
2425
  edge .githooks/pre-commit scripts/test_storage_policy.py
2426
  edge .githooks/pre-push scripts/test_storage_policy.py
 
 
 
 
 
 
2424
  edge scripts/analyze_rust_camera_world.py scripts/analyze_qvm_resumer_audit.py
2425
  edge .githooks/pre-commit scripts/test_storage_policy.py
2426
  edge .githooks/pre-push scripts/test_storage_policy.py
2427
+ report scripts/analyze_qvm_spawn_fallback.py docs/research/qvm-spawn-fallback.json
2428
+ edge docs/research/qvm-spawn-fallback.json scripts/test_qvm_spawn_fallback.py
2429
+ group spawn-fallback scripts/analyze_qvm_spawn_fallback.py
2430
+ edge scripts/analyze_qvm_spawn_fallback.py scripts/analyze_qvm_resumer_audit.py
2431
+ edge scripts/qvm_spawn_support.py scripts/analyze_qvm_resumer_audit.py