nmarshall commited on
Commit
d3ab5c7
·
1 Parent(s): 40de183

qvm: recover connect session lifecycle branch

Browse files
docs/FINDINGS.md CHANGED
@@ -1733,3 +1733,6 @@ RE-813–822 replaces the scoreboard decimal assumption with actual37914 executi
1733
 
1734
 
1735
  **RE-911:** Rust matches144 original save/session-write/restore/read compositions using owned in-memory cvar/file bytes. Partial integer parsing and caller scratch preserve the observed non-invertibility of negative/INT_MIN session text; file prefixes and ignore accumulation remain exact. Engine/destination/selector changes stage atomically on errors. This adapter does not own native handles or perform OS file IO. [Evidence](research/RUST_PERSISTENCE_ROUNDTRIP.md).
 
 
 
 
1733
 
1734
 
1735
  **RE-911:** Rust matches144 original save/session-write/restore/read compositions using owned in-memory cvar/file bytes. Partial integer parsing and caller scratch preserve the observed non-invertibility of negative/INT_MIN session text; file prefixes and ignore accumulation remain exact. Engine/destination/selector changes stage atomically on errors. This adapter does not own native handles or perform OS file IO. [Evidence](research/RUST_PERSISTENCE_ROUNDTRIP.md).
1736
+
1737
+
1738
+ **RE-912:** 96 bounded173979 caller-path executions cover174081..174173 after userinfo/authentication: entity-client linking, actual6336-byte clear via modeled native memset, connecting-state/client-slot writes and the first-time OR new-session choice between actual247520 initialization and247219 restore. Both children execute recovered load/format/scanner policies. Uppercase team S below capacity is not the lowercase s shortcut. Authentication before the slice, post-branch normalization and native engine integration remain open. [Evidence](research/QVM_CONNECT_SESSION.md).
docs/PROVISIONAL_TODO.md CHANGED
@@ -1770,3 +1770,6 @@ RE-910: 144 finite original246746/246963/247219/246554 compositions feed actual
1770
 
1771
 
1772
  RE-911: Rust matches144 original save/session-write/restore/read compositions using owned in-memory cvar/file bytes. Partial integer parsing and caller scratch preserve the observed non-invertibility of negative/INT_MIN session text; file prefixes and ignore accumulation remain exact. Engine/destination/selector changes stage atomically on errors. This adapter does not own native handles or perform OS file IO. Full runtime completion remains open. [Evidence](research/RUST_PERSISTENCE_ROUNDTRIP.md).
 
 
 
 
1770
 
1771
 
1772
  RE-911: Rust matches144 original save/session-write/restore/read compositions using owned in-memory cvar/file bytes. Partial integer parsing and caller scratch preserve the observed non-invertibility of negative/INT_MIN session text; file prefixes and ignore accumulation remain exact. Engine/destination/selector changes stage atomically on errors. This adapter does not own native handles or perform OS file IO. Full runtime completion remains open. [Evidence](research/RUST_PERSISTENCE_ROUNDTRIP.md).
1773
+
1774
+
1775
+ RE-912: 96 bounded173979 caller-path executions cover174081..174173 after userinfo/authentication: entity-client linking, actual6336-byte clear via modeled native memset, connecting-state/client-slot writes and the first-time OR new-session choice between actual247520 initialization and247219 restore. Both children execute recovered load/format/scanner policies. Uppercase team S below capacity is not the lowercase s shortcut. Authentication before the slice, post-branch normalization and native engine integration remain open. Full runtime completion remains open. [Evidence](research/QVM_CONNECT_SESSION.md).
docs/RESEARCH_LEDGER.md CHANGED
@@ -2275,3 +2275,8 @@ Rust matches64 original normal transitions with actual saved-file and cvar child
2275
  ## 2026-10-28 — RE-911 Rust in-memory persistence round trip
2276
 
2277
  Rust matches144 original save/session-write/restore/read compositions using owned in-memory cvar/file bytes. Partial integer parsing and caller scratch preserve the observed non-invertibility of negative/INT_MIN session text; file prefixes and ignore accumulation remain exact. Engine/destination/selector changes stage atomically on errors. This adapter does not own native handles or perform OS file IO. Focused `cargo xtask test-group rust-persistence-roundtrip` passes (9 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.
 
 
 
 
 
 
2275
  ## 2026-10-28 — RE-911 Rust in-memory persistence round trip
2276
 
2277
  Rust matches144 original save/session-write/restore/read compositions using owned in-memory cvar/file bytes. Partial integer parsing and caller scratch preserve the observed non-invertibility of negative/INT_MIN session text; file prefixes and ignore accumulation remain exact. Engine/destination/selector changes stage atomically on errors. This adapter does not own native handles or perform OS file IO. Focused `cargo xtask test-group rust-persistence-roundtrip` passes (9 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.
2278
+
2279
+
2280
+ ## 2026-10-28 — RE-912 Original connect clear and session-branch caller
2281
+
2282
+ 96 bounded173979 caller-path executions cover174081..174173 after userinfo/authentication: entity-client linking, actual6336-byte clear via modeled native memset, connecting-state/client-slot writes and the first-time OR new-session choice between actual247520 initialization and247219 restore. Both children execute recovered load/format/scanner policies. Uppercase team S below capacity is not the lowercase s shortcut. Authentication before the slice, post-branch normalization and native engine integration remain open. Focused `cargo xtask test-group qvm-connect-session` passes (4 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
@@ -1807,3 +1807,6 @@ Purpose: turn the supplied installation into an evidence-backed specification of
1807
 
1808
 
1809
  - [x] RE-911 Rust in-memory persistence round trip ([evidence](research/RUST_PERSISTENCE_ROUNDTRIP.md)).
 
 
 
 
1807
 
1808
 
1809
  - [x] RE-911 Rust in-memory persistence round trip ([evidence](research/RUST_PERSISTENCE_ROUNDTRIP.md)).
1810
+
1811
+
1812
+ - [x] RE-912 Original connect clear and session-branch caller ([evidence](research/QVM_CONNECT_SESSION.md)).
docs/research/QVM_CONNECT_SESSION.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Original connect clear and session-branch caller
2
+
3
+ RE-912. Reproduce with `python3 scripts/analyze_qvm_connect_session.py`; focused validation: `cargo xtask test-group qvm-connect-session`. [Machine report](qvm-connect-session.json).
4
+
5
+ 96 bounded173979 caller-path executions cover174081..174173 after userinfo/authentication: entity-client linking, actual6336-byte clear via modeled native memset, connecting-state/client-slot writes and the first-time OR new-session choice between actual247520 initialization and247219 restore. Both children execute recovered load/format/scanner policies. Uppercase team S below capacity is not the lowercase s shortcut. Authentication before the slice, post-branch normalization and native engine integration remain open.
6
+
7
+ Original executable/native runtime and complete Linux/macOS Rust/Bevy/Solari acceptance remain unverified.
docs/research/README.md CHANGED
@@ -1342,3 +1342,6 @@ The extension collector adds five focused tests for native tail calls, command-r
1342
 
1343
 
1344
  [RE-911: Rust in-memory persistence round trip](RUST_PERSISTENCE_ROUNDTRIP.md).
 
 
 
 
1342
 
1343
 
1344
  [RE-911: Rust in-memory persistence round trip](RUST_PERSISTENCE_ROUNDTRIP.md).
1345
+
1346
+
1347
+ [RE-912: Original connect clear and session-branch caller](QVM_CONNECT_SESSION.md).
docs/research/qvm-connect-session.json ADDED
The diff for this file is too large to render. See raw diff
 
scripts/analyze_qvm_connect_session.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Execute the verified original QVM body; native effects are supplied or captured."""
3
+ import itertools
4
+ from pathlib import Path
5
+ from qvm_research_support import source,constants
6
+ from qvm_camera_world_support import B,run
7
+ from qvm_exit_rules_support import POOL,CPOOL
8
+ from analyze_qvm_acceleration import word,number
9
+ from analyze_qvm import write_json
10
+
11
+ def main():
12
+ q,raw,h,ins=source();rows=[]
13
+ from qvm_persistence_support import environment,RESTORE,SCRATCH
14
+ from qvm_lifecycle_support import connect_branch,raw_state,CLIENT_BYTES
15
+ from qvm_byte_memory_support import write_bytes
16
+ for mode,first,new,positive,slot,handle in itertools.product([0,3,9],[0,1],[0,-1],[False,True],[0,3],[0,7]):
17
+ m,b=environment(raw,h);write_bytes(m,b,{a:raw[h['data_offset']+a] for a in range(83568,83824)});pointer=CPOOL+6336*slot
18
+ for o in range(0,6336,4):m[pointer+o]=0xaabbccdd
19
+ m.update({34090788:mode,34089308:2,34992584:1,34085460:0,34992532:100,34992524:0,34064148:1,35000468:1,34992572:new,POOL+880*slot+764:0xaabbccdd,POOL+880*slot+768:0xaabbccdd});scratch=0x7fffffff if positive else 0
20
+ for o in SCRATCH:m[RESTORE+o]=scratch
21
+ info=b'\\team\\S\\cl_guid\\ID';m,p,b=connect_branch(ins,m,b,slot,first,info,handle);p.update(input=dict(mode=mode,first=first,new=new,scratch=scratch,slot=slot,handle=handle),raw=raw_state(m,b,pointer),nonzero=[[o,m[pointer+o]&0xffffffff] for o in range(0,6336,4) if m[pointer+o]&0xffffffff],ring=m[23708]&0xffffffff,info_ring=m[23712]&0xffffffff);rows.append(p)
22
+
23
+ write_json(Path('docs/research/qvm-connect-session.json'),{'source':q['source'],'sha256':q['sha256'],'root':173979,'probes':rows,'limits':'96 bounded173979 caller-path executions cover174081..174173 after userinfo/authentication: entity-client linking, actual6336-byte clear via modeled native memset, connecting-state/client-slot writes and the first-time OR new-session choice between actual247520 initialization and247219 restore. Both children execute recovered load/format/scanner policies. Uppercase team S below capacity is not the lowercase s shortcut. Authentication before the slice, post-branch normalization and native engine integration remain open.'})
24
+ if __name__=='__main__':main()
scripts/qvm_lifecycle_support.py CHANGED
@@ -34,3 +34,19 @@ def post_full(ins,m,b,userinfos,names,handles):
34
  def write(i,m,a,bs):
35
  j=(a[8]-CPOOL)//6336;calls.append([246963,j]);m,p,b=session(i,m,dict(bs),a[8]);sets.extend(p['sets']);actions.extend(dict(kind='cvar',slot=j,key=k,value=v) for k,v in p['sets']);return m,0,{'actual_source_child':246963}
36
  m,v,p,b=run(ins,m,249007,249058,16,b=b,handlers={246746:save,246963:write},base=B+0x54000);p.update(calls=calls,files=files,sets=sets,actions=actions);return m,p,b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  def write(i,m,a,bs):
35
  j=(a[8]-CPOOL)//6336;calls.append([246963,j]);m,p,b=session(i,m,dict(bs),a[8]);sets.extend(p['sets']);actions.extend(dict(kind='cvar',slot=j,key=k,value=v) for k,v in p['sets']);return m,0,{'actual_source_child':246963}
36
  m,v,p,b=run(ins,m,249007,249058,16,b=b,handlers={246746:save,246963:write},base=B+0x54000);p.update(calls=calls,files=files,sets=sets,actions=actions);return m,p,b
37
+
38
+ CONNECT=B+0x58000
39
+ CLIENT_BYTES=6336
40
+ def connect_branch(ins,m,b,slot,first,userinfo,handle):
41
+ import hashlib,json
42
+ from qvm_map_commands_support import put_string
43
+ from qvm_persistence_support import restore_session
44
+ entity=34091368+880*slot;pointer=CPOOL+6336*slot;m[CONNECT+24]=entity;put_string(m,b,CONNECT+28,userinfo,1024);parts={};choice=[]
45
+ def zero(i,m,a,bs):
46
+ if a[8]!=pointer or a[12]!=0 or a[16]!=6336:raise ValueError('unsupported connect memset')
47
+ return m,a[8],{'native_memset_modeled':True,'child_memory_bytes':{pointer+j:0 for j in range(6336)}}
48
+ def fresh(i,m,a,bs):
49
+ choice.append(247520);m,p,b=initialize(i,m,dict(bs),a[8],userinfo,handle,17);parts.update(p);return m,0,{'actual_source_child':247520}
50
+ def restored(i,m,a,bs):
51
+ choice.append(247219);data=b'9,8,7,6,5,4';m,p,b=restore_session(i,m,dict(bs),a[8],b'1,-2,3,4,5,1,1,1,1',b'1,3,',userinfo,b'ut4_test',handle,len(data),data);parts.update(p);return m,0,{'actual_source_child':247219}
52
+ m,v,p,b=run(ins,m,174080,174174,1080,{8:slot,12:first,16:0},b,{-101:zero,247520:fresh,247219:restored},base=CONNECT);changes=p.pop('changes');p.update(change_count=len(changes),changes_sha256=hashlib.sha256(json.dumps(changes,sort_keys=True).encode()).hexdigest(),choice=choice,parts=parts,entity_linked=m[entity+520]==pointer,entity_clear=[m[entity+764]&0xffffffff,m[entity+768]&0xffffffff]);return m,p,b
scripts/test_qvm_connect_session.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json,unittest
2
+ from pathlib import Path
3
+ class OriginalTests(unittest.TestCase):
4
+ def test_instruction_results(self):
5
+ rows=json.loads(Path('docs/research/qvm-connect-session.json').read_text())['probes']
6
+ self.assertEqual(len(rows),96)
7
+ from analyze_qvm_acceleration import word
8
+ for p in rows:
9
+ a=p['input'];fresh=bool(a['first'] or a['new']);raw=bytearray(944);store=lambda o,v:raw.__setitem__(slice(o,o+4),(v&0xffffffff).to_bytes(4,'little'))
10
+ if fresh:
11
+ for o,v in [(0,3 if a['mode']==3 else 0),(8,100),(12,1),(44,60100),(60,17)]:store(o,v)
12
+ raw[68]=32
13
+ else:
14
+ store(0,1);positive=bool(a['scratch'])
15
+ for o in [56,612,616]:store(o,int(positive))
16
+ store(644,int(positive and a['mode']==3));store(684+4,1);store(684+12,1)
17
+ if a['mode']==9 and a['handle']:
18
+ for j,v in enumerate([9,8,7,6,5,4]):store(620+4*j,word(v))
19
+ nonzero=[[468,1]]+[[3096+o,int.from_bytes(raw[o:o+4],'little')] for o in range(0,944,4) if int.from_bytes(raw[o:o+4],'little')]
20
+ if a['slot']:nonzero.append([6156,a['slot']])
21
+ self.assertEqual(p['raw'],raw.hex());self.assertEqual(p['nonzero'],nonzero);self.assertEqual(p['choice'],[247520 if fresh else 247219]);self.assertTrue(p['entity_linked']);self.assertEqual(p['entity_clear'],[0,0]);self.assertEqual(p['ring'],(3 if fresh else 2)+int(a['mode']==9));self.assertEqual(p['info_ring'],(1 if a['mode']==0 else 0) if fresh else int(a['mode']==9))
22
+
23
+ if __name__=='__main__':unittest.main()
xtask/checks.tsv CHANGED
@@ -2883,3 +2883,7 @@ report scripts/analyze_rust_persistence_roundtrip.py docs/research/rust-persiste
2883
  edge docs/research/rust-persistence-roundtrip.json scripts/test_rust_persistence_roundtrip.py
2884
  group rust-persistence-roundtrip scripts/analyze_rust_persistence_roundtrip.py
2885
  edge scripts/analyze_rust_persistence_roundtrip.py scripts/analyze_qvm_resumer_audit.py
 
 
 
 
 
2883
  edge docs/research/rust-persistence-roundtrip.json scripts/test_rust_persistence_roundtrip.py
2884
  group rust-persistence-roundtrip scripts/analyze_rust_persistence_roundtrip.py
2885
  edge scripts/analyze_rust_persistence_roundtrip.py scripts/analyze_qvm_resumer_audit.py
2886
+ report scripts/analyze_qvm_connect_session.py docs/research/qvm-connect-session.json
2887
+ edge docs/research/qvm-connect-session.json scripts/test_qvm_connect_session.py
2888
+ group qvm-connect-session scripts/analyze_qvm_connect_session.py
2889
+ edge scripts/analyze_qvm_connect_session.py scripts/analyze_qvm_resumer_audit.py