qvm: original contact health composition
Browse files- docs/ASSET_PIPELINE_TODO.md +3 -0
- docs/FINDINGS.md +3 -0
- docs/PROVISIONAL_TODO.md +3 -0
- docs/RESEARCH_LEDGER.md +5 -0
- docs/REVERSE_ENGINEERING_TODO.md +3 -0
- docs/research/QVM_CONTACT_HEALTH.md +7 -0
- docs/research/README.md +3 -0
- docs/research/qvm-contact-health.json +0 -0
- scripts/analyze_qvm_contact_health.py +28 -0
- scripts/qvm_contact_support.py +8 -4
- scripts/test_qvm_contact_health.py +35 -0
- scripts/test_qvm_health_complete.py +1 -1
- xtask/checks.tsv +3 -0
docs/ASSET_PIPELINE_TODO.md
CHANGED
|
@@ -862,3 +862,6 @@ Research progress: RE-731 [report](research/QVM_HEALTH_IMPULSE.md); original ass
|
|
| 862 |
|
| 863 |
|
| 864 |
Research progress: RE-732 [report](research/QVM_HEALTH_COMPLETE.md); original assets unchanged.
|
|
|
|
|
|
|
|
|
|
|
|
| 862 |
|
| 863 |
|
| 864 |
Research progress: RE-732 [report](research/QVM_HEALTH_COMPLETE.md); original assets unchanged.
|
| 865 |
+
|
| 866 |
+
|
| 867 |
+
Research progress: RE-733 [report](research/QVM_CONTACT_HEALTH.md); original assets unchanged.
|
docs/FINDINGS.md
CHANGED
|
@@ -1208,3 +1208,6 @@ RE-714–723 batch complete: [complete contact and health prefixes](research/QVM
|
|
| 1208 |
|
| 1209 |
|
| 1210 |
**RE-732 — Complete health function with actual velocity impulses:** Complete211239 now composes gates, routing, normalization, bookkeeping, special targets, health publication and terminal branches with actual RNG/meter/impulse children. Late health−999 clamp can leave client208 below the entity clamp. [Evidence](research/QVM_HEALTH_COMPLETE.md).
|
|
|
|
|
|
|
|
|
|
|
|
| 1208 |
|
| 1209 |
|
| 1210 |
**RE-732 — Complete health function with actual velocity impulses:** Complete211239 now composes gates, routing, normalization, bookkeeping, special targets, health publication and terminal branches with actual RNG/meter/impulse children. Late health−999 clamp can leave client208 below the entity clamp. [Evidence](research/QVM_HEALTH_COMPLETE.md).
|
| 1211 |
+
|
| 1212 |
+
|
| 1213 |
+
**RE-733 — Complete original-model contact to actual health:** Original-model contact now executes actual211239 health/impulse effects while preserving contact return, event payload and special-weapon4 bypass behavior; default captured-health reports remain unchanged. [Evidence](research/QVM_CONTACT_HEALTH.md).
|
docs/PROVISIONAL_TODO.md
CHANGED
|
@@ -1197,3 +1197,6 @@ Research progress: RE-731 [report](research/QVM_HEALTH_IMPULSE.md); full native/
|
|
| 1197 |
|
| 1198 |
|
| 1199 |
Research progress: RE-732 [report](research/QVM_HEALTH_COMPLETE.md); full native/platform/game scope remains open.
|
|
|
|
|
|
|
|
|
|
|
|
| 1197 |
|
| 1198 |
|
| 1199 |
Research progress: RE-732 [report](research/QVM_HEALTH_COMPLETE.md); full native/platform/game scope remains open.
|
| 1200 |
+
|
| 1201 |
+
|
| 1202 |
+
Research progress: RE-733 [report](research/QVM_CONTACT_HEALTH.md); full native/platform/game scope remains open.
|
docs/RESEARCH_LEDGER.md
CHANGED
|
@@ -1303,3 +1303,8 @@ Complete213009 adds direction×(global scale×knockback/200) in source float32 o
|
|
| 1303 |
## 2026-10-21 — RE-732 Complete health function with actual velocity impulses
|
| 1304 |
|
| 1305 |
Complete211239 now composes gates, routing, normalization, bookkeeping, special targets, health publication and terminal branches with actual RNG/meter/impulse children. Late health−999 clamp can leave client208 below the entity clamp. Focused `cargo xtask test-group health` passes (41 Python tests); selected reports regenerate twice byte-identically, with storage, links and whitespace guards. New report: 804258 bytes. Full-suite validation is deferred to the tenth batch commit. No original assets, Rust runtime or shared VM evaluator changed.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1303 |
## 2026-10-21 — RE-732 Complete health function with actual velocity impulses
|
| 1304 |
|
| 1305 |
Complete211239 now composes gates, routing, normalization, bookkeeping, special targets, health publication and terminal branches with actual RNG/meter/impulse children. Late health−999 clamp can leave client208 below the entity clamp. Focused `cargo xtask test-group health` passes (41 Python tests); selected reports regenerate twice byte-identically, with storage, links and whitespace guards. New report: 804258 bytes. Full-suite validation is deferred to the tenth batch commit. No original assets, Rust runtime or shared VM evaluator changed.
|
| 1306 |
+
|
| 1307 |
+
|
| 1308 |
+
## 2026-10-21 — RE-733 Complete original-model contact to actual health
|
| 1309 |
+
|
| 1310 |
+
Original-model contact now executes actual211239 health/impulse effects while preserving contact return, event payload and special-weapon4 bypass behavior; default captured-health reports remain unchanged. Focused `cargo xtask test-group contact` passes (163 Python tests); selected reports regenerate twice byte-identically, with storage, links and whitespace guards. New report: 1079948 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
|
@@ -1240,3 +1240,6 @@ Purpose: turn the supplied installation into an evidence-backed specification of
|
|
| 1240 |
|
| 1241 |
|
| 1242 |
- [x] RE-732 Complete health function with actual velocity impulses ([report](research/QVM_HEALTH_COMPLETE.md)).
|
|
|
|
|
|
|
|
|
|
|
|
| 1240 |
|
| 1241 |
|
| 1242 |
- [x] RE-732 Complete health function with actual velocity impulses ([report](research/QVM_HEALTH_COMPLETE.md)).
|
| 1243 |
+
|
| 1244 |
+
|
| 1245 |
+
- [x] RE-733 Complete original-model contact to actual health ([report](research/QVM_CONTACT_HEALTH.md)).
|
docs/research/QVM_CONTACT_HEALTH.md
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Complete original-model contact to actual health
|
| 2 |
+
|
| 3 |
+
RE-733. Reproduce with `python3 scripts/analyze_qvm_contact_health.py`; validate with `cargo xtask test-group contact`. See the [machine report](qvm-contact-health.json).
|
| 4 |
+
|
| 5 |
+
Complete292545 now has an optional health resolver, preserving its earlier captured default byte-for-byte. The new35-case composition reuses exact cached original-model contexts from the complete-contact report and executes full211239, including actual meter/RNG/velocity children. Independent composed oracles verify every tracked health entity/client field and original contact return/event/call gates. Health changes occur after event prediction; special weapon4 contacts still skip ordinary health dispatch. Source report hashes retain provenance, while native math/allocation/link, protected/interception/object/pain/death callbacks and live-world geometry remain explicit boundaries. This does not execute the original game. The nonclient sample maps VM addresses104 and220 from original file-backed data, both zero; this is a flat-VM source fixture, not established native-null-pointer/live-world legality.
|
| 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
|
@@ -798,3 +798,6 @@ The extension collector adds five focused tests for native tail calls, command-r
|
|
| 798 |
|
| 799 |
|
| 800 |
[RE-732: Complete health function with actual velocity impulses](QVM_HEALTH_COMPLETE.md).
|
|
|
|
|
|
|
|
|
|
|
|
| 798 |
|
| 799 |
|
| 800 |
[RE-732: Complete health function with actual velocity impulses](QVM_HEALTH_COMPLETE.md).
|
| 801 |
+
|
| 802 |
+
|
| 803 |
+
[RE-733: Complete original-model contact to actual health](QVM_CONTACT_HEALTH.md).
|
docs/research/qvm-contact-health.json
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
scripts/analyze_qvm_contact_health.py
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Complete original-context contact composed with actual health and impulses."""
|
| 3 |
+
import hashlib,json
|
| 4 |
+
from pathlib import Path
|
| 5 |
+
from qvm_research_support import source,constants
|
| 6 |
+
from qvm_contact_support import seed,run,L,CONTEXT,TRACE,TARGET,ATTACKER
|
| 7 |
+
from qvm_health_effects_support import seed as health_seed,H
|
| 8 |
+
from analyze_qvm_health_complete import complete
|
| 9 |
+
from analyze_qvm_acceleration import number
|
| 10 |
+
from analyze_qvm import write_json
|
| 11 |
+
|
| 12 |
+
def main():
|
| 13 |
+
q,raw,h,ins=source();path=Path('docs/research/qvm-contact-complete.json');data=path.read_bytes();old=json.loads(data)['probes'];rows=[]
|
| 14 |
+
for source_row,previous in enumerate(old):
|
| 15 |
+
a=previous['input'];m=seed(raw,h,**a);defaults=health_seed(raw,h)
|
| 16 |
+
for key,value in defaults.items():m.setdefault(key,value)
|
| 17 |
+
m.update(constants(raw,h,[104,220]))
|
| 18 |
+
context=previous['context_words']
|
| 19 |
+
for j,v in enumerate(context):m[CONTEXT+4*j]=v
|
| 20 |
+
for p,values in [(TRACE+12,context[3:6]),(TRACE+24,context[9:12])]:
|
| 21 |
+
for j,v in enumerate(values):m[p+4*j]=v
|
| 22 |
+
if a.get('null_context'):m[L+144]=0
|
| 23 |
+
def health(i,m,args):
|
| 24 |
+
m,r=complete(i,m,args)
|
| 25 |
+
client=r['initial']['client'];cl=client or {'220':0,'228':0,'184':0,'6332':0};r.update(input={'client':client is not None,'method':args[36],'damage':args[28],'health':r['initial']['entity']['684'],'flags220':cl['220'],'packed':cl['228'],'meter':cl['184'],'heat':number(cl['6332']),'scale':1000,'direction':list(map(number,r['initial']['direction'])),'mode':a.get('mode',3),'now':a.get('now',5000),'entity_flags':a.get('entity_flags',0),'target_kind':r['initial']['entity']['4'],'same_team':a.get('same_team',False),'friendly_fire':a.get('friendly_fire',0),'location':args[40]},target_pointer=TARGET,attacker_pointer=ATTACKER,tracking=m[34999664]);return m,r
|
| 26 |
+
_,p=run(ins,m,292546,293730,include_event=True,health_resolver=health);p.update(input=a,source_row=source_row);rows.append(p)
|
| 27 |
+
write_json(Path('docs/research/qvm-contact-health.json'),{'source':q['source'],'sha256':q['sha256'],'contact_report':str(path),'contact_report_sha256':hashlib.sha256(data).hexdigest(),'probes':rows,'limits':'Complete292545 composed with complete211239 and actual213009/211197/36717. Cached original-model contexts retained via source report identity. Native math/link/allocation, protected/intercept callbacks and live world legality remain supplied/captured boundaries.'})
|
| 28 |
+
if __name__=='__main__':main()
|
scripts/qvm_contact_support.py
CHANGED
|
@@ -52,7 +52,7 @@ def feedback(i,m,a):
|
|
| 52 |
return m,0,e
|
| 53 |
|
| 54 |
|
| 55 |
-
def handlers(effects):
|
| 56 |
def event(i,m,a):
|
| 57 |
m,r=temp_event(i,m,a[8],a[12])
|
| 58 |
# Avoid repeating constructor records inside parent/child call trees.
|
|
@@ -68,12 +68,16 @@ def handlers(effects):
|
|
| 68 |
return call
|
| 69 |
def bookkeeping(i,m,a):
|
| 70 |
m,v,r=feedback(i,m,a);effects['feedback'].append({'arguments':a,'execution':r});return m,v,r
|
| 71 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 72 |
|
| 73 |
|
| 74 |
-
def run(ins,m,start,stop,boundaries=(),include_event=False):
|
| 75 |
effects={k:[] for k in ['events','announcements','notices','feedback','damage']}
|
| 76 |
-
m,e=resume(ins,start,stop,m,L,handlers=handlers(effects),boundaries=boundaries,limit=20000)
|
| 77 |
p={'scalar_word':m[L+56]&0xffffffff,'location':m[L+60],'special':m[L+52],'extra_word':m[EXTRA]&0xffffffff,'target_health':m[TARGET+684],'execution':e,'effects':effects}
|
| 78 |
if include_event:p['event_record']=record(m,EVENT)
|
| 79 |
return m,p
|
|
|
|
| 52 |
return m,0,e
|
| 53 |
|
| 54 |
|
| 55 |
+
def handlers(effects,health_resolver=None):
|
| 56 |
def event(i,m,a):
|
| 57 |
m,r=temp_event(i,m,a[8],a[12])
|
| 58 |
# Avoid repeating constructor records inside parent/child call trees.
|
|
|
|
| 68 |
return call
|
| 69 |
def bookkeeping(i,m,a):
|
| 70 |
m,v,r=feedback(i,m,a);effects['feedback'].append({'arguments':a,'execution':r});return m,v,r
|
| 71 |
+
def damage(i,m,a):
|
| 72 |
+
if health_resolver is None:return captured(211239,effects['damage'])(i,m,a)
|
| 73 |
+
m,r=health_resolver(i,m,a);effects['damage'].append({'arguments':a,'health':r})
|
| 74 |
+
return m,0,{'health_executed':True,'stop':r['execution']['stop'],'trace_sha256':r['execution']['trace_sha256']}
|
| 75 |
+
return {289594:factor,32155:inventory,33715:predicate,277695:event,60317:codec,-104:trig(math.sin),-105:trig(math.cos),-107:trig(math.sqrt),7259:captured(7259,effects['announcements']),278003:captured(278003,effects['notices']),285142:bookkeeping,211239:damage}
|
| 76 |
|
| 77 |
|
| 78 |
+
def run(ins,m,start,stop,boundaries=(),include_event=False,health_resolver=None):
|
| 79 |
effects={k:[] for k in ['events','announcements','notices','feedback','damage']}
|
| 80 |
+
m,e=resume(ins,start,stop,m,L,handlers=handlers(effects,health_resolver),boundaries=boundaries,limit=20000)
|
| 81 |
p={'scalar_word':m[L+56]&0xffffffff,'location':m[L+60],'special':m[L+52],'extra_word':m[EXTRA]&0xffffffff,'target_health':m[TARGET+684],'execution':e,'effects':effects}
|
| 82 |
if include_event:p['event_record']=record(m,EVENT)
|
| 83 |
return m,p
|
scripts/test_qvm_contact_health.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import hashlib,json,unittest
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
from test_qvm_health_complete import expected
|
| 4 |
+
class ContactHealthTests(unittest.TestCase):
|
| 5 |
+
@classmethod
|
| 6 |
+
def setUpClass(cls):cls.r=json.loads(Path('docs/research/qvm-contact-health.json').read_text());cls.ps=cls.r['probes'];cls.old=json.loads(Path(cls.r['contact_report']).read_text())['probes'];cls.table=json.loads(Path('docs/research/qvm-health-complete.json').read_text())['descriptor_table']
|
| 7 |
+
def test_actual_health_all_external_state_against_composed_oracle(self):
|
| 8 |
+
count=0
|
| 9 |
+
for p in self.ps:
|
| 10 |
+
for effect in p['effects']['damage']:
|
| 11 |
+
h=effect['health'];count+=1
|
| 12 |
+
if h['initial']['client'] is None:
|
| 13 |
+
from qvm_contact_support import ATTACKER
|
| 14 |
+
entity=dict(h['initial']['entity']);health=entity['684']-max(1,effect['arguments']['28']);entity.update({'684':max(-999,health)&0xffffffff,'836':ATTACKER,'840':effect['arguments']['40']})
|
| 15 |
+
if health<=0:entity['720']=ATTACKER
|
| 16 |
+
self.assertEqual(h['final']['entity'],entity);self.assertIsNone(h['final']['client']);continue
|
| 17 |
+
r,tracking=expected(h,self.table)
|
| 18 |
+
for key in ['entity','client','attacker_credits','direction','rng']:self.assertEqual(h['final'][key],r[key],(p['input'],key))
|
| 19 |
+
self.assertEqual(h['tracking'],tracking);self.assertEqual(p['target_health'],h['final']['entity']['684'] if h['final']['entity']['684']<0x80000000 else h['final']['entity']['684']-0x100000000)
|
| 20 |
+
self.assertGreater(count,0)
|
| 21 |
+
def test_contact_return_event_and_call_gates_preserved(self):
|
| 22 |
+
for p in self.ps:
|
| 23 |
+
old=self.cls_old(p);self.assertEqual(p['execution']['return'],old['execution']['return']);self.assertEqual(p['event_record'],old['event_record']);self.assertEqual(len(p['effects']['damage']),len(old['effects']['damage']))
|
| 24 |
+
def cls_old(self,p):return self.old[p['source_row']]
|
| 25 |
+
def test_source_chain_identity_and_no_cached_health_result(self):
|
| 26 |
+
self.assertEqual(hashlib.sha256(Path(self.r['contact_report']).read_bytes()).hexdigest(),self.r['contact_report_sha256'])
|
| 27 |
+
from qvm_research_support import source,constants
|
| 28 |
+
_,raw,h,_=source();self.assertEqual(constants(raw,h,[104,220]),{104:0,220:0})
|
| 29 |
+
for p in self.ps:
|
| 30 |
+
for effect in p['effects']['damage']:self.assertEqual(effect['health']['execution']['stop'],213007);self.assertNotIn('native_effect_not_executed',effect)
|
| 31 |
+
def test_special_weapon_four_bypasses_health_and_impulse(self):
|
| 32 |
+
rows=[p for p in self.ps if p['input'].get('weapon')==4 and p['input'].get('flag')];self.assertTrue(rows)
|
| 33 |
+
for p in rows:self.assertEqual(p['effects']['damage'],[]);self.assertEqual(p['target_health'],100)
|
| 34 |
+
def test_original_context_fixture_count(self):self.assertEqual(len(self.ps),35)
|
| 35 |
+
if __name__=='__main__':unittest.main()
|
scripts/test_qvm_health_complete.py
CHANGED
|
@@ -15,7 +15,7 @@ def expected(p,table):
|
|
| 15 |
if a.get('target_kind',1)==4 and a.get('checksum',0)!=MAGIC:return r,tracking
|
| 16 |
flags,direction,kb,stop=knockback(a,table);r['direction']=direction
|
| 17 |
if stop==213007:return r,tracking
|
| 18 |
-
method=a.get('method',12);same=a.get('self',False);attacker=TARGET if same else ATTACKER;attacker_id=65 if same else 7
|
| 19 |
if not same and a.get('health',100)>0 and a.get('target_kind',1) not in (0,3,4):r['attacker_credits']=(-1 if a.get('mode',3)>=3 and a.get('mode',3) not in (9,11) and a.get('same_team',False) else 1)&0xffffffff
|
| 20 |
take=max(1,a.get('damage',100));cl['272']=attacker_id;cl['4128']=attacker_id;cl['4132']=method;cl['4084' if method==23 else '4088']+=take
|
| 21 |
origin=method==23 or a.get('direction',[3,4,0]) is None;cl['4108']=int(origin)
|
|
|
|
| 15 |
if a.get('target_kind',1)==4 and a.get('checksum',0)!=MAGIC:return r,tracking
|
| 16 |
flags,direction,kb,stop=knockback(a,table);r['direction']=direction
|
| 17 |
if stop==213007:return r,tracking
|
| 18 |
+
method=a.get('method',12);same=a.get('self',False);attacker=p.get("target_pointer",TARGET) if same else p.get("attacker_pointer",ATTACKER);attacker_id=65 if same else 7
|
| 19 |
if not same and a.get('health',100)>0 and a.get('target_kind',1) not in (0,3,4):r['attacker_credits']=(-1 if a.get('mode',3)>=3 and a.get('mode',3) not in (9,11) and a.get('same_team',False) else 1)&0xffffffff
|
| 20 |
take=max(1,a.get('damage',100));cl['272']=attacker_id;cl['4128']=attacker_id;cl['4132']=method;cl['4084' if method==23 else '4088']+=take
|
| 21 |
origin=method==23 or a.get('direction',[3,4,0]) is None;cl['4108']=int(origin)
|
xtask/checks.tsv
CHANGED
|
@@ -1159,3 +1159,6 @@ report scripts/analyze_qvm_health_impulse.py docs/research/qvm-health-impulse.js
|
|
| 1159 |
edge docs/research/qvm-health-impulse.json scripts/test_qvm_health_impulse.py
|
| 1160 |
report scripts/analyze_qvm_health_complete.py docs/research/qvm-health-complete.json
|
| 1161 |
edge docs/research/qvm-health-complete.json scripts/test_qvm_health_complete.py
|
|
|
|
|
|
|
|
|
|
|
|
| 1159 |
edge docs/research/qvm-health-impulse.json scripts/test_qvm_health_impulse.py
|
| 1160 |
report scripts/analyze_qvm_health_complete.py docs/research/qvm-health-complete.json
|
| 1161 |
edge docs/research/qvm-health-complete.json scripts/test_qvm_health_complete.py
|
| 1162 |
+
report scripts/analyze_qvm_contact_health.py docs/research/qvm-contact-health.json
|
| 1163 |
+
edge docs/research/qvm-contact-health.json scripts/test_qvm_contact_health.py
|
| 1164 |
+
group contact scripts/analyze_qvm_contact_health.py
|