Files
WoW-Hybrid-gateway/tests/native_display_hotfix_fixture.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

35 lines
2.4 KiB
Python

#!/usr/bin/env python3
"""One matching-codec global-hotfix activation boundary for native CDI rows.
Reuses native70334 AvailableHotfixes/HotfixConnect framing. No client process,
DB2Bulk query, account, engine function or rendering acceptance is inferred.
"""
import json,struct,subprocess,sys
from pathlib import Path
codec=Path(sys.argv[1]);package=json.loads(Path(sys.argv[2]).read_text());base=json.loads(Path(sys.argv[3]).read_text());rows=package['rows'];expected={r['id']:bytes.fromhex(r['wire_hex'])for r in rows if r['table_name']=='CreatureDisplayInfo'}
assert len(expected)==2222
def call(mode,body):
result=subprocess.run([str(codec),mode],input=body,capture_output=True,check=True)
return result.stdout
address=0x1000031;data=call('--native-client-initialization',struct.pack('<IIQ',address,0,0));count=struct.unpack_from('<I',data)[0];at=4;available=None
for _ in range(count):
opcode,size=struct.unpack_from('<II',data,at);at+=8;body=data[at:at+size];at+=size
if opcode==0x4b0001:available=body
assert at==len(data)and available is not None
realm,n=struct.unpack_from('<II',available);assert realm==address and len(available)==8+8*n;advertised={struct.unpack_from('<II',available,8+8*i)[0]for i in range(n)};base_ids={p['push_id']for p in base['pushes']};pages=[p for p in package['pushes']if any(r['table_name']=='CreatureDisplayInfo'for r in rows[p['first']:p['first']+p['count']])];assert pages and all(p['push_id']in advertised and p['push_id']not in base_ids for p in pages)
seen={}
for page in pages:
reply=call('--native-hotfix-reply',struct.pack('<IIII',70334,0,1,page['push_id']));count=struct.unpack_from('<I',reply)[0];at=4;records=[]
for _ in range(count):
push,unique,table,ident,size,status=struct.unpack_from('<IIIIIB',reply,at);at+=21;assert push==page['push_id']and not status&31;records.append((table,ident,size,status>>5))
payload_size=struct.unpack_from('<I',reply,at)[0];at+=4;assert at+payload_size==len(reply);body=reply[at:];offset=0
for table,ident,size,status in records:
wire=body[offset:offset+size];offset+=size
if table==0xbfdaf9f1:
assert ident in expected and wire==expected[ident]and len(wire)==90 and status==1 and ident not in seen;seen[ident]=True
assert offset==len(body)
assert set(seen)==set(expected)
print('PASS: all2222existing-native CDI overrides advertised on fresh pushes and serialized via global HotfixConnect; native application/render pending.')