nmarshall commited on
Commit
78372ba
·
1 Parent(s): 71447b9

qvm: recover statistic ratios

Browse files
docs/ASSET_PIPELINE_TODO.md CHANGED
@@ -934,3 +934,6 @@ Research progress: RE-756 [report](research/RUST_CROSS_CLIENT_CLEAR.md); origina
934
 
935
 
936
  Research progress: RE-758 [report](research/QVM_STAT_TOTALS.md); original assets unchanged.
 
 
 
 
934
 
935
 
936
  Research progress: RE-758 [report](research/QVM_STAT_TOTALS.md); original assets unchanged.
937
+
938
+
939
+ Research progress: RE-759 [report](research/QVM_STAT_RATIOS.md); original assets unchanged.
docs/FINDINGS.md CHANGED
@@ -1280,3 +1280,6 @@ RE-725–734 batch: [health, contact and Rust impulse findings](research/QVM_HEA
1280
 
1281
 
1282
  **RE-758 — Complete statistic totals field inclusion and wrapping:** 283085/283166 sum20 per-slot counters plus selected legacy fields with signed wrapping and distinct exclusions. [Evidence](research/QVM_STAT_TOTALS.md).
 
 
 
 
1280
 
1281
 
1282
  **RE-758 — Complete statistic totals field inclusion and wrapping:** 283085/283166 sum20 per-slot counters plus selected legacy fields with signed wrapping and distinct exclusions. [Evidence](research/QVM_STAT_TOTALS.md).
1283
+
1284
+
1285
+ **RE-759 — Complete divisor normalized totals and ratio publication:** 279586 publishes reduced integer totals and a source-order float32 ratio using actual totals and283488 divisor behavior. [Evidence](research/QVM_STAT_RATIOS.md).
docs/PROVISIONAL_TODO.md CHANGED
@@ -1275,3 +1275,6 @@ RE-747–756 batch validation:1443 Python and68 Rust tests pass after ten separa
1275
 
1276
 
1277
  Research progress: RE-758 [report](research/QVM_STAT_TOTALS.md); full native/platform/game scope remains open.
 
 
 
 
1275
 
1276
 
1277
  Research progress: RE-758 [report](research/QVM_STAT_TOTALS.md); full native/platform/game scope remains open.
1278
+
1279
+
1280
+ Research progress: RE-759 [report](research/QVM_STAT_RATIOS.md); full native/platform/game scope remains open.
docs/RESEARCH_LEDGER.md CHANGED
@@ -1444,3 +1444,8 @@ Exactly ten task commits follow baseline `ae4d61e7`. Each task passed focused `c
1444
  ## 2026-10-21 — RE-758 Complete statistic totals field inclusion and wrapping
1445
 
1446
  283085/283166 sum20 per-slot counters plus selected legacy fields with signed wrapping and distinct exclusions. Focused `cargo xtask test-group stat-totals` passes (3 Python tests); selected reports regenerate twice byte-identically, with storage, links and whitespace guards. New report: 295255 bytes. Full-suite validation is deferred to the tenth batch commit. No original assets, Rust runtime or shared VM evaluator changed.
 
 
 
 
 
 
1444
  ## 2026-10-21 — RE-758 Complete statistic totals field inclusion and wrapping
1445
 
1446
  283085/283166 sum20 per-slot counters plus selected legacy fields with signed wrapping and distinct exclusions. Focused `cargo xtask test-group stat-totals` passes (3 Python tests); selected reports regenerate twice byte-identically, with storage, links and whitespace guards. New report: 295255 bytes. Full-suite validation is deferred to the tenth batch commit. No original assets, Rust runtime or shared VM evaluator changed.
1447
+
1448
+
1449
+ ## 2026-10-21 — RE-759 Complete divisor normalized totals and ratio publication
1450
+
1451
+ 279586 publishes reduced integer totals and a source-order float32 ratio using actual totals and283488 divisor behavior. Focused `cargo xtask test-group stat-ratios` passes (3 Python tests); selected reports regenerate twice byte-identically, with storage, links and whitespace guards. New report: 226409 bytes. Full-suite validation is deferred to the tenth batch commit. No original assets, Rust runtime or shared VM evaluator changed.
docs/REVERSE_ENGINEERING_TODO.md CHANGED
@@ -1318,3 +1318,6 @@ Purpose: turn the supplied installation into an evidence-backed specification of
1318
 
1319
 
1320
  - [x] RE-758 Complete statistic totals field inclusion and wrapping ([report](research/QVM_STAT_TOTALS.md)).
 
 
 
 
1318
 
1319
 
1320
  - [x] RE-758 Complete statistic totals field inclusion and wrapping ([report](research/QVM_STAT_TOTALS.md)).
1321
+
1322
+
1323
+ - [x] RE-759 Complete divisor normalized totals and ratio publication ([report](research/QVM_STAT_RATIOS.md)).
docs/research/QVM_STAT_RATIOS.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ # Complete divisor normalized totals and ratio publication
2
+
3
+ RE-759. Reproduce with `python3 scripts/analyze_qvm_stat_ratios.py`; validate with `cargo xtask test-group stat-ratios`. See the [machine report](qvm-stat-ratios.json).
4
+
5
+ Recovered complete283488 across38 signed/zero/positive fixtures and complete279586 across28 counter fixtures with actual total children. The divisor is gcd of absolute inputs when both are nonzero and their signed maximum is positive; zero input or nonpositive maximum returns1. Integer normalization truncates toward zero; denominator zero publishes float zero. Large positive downward scans and native/runtime parity remain open.
6
+
7
+ No original executable/full VM/native world collision or rendering runs. Supplied callback/native responses and fixture domains remain explicit; complete macOS/Linux Rust/Bevy/Solari gameplay remains open.
docs/research/README.md CHANGED
@@ -870,3 +870,6 @@ The extension collector adds five focused tests for native tail calls, command-r
870
 
871
 
872
  [RE-758: Complete statistic totals field inclusion and wrapping](QVM_STAT_TOTALS.md).
 
 
 
 
870
 
871
 
872
  [RE-758: Complete statistic totals field inclusion and wrapping](QVM_STAT_TOTALS.md).
873
+
874
+
875
+ [RE-759: Complete divisor normalized totals and ratio publication](QVM_STAT_RATIOS.md).
docs/research/qvm-stat-ratios.json ADDED
The diff for this file is too large to render. See raw diff
 
scripts/analyze_qvm_stat_ratios.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """Actual divisor and complete ratio refresh with actual counter totals."""
3
+ import itertools
4
+ from pathlib import Path
5
+ from qvm_research_support import source
6
+ from qvm_stat_totals_support import seed,OFFSETS,FIRST_SLOTS,SECOND_SLOTS,TARGET,CLIENT
7
+ from qvm_stat_ratio_support import divisor,refresh
8
+ from analyze_qvm import write_json
9
+
10
+ def main():
11
+ q,raw,h,ins=source();gs=[];rows=[]
12
+ for a,b in [*itertools.product([-2,0,1,2,12,30],[-3,0,1,2,18,40]),(-2147483648,1),(2147483647,0)]:
13
+ _,v,e=divisor(ins,{}, {8:a,12:b});gs.append({'first':a,'second':b,'divisor':v,'execution':e})
14
+ cases=[(a,b,False) for a,b in itertools.product([-1,0,1,2,7],[-1,0,1,3,6])]+[(1,1,True),(3,6,True),(-1,1,True)]
15
+ for a,b,bulk in cases:
16
+ values={str(o):0 for o in OFFSETS}
17
+ for o in FIRST_SLOTS if bulk else FIRST_SLOTS[:1]:values[str(o)]=a&0xffffffff
18
+ for o in SECOND_SLOTS if bulk else SECOND_SLOTS[:1]:values[str(o)]=b&0xffffffff
19
+ m=seed(raw,h,values);m.update({CLIENT+3080:99,CLIENT+3084:98,CLIENT+3088:97});_,_,p=refresh(ins,m,{8:TARGET});p.update(input={'first':a,'second':b,'bulk':bulk},counters=values);rows.append(p)
20
+ write_json(Path('docs/research/qvm-stat-ratios.json'),{'source':q['source'],'sha256':q['sha256'],'divisor_probes':gs,'probes':rows,'limits':'Complete283488 and279586 with actual283085/283166. Source divisor scans downward from signed maximum, returns1 on zero input or nonpositive maximum. Finite small-positive fixtures bound execution; very large positive scan cost/native parity remain open.'})
21
+ if __name__=='__main__':main()
scripts/qvm_stat_ratio_support.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Actual283488 divisor and279586 normalized totals/ratio publication."""
2
+ from qvm_health_effects_support import H
3
+ from qvm_stat_totals_support import handlers as total_handlers
4
+ from qvm_trace_support import resume
5
+ G=H+0x130000
6
+ W=H+0x140000
7
+
8
+ def divisor(ins,m,args):
9
+ m[G+28]=args[8];m[G+32]=args[12];m,e=resume(ins,283489,283554,m,G)
10
+ return m,e['return'],e
11
+
12
+ def refresh(ins,m,args):
13
+ m[W+72]=args[8];c=m[args[8]+520];before={str(o):m[c+o]&0xffffffff for o in [3080,3084,3088]};hs=total_handlers();hs[283488]=divisor
14
+ m,e=resume(ins,279587,279718,m,W,handlers=hs)
15
+ return m,0,{'arguments':args,'initial':before,'final':{str(o):m[c+o]&0xffffffff for o in [3080,3084,3088]},'execution':e}
scripts/test_qvm_stat_ratios.py ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json,math,unittest
2
+ from pathlib import Path
3
+ from test_qvm_stat_totals import expected
4
+ from test_qvm_ground import f,word
5
+
6
+ def divisor(a,b):return math.gcd(a,b) if a!=0 and b!=0 and max(a,b)>0 else 1
7
+
8
+ def normalized(a,b):
9
+ g=divisor(a,b);return {'3080':math.trunc(a/g)&0xffffffff,'3084':math.trunc(b/g)&0xffffffff,'3088':word(0 if b==0 else f(f(a)/f(b)))}
10
+ class StatRatioTests(unittest.TestCase):
11
+ @classmethod
12
+ def setUpClass(cls):cls.r=json.loads(Path('docs/research/qvm-stat-ratios.json').read_text())
13
+ def test_independent_positive_divisor_and_signed_fallback(self):
14
+ self.assertEqual(len(self.r['divisor_probes']),38)
15
+ for p in self.r['divisor_probes']:self.assertEqual(p['divisor'],divisor(p['first'],p['second']))
16
+ def test_normalized_integer_and_float32_publication(self):
17
+ self.assertEqual(len(self.r['probes']),28)
18
+ for p in self.r['probes']:self.assertEqual(p['final'],normalized(*expected(p['counters'])),p['input'])
19
+ def test_complete_refresh_and_actual_children(self):
20
+ for p in self.r['probes']:self.assertEqual(p['execution']['stop'],279718);self.assertEqual({c['target'] for c in p['execution']['calls']},{283085,283166,283488})
21
+ if __name__=='__main__':unittest.main()
xtask/checks.tsv CHANGED
@@ -1275,3 +1275,6 @@ edge docs/research/rust-cross-client-clear.json scripts/test_rust_cross_client_c
1275
  report scripts/analyze_qvm_stat_totals.py docs/research/qvm-stat-totals.json
1276
  edge docs/research/qvm-stat-totals.json scripts/test_qvm_stat_totals.py
1277
  group stat-totals scripts/analyze_qvm_stat_totals.py
 
 
 
 
1275
  report scripts/analyze_qvm_stat_totals.py docs/research/qvm-stat-totals.json
1276
  edge docs/research/qvm-stat-totals.json scripts/test_qvm_stat_totals.py
1277
  group stat-totals scripts/analyze_qvm_stat_totals.py
1278
+ report scripts/analyze_qvm_stat_ratios.py docs/research/qvm-stat-ratios.json
1279
+ edge docs/research/qvm-stat-ratios.json scripts/test_qvm_stat_ratios.py
1280
+ group stat-ratios scripts/analyze_qvm_stat_ratios.py