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

36 lines
2.2 KiB
Python

#!/usr/bin/env python3
"""Real captured ground splines match the read-only Forever native serializer.
This verifies byte layout, not that a client moved. World evidence is separate.
"""
import json
from pathlib import Path
import struct
import subprocess
import sys
root = Path(__file__).resolve().parent
samples = json.loads((root/'fixtures/turtle-northshire-splines.json').read_text())
golden = bytes.fromhex('cb9d110630f10000803f0000004000004040090000000000010000e803000002000000000020410000a0410000f04104c0bf00')
angle = bytearray(golden)
angle[22] = 4
angle[23:23] = struct.pack('<f', -1)
# Authenticated gateway-reference capture, not native-client acceptance:
# population-355271-67256415909788.jsonl:1913, compressed0x2FB inner0xDD.
# Young Wolf69, spline453789, exact stopXYZ; no flags/time/path follow face1.
stop = bytes.fromhex('cfe538014530f188e808c6ba6b69c3d754ac429dec060001')
# Exact Nov6 creature7036 spline710794: three zero-length ground segments.
quantized_duplicates = bytes.fromhex('dbe5147c1b30f169c2f1c5496504c5f41507438ad80a000000010000db0900000700000068dcf1c5586b04c5e3450643f4f77ffff4f77ffff4f77ffff4f77ffff227c0fffa170000')
for body in [bytes.fromhex(row['body']) for row in samples] + [golden, bytes(angle), stop, quantized_duplicates]:
wire = struct.pack('<HI', 70, 0)+body
native = subprocess.run([sys.argv[1], '--monster-move'], input=wire, capture_output=True, timeout=15)
translated = subprocess.run([sys.argv[1], '--gateway-monster-move'], input=wire, capture_output=True, timeout=15)
assert native.returncode == translated.returncode == 0, (native.stderr, translated.stderr)
assert native.stdout == translated.stdout, 'Standalone spline layout differs from native Forever serializer'
for body in [stop[:n] for n in range(len(stop))] + [stop+b'\0']:
wire = struct.pack('<HI', 70, 0)+body
for mode in ('--monster-move', '--gateway-monster-move'):
result = subprocess.run([sys.argv[1], mode], input=wire, capture_output=True, timeout=15)
assert result.returncode != 0 and not result.stdout, ('Malformed stop accepted', mode, len(body))
print(len(samples)+4, 'real/golden spline cases including authoritative stop match native Forever bytes; stop bounds rejected. Actual movement needs client evidence.')