nmarshall commited on
Commit
586efda
·
1 Parent(s): 0448bfa

qvm: verify scoreboard with original formatter

Browse files
docs/FINDINGS.md CHANGED
@@ -1445,3 +1445,6 @@ RE-802–811 adds opt-in coherent memory, original string/scoreboard control flo
1445
 
1446
 
1447
  **RE-815:** 37914 now executes original dispatch tables and integer/string children; pointer conversion is decimal, unknown conversions consume one low-byte word, and source padding/minimum quirks propagate. [Evidence](research/QVM_FORMATTER.md).
 
 
 
 
1445
 
1446
 
1447
  **RE-815:** 37914 now executes original dispatch tables and integer/string children; pointer conversion is decimal, unknown conversions consume one low-byte word, and source padding/minimum quirks propagate. [Evidence](research/QVM_FORMATTER.md).
1448
+
1449
+
1450
+ **RE-816:** Replacing the standard-decimal boundary with actual37914 exposes signed-minimum byte differences; prior modeled results remain explicitly separate. [Evidence](research/QVM_SCOREBOARD_FORMATTER.md).
docs/PROVISIONAL_TODO.md CHANGED
@@ -1455,3 +1455,6 @@ RE-814: 37279 pads zeroes before a negative sign and renders wrapping INT_MIN re
1455
 
1456
 
1457
  RE-815: 37914 now executes original dispatch tables and integer/string children; pointer conversion is decimal, unknown conversions consume one low-byte word, and source padding/minimum quirks propagate. Full runtime completion remains open. [Evidence](research/QVM_FORMATTER.md).
 
 
 
 
1455
 
1456
 
1457
  RE-815: 37914 now executes original dispatch tables and integer/string children; pointer conversion is decimal, unknown conversions consume one low-byte word, and source padding/minimum quirks propagate. Full runtime completion remains open. [Evidence](research/QVM_FORMATTER.md).
1458
+
1459
+
1460
+ RE-816: Replacing the standard-decimal boundary with actual37914 exposes signed-minimum byte differences; prior modeled results remain explicitly separate. Full runtime completion remains open. [Evidence](research/QVM_SCOREBOARD_FORMATTER.md).
docs/RESEARCH_LEDGER.md CHANGED
@@ -1743,3 +1743,8 @@ After exactly ten task commits from `744c236f`, the single `cargo xtask test-ful
1743
  ## 2026-10-27 — RE-815 Original formatter dispatch integer string character and literal composition
1744
 
1745
  37914 now executes original dispatch tables and integer/string children; pointer conversion is decimal, unknown conversions consume one low-byte word, and source padding/minimum quirks propagate. Focused `cargo xtask test-group formatter` 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.
 
 
 
 
 
 
1743
  ## 2026-10-27 — RE-815 Original formatter dispatch integer string character and literal composition
1744
 
1745
  37914 now executes original dispatch tables and integer/string children; pointer conversion is decimal, unknown conversions consume one low-byte word, and source padding/minimum quirks propagate. Focused `cargo xtask test-group formatter` 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.
1746
+
1747
+
1748
+ ## 2026-10-27 — RE-816 Scoreboard packets with actual original formatter execution
1749
+
1750
+ Replacing the standard-decimal boundary with actual37914 exposes signed-minimum byte differences; prior modeled results remain explicitly separate. Focused `cargo xtask test-group scoreboard-formatter` 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
@@ -1495,3 +1495,6 @@ Purpose: turn the supplied installation into an evidence-backed specification of
1495
 
1496
 
1497
  - [x] RE-815 Original formatter dispatch integer string character and literal composition ([evidence](research/QVM_FORMATTER.md)).
 
 
 
 
1495
 
1496
 
1497
  - [x] RE-815 Original formatter dispatch integer string character and literal composition ([evidence](research/QVM_FORMATTER.md)).
1498
+
1499
+
1500
+ - [x] RE-816 Scoreboard packets with actual original formatter execution ([evidence](research/QVM_SCOREBOARD_FORMATTER.md)).
docs/research/QVM_SCOREBOARD_FORMATTER.md ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ # Scoreboard packets with actual original formatter execution
2
+
3
+ RE-816. Reproduce with `python3 scripts/analyze_qvm_scoreboard_formatter.py`; focused validation: `cargo xtask test-group scoreboard-formatter`. [Machine report](qvm-scoreboard-formatter.json).
4
+
5
+ Eighteen original scoreboard compositions now execute37914 and its actual decimal/string children. Independent source-decimal oracles check attempted rows, admission, rejected-candidate caches and packet bytes. The earlier model remains labeled and hashed for differential review, so this stage does not silently rewrite its claims. Native strncpy is still modeled and server sends captured.
6
+
7
+ Original executable/native runtime and complete Linux/macOS Rust/Bevy/Solari acceptance remain unverified.
8
+
9
+ Final packet string emission uses a131072-instruction bounded segment allowance because an admitted1024-byte payload exceeds the smaller helper fixture budget. This is a finite fixture bound, not unrestricted formatter execution.
docs/research/README.md CHANGED
@@ -1035,3 +1035,6 @@ The extension collector adds five focused tests for native tail calls, command-r
1035
 
1036
 
1037
  [RE-815: Original formatter dispatch integer string character and literal composition](QVM_FORMATTER.md).
 
 
 
 
1035
 
1036
 
1037
  [RE-815: Original formatter dispatch integer string character and literal composition](QVM_FORMATTER.md).
1038
+
1039
+
1040
+ [RE-816: Scoreboard packets with actual original formatter execution](QVM_SCOREBOARD_FORMATTER.md).
docs/research/qvm-resumer-audit.json CHANGED
@@ -9352,7 +9352,7 @@
9352
  ],
9353
  "explicit_result_offsets": null,
9354
  "helper": "qvm_trace_support.resume",
9355
- "line": 23,
9356
  "literal_range": [
9357
  70387,
9358
  70456
@@ -9374,7 +9374,7 @@
9374
  ],
9375
  "explicit_result_offsets": null,
9376
  "helper": "qvm_trace_support.resume",
9377
- "line": 29,
9378
  "literal_range": [
9379
  70459,
9380
  70501
@@ -9447,7 +9447,7 @@
9447
  ],
9448
  "explicit_result_offsets": null,
9449
  "helper": "qvm_trace_support.resume",
9450
- "line": 44,
9451
  "literal_range": [
9452
  179364,
9453
  179734
 
9352
  ],
9353
  "explicit_result_offsets": null,
9354
  "helper": "qvm_trace_support.resume",
9355
+ "line": 24,
9356
  "literal_range": [
9357
  70387,
9358
  70456
 
9374
  ],
9375
  "explicit_result_offsets": null,
9376
  "helper": "qvm_trace_support.resume",
9377
+ "line": 30,
9378
  "literal_range": [
9379
  70459,
9380
  70501
 
9447
  ],
9448
  "explicit_result_offsets": null,
9449
  "helper": "qvm_trace_support.resume",
9450
+ "line": 48,
9451
  "literal_range": [
9452
  179364,
9453
  179734
docs/research/qvm-scoreboard-formatter.json ADDED
The diff for this file is too large to render. See raw diff
 
scripts/analyze_qvm_scoreboard_formatter.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ import hashlib,json
3
+ from pathlib import Path
4
+ from qvm_research_support import source
5
+ from qvm_scoreboard_body_support import seed,CPOOL
6
+ from qvm_scoreboard_wire_support import wire
7
+ from analyze_qvm import write_json
8
+
9
+ def main():
10
+ q,raw,h,ins=source();p=Path('docs/research/qvm-scoreboard-wire.json');data=p.read_bytes();rows=[]
11
+ for old in json.loads(data)['probes']:
12
+ m,b=seed(old['clients'],old['order'],old['now'],old['scores']);m[23708]=old['ring_before'];m,new=wire(ins,m,b,raw,h,source_formatter=True);new.update(clients=old['clients'],order=old['order'],now=old['now'],scores=old['scores'],ring_before=old['ring_before'],final_cache=[m[CPOOL+6336*j+6160]&0xffffffff for j in range(len(old['clients']))],modeled_packet_hex=old['sends'][0]['cstring_hex']);rows.append(new)
13
+ write_json(Path('docs/research/qvm-scoreboard-formatter.json'),{'source':q['source'],'sha256':q['sha256'],'modeled_report':str(p),'modeled_report_sha256':hashlib.sha256(data).hexdigest(),'probes':rows,'limits':'Actual37914 plus actual37279/37768/36038 now compose179363 and its actual format/string wrappers. Only native-103 strncpy remains modeled; native-18 sends captured. Earlier standard-decimal model remains separately labeled for differential review. Source INT_MIN formatting changes exact row bytes; admission is rechecked; no native ABI/wire acceptance claim.'})
14
+ if __name__=='__main__':main()
scripts/qvm_formatter_support.py CHANGED
@@ -10,7 +10,7 @@ def image_bytes(raw,h,address):
10
 
11
  def string_field(ins,m,args,b):
12
  before=int.from_bytes(read_bytes(m,b,args[8],4),'little');m,b=frame_args(m,b,{T+28+o:v for o,v in args.items()})
13
- m,e=resume(ins,37769,37912,m,T,handlers={36038:strlen},byte_inputs=b,repeated_calls=True,sync_child_words=True,coherent_memory=True,byte_handlers=True,capture_byte_memory=True,limit=32768)
14
  after=int.from_bytes(read_bytes(m,e['byte_memory'],args[8],4),'little');data=read_bytes(m,e['byte_memory'],before,after-before)
15
  return m,0,{'child_memory_bytes':{before+j:v for j,v in enumerate(data)},'output_hex':data.hex(),'cursor':after,'trace_sha256':e['trace_sha256']}
16
 
 
10
 
11
  def string_field(ins,m,args,b):
12
  before=int.from_bytes(read_bytes(m,b,args[8],4),'little');m,b=frame_args(m,b,{T+28+o:v for o,v in args.items()})
13
+ m,e=resume(ins,37769,37912,m,T,handlers={36038:strlen},byte_inputs=b,repeated_calls=True,sync_child_words=True,coherent_memory=True,byte_handlers=True,capture_byte_memory=True,limit=131072)
14
  after=int.from_bytes(read_bytes(m,e['byte_memory'],args[8],4),'little');data=read_bytes(m,e['byte_memory'],before,after-before)
15
  return m,0,{'child_memory_bytes':{before+j:v for j,v in enumerate(data)},'output_hex':data.hex(),'cursor':after,'trace_sha256':e['trace_sha256']}
16
 
scripts/qvm_scoreboard_wire_support.py CHANGED
@@ -5,6 +5,7 @@ from qvm_string_memory_support import cstring,strlen,strcpy,copy_bounded,frame_a
5
  from qvm_byte_memory_support import read_bytes
6
  from qvm_scoreboard_body_support import S,BODY
7
  from qvm_trace_support import resume
 
8
  F=H+0x690000
9
  A=H+0x6a0000
10
 
@@ -18,28 +19,31 @@ def format_model(ins,m,args,b):
18
  if b'%' in re.sub(rb'%[is]',b'',template) or len(data)>=32000:raise ValueError('unsupported bounded formatter')
19
  return m,len(data),{'formatter37914_modeled':True,'child_memory_bytes':{args[8]+j:v for j,v in enumerate(data+b'\0')}}
20
 
21
- def row_format(ins,m,args,b):
22
  m,b=frame_args(m,b,{F+32032+o:v for o,v in args.items()})
23
- m,e=resume(ins,70387,70456,m,F,handlers={37914:format_model,69338:copy_bounded},byte_inputs=b,repeated_calls=True,sync_child_words=True,coherent_memory=True,byte_handlers=True,capture_byte_memory=True,limit=32768)
24
  cells={args[8]+j:v for j,v in enumerate(read_bytes(m,e['byte_memory'],args[8],args[12]))}
25
- return m,e['return'],{'child_memory_bytes':cells,'wrapper_trace_sha256':e['trace_sha256'],'formatter37914_modeled':True}
26
 
27
- def final_format(ins,m,args,b):
28
  m,b=frame_args(m,b,{A+32+o:v for o,v in args.items()})
29
- m,e=resume(ins,70459,70501,m,A,handlers={37914:format_model},byte_inputs=b,repeated_calls=True,sync_child_words=True,coherent_memory=True,byte_handlers=True,capture_byte_memory=True)
30
  pointer=e['return'];data=cstring(m,e['byte_memory'],pointer)+b'\0'
31
- return m,pointer,{'child_memory_bytes':{pointer+j:v for j,v in enumerate(data)},'wrapper_trace_sha256':e['trace_sha256'],'formatter37914_modeled':True}
32
 
33
- def wire(ins,m,b,raw,h):
34
  b=dict(b);m=dict(m);m.setdefault(23708,0)
35
  for address in [79310,79328]:
36
  text=raw[h['data_offset']+address:];text=text[:text.index(0)+1]
37
  b.update({address+j:v for j,v in enumerate(text)})
38
  # Explicit initialized scratch domains for source word lookahead/RMW.
39
  for start,stop in [(80,1104),(1112,1144),(1144,2544)]:b.update({S+j:0 for j in range(start,stop)})
 
 
40
  rows=[];sends=[]
41
  def row(i,m,a,bs):
42
- m,v,e=row_format(i,m,a,bs);text=bytes(e['child_memory_bytes'].values()).split(b'\0')[0];rows.append({'numbers':[a[o] for o in range(20,68,4)],'name_hex':cstring(m,bs,a[68]).hex(),'row_hex':text.hex()});return m,v,e
 
43
  def send(i,m,a,bs):sends.append({'recipient':a[8],'cstring_hex':(cstring(m,bs,a[12])+b'\0').hex(),'pointer':a[12]});return m,0,{'native_send_captured':True}
44
- m,e=resume(ins,179364,179734,m,S,handlers={36038:strlen,69338:copy_bounded,70386:row,36185:strcpy,70458:final_format,-18:send},byte_inputs=b,repeated_calls=True,sync_child_words=True,coherent_memory=True,byte_handlers=True,limit=32768)
45
  return m,{'rows':rows,'accepted':m[S+76],'payload_length':m[S+1104],'sends':sends,'ring_counter':m[23708]&0xffffffff,'execution':{k:e[k] for k in ['stop','trace_length','trace_sha256']}}
 
5
  from qvm_byte_memory_support import read_bytes
6
  from qvm_scoreboard_body_support import S,BODY
7
  from qvm_trace_support import resume
8
+ from qvm_formatter_support import formatter,formatter_env
9
  F=H+0x690000
10
  A=H+0x6a0000
11
 
 
19
  if b'%' in re.sub(rb'%[is]',b'',template) or len(data)>=32000:raise ValueError('unsupported bounded formatter')
20
  return m,len(data),{'formatter37914_modeled':True,'child_memory_bytes':{args[8]+j:v for j,v in enumerate(data+b'\0')}}
21
 
22
+ def row_format(ins,m,args,b,format_handler=format_model):
23
  m,b=frame_args(m,b,{F+32032+o:v for o,v in args.items()})
24
+ m,e=resume(ins,70387,70456,m,F,handlers={37914:format_handler,69338:copy_bounded},byte_inputs=b,repeated_calls=True,sync_child_words=True,coherent_memory=True,byte_handlers=True,capture_byte_memory=True,limit=32768)
25
  cells={args[8]+j:v for j,v in enumerate(read_bytes(m,e['byte_memory'],args[8],args[12]))}
26
+ return m,e['return'],{'child_memory_bytes':cells,'wrapper_trace_sha256':e['trace_sha256'],'formatter37914_modeled':format_handler is format_model,'formatter37914_executed':format_handler is formatter}
27
 
28
+ def final_format(ins,m,args,b,format_handler=format_model):
29
  m,b=frame_args(m,b,{A+32+o:v for o,v in args.items()})
30
+ m,e=resume(ins,70459,70501,m,A,handlers={37914:format_handler},byte_inputs=b,repeated_calls=True,sync_child_words=True,coherent_memory=True,byte_handlers=True,capture_byte_memory=True)
31
  pointer=e['return'];data=cstring(m,e['byte_memory'],pointer)+b'\0'
32
+ return m,pointer,{'child_memory_bytes':{pointer+j:v for j,v in enumerate(data)},'wrapper_trace_sha256':e['trace_sha256'],'formatter37914_modeled':format_handler is format_model,'formatter37914_executed':format_handler is formatter}
33
 
34
+ def wire(ins,m,b,raw,h,source_formatter=False):
35
  b=dict(b);m=dict(m);m.setdefault(23708,0)
36
  for address in [79310,79328]:
37
  text=raw[h['data_offset']+address:];text=text[:text.index(0)+1]
38
  b.update({address+j:v for j,v in enumerate(text)})
39
  # Explicit initialized scratch domains for source word lookahead/RMW.
40
  for start,stop in [(80,1104),(1112,1144),(1144,2544)]:b.update({S+j:0 for j in range(start,stop)})
41
+ tables,fallback=formatter_env(raw,h);m.update(tables);b.update(fallback)
42
+ format_handler=formatter if source_formatter else format_model
43
  rows=[];sends=[]
44
  def row(i,m,a,bs):
45
+ m,v,e=row_format(i,m,a,bs,format_handler);text=bytes(e['child_memory_bytes'].values()).split(b'\0')[0];rows.append({'numbers':[a[o] for o in range(20,68,4)],'name_hex':cstring(m,bs,a[68]).hex(),'row_hex':text.hex()});return m,v,e
46
+ def final(i,m,a,bs):return final_format(i,m,a,bs,format_handler)
47
  def send(i,m,a,bs):sends.append({'recipient':a[8],'cstring_hex':(cstring(m,bs,a[12])+b'\0').hex(),'pointer':a[12]});return m,0,{'native_send_captured':True}
48
+ m,e=resume(ins,179364,179734,m,S,handlers={36038:strlen,69338:copy_bounded,70386:row,36185:strcpy,70458:final,-18:send},byte_inputs=b,repeated_calls=True,sync_child_words=True,coherent_memory=True,byte_handlers=True,limit=32768)
49
  return m,{'rows':rows,'accepted':m[S+76],'payload_length':m[S+1104],'sends':sends,'ring_counter':m[23708]&0xffffffff,'execution':{k:e[k] for k in ['stop','trace_length','trace_sha256']}}
scripts/test_qvm_scoreboard_formatter.py ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import hashlib,json,unittest
2
+ from pathlib import Path
3
+ from test_qvm_scoreboard_rows import project
4
+ from test_qvm_format_integer import decimal
5
+ from analyze_qvm_recipient_wire import copy_model
6
+ class ScoreboardFormatterTests(unittest.TestCase):
7
+ @classmethod
8
+ def setUpClass(cls):cls.r=json.loads(Path('docs/research/qvm-scoreboard-formatter.json').read_text())
9
+ def test_original_formatter_bytes_capacity_and_cache(self):
10
+ self.assertEqual(len(self.r['probes']),18)
11
+ for p in self.r['probes']:
12
+ payload=b'';accepted=0;attempts=[];cache=[c.get('6160',77)&0xffffffff for c in p['clients']]
13
+ for id in p['order']:
14
+ c=p['clients'][id];cache[id],nums=project(c,id,p['now']);name=copy_model(bytes.fromhex(c['name_hex'])).split(b'\0')[0];row=b''.join(b' '+decimal(v) for v in nums)+b' '+name;attempts.append({'numbers':nums,'name_hex':name.hex(),'row_hex':row.hex()})
15
+ if len(payload)+len(row)>1024:break
16
+ payload+=row;accepted+=1
17
+ expected=b'scores '+decimal(accepted)+b' 2 1'+payload+b'\0';self.assertEqual(p['rows'],attempts);self.assertEqual(p['sends'][0]['cstring_hex'],expected.hex());self.assertEqual((p['accepted'],p['payload_length']),(accepted,len(payload)));self.assertEqual(p['final_cache'],cache)
18
+ def test_prior_model_difference_is_visible_and_provenance_checked(self):
19
+ self.assertEqual(hashlib.sha256(Path(self.r['modeled_report']).read_bytes()).hexdigest(),self.r['modeled_report_sha256']);self.assertTrue(any(p['sends'][0]['cstring_hex']!=p['modeled_packet_hex'] for p in self.r['probes'] if p['clients']))
20
+ if __name__=='__main__':unittest.main()
xtask/checks.tsv CHANGED
@@ -1983,3 +1983,7 @@ report scripts/analyze_qvm_formatter.py docs/research/qvm-formatter.json
1983
  edge docs/research/qvm-formatter.json scripts/test_qvm_formatter.py
1984
  group formatter scripts/analyze_qvm_formatter.py
1985
  edge scripts/analyze_qvm_formatter.py scripts/analyze_qvm_resumer_audit.py
 
 
 
 
 
1983
  edge docs/research/qvm-formatter.json scripts/test_qvm_formatter.py
1984
  group formatter scripts/analyze_qvm_formatter.py
1985
  edge scripts/analyze_qvm_formatter.py scripts/analyze_qvm_resumer_audit.py
1986
+ report scripts/analyze_qvm_scoreboard_formatter.py docs/research/qvm-scoreboard-formatter.json
1987
+ edge docs/research/qvm-scoreboard-formatter.json scripts/test_qvm_scoreboard_formatter.py
1988
+ group scoreboard-formatter scripts/analyze_qvm_scoreboard_formatter.py
1989
+ edge scripts/analyze_qvm_scoreboard_formatter.py scripts/analyze_qvm_resumer_audit.py