Files
WoW-Hybrid-gateway/tests/engine_death_release_observation_test.py
praxisandClaude Fable 5.2 7f2139d8d0 Offline test fixtures
883 files, from working commit b1a079a.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-19 01:32:48 +02:00

27 lines
1.4 KiB
Python

import sys,struct
from pathlib import Path
from types import SimpleNamespace
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'ops'))
from engine_death_release_observation import ENTRY,SLOT,RETURN,VTABLE,inspect_context
r=SimpleNamespace(rip=ENTRY,rsp=0x200000,rbp=0x201000,rcx=0x205890)
q=lambda v:struct.pack('<Q',v)
memory={SLOT:q(ENTRY),r.rsp:q(RETURN),r.rcx:q(VTABLE),r.rcx+0x28:struct.pack('<i3f',-1,0,0,0)}
reads=[]
def read(a,n):
reads.append((a,n));data=memory[a];assert len(data)==n;return data
def rejected():
reads.clear()
try:inspect_context(read,lambda *_:True,r)
except ValueError:return
raise AssertionError('Invalid original call contract accepted')
out=inspect_context(read,lambda *_:True,r)
assert out['map']==-1 and out['position']==[0,0,0]and not out['engine_calls_made']
for address,bad in ((SLOT,q(ENTRY+1)),(r.rsp,q(RETURN+1)),(r.rcx,q(VTABLE+1))):
saved=memory[address];memory[address]=bad;rejected();assert(r.rcx+0x28,16)not in reads;memory[address]=saved
old=r.rcx;r.rcx+=8;rejected();assert(old+0x28,16)not in reads;r.rcx=old
memory[r.rcx+0x28]=struct.pack('<i3f',-1,1,0,0);rejected()
memory[r.rcx+0x28]=struct.pack('<i3f',1,-6831.32,891.437,33.8663)
assert inspect_context(read,lambda *_:True,r)['map']==1
print('Original consumer observer requires live slot/caller/stack/type/executable contracts before bounded non-authentication payload reads; no engine invocation.')