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

33 lines
2.7 KiB
Python

"""One changed-family boundary; no original client or retained17wire rerun."""
import copy,json,re,subprocess,sys
from pathlib import Path
from unittest.mock import patch
ROOT=Path(__file__).resolve().parents[1];sys.path.insert(0,str(ROOT/'ops'))
import validate_warrior_cooldown_build as guard
def main(executable):
out=ROOT/'runtime/continuation-20261023/spell-modifier-wire-assessment-20261024'
header=(ROOT/'include/gateway/warrior_cooldown_modifiers.hpp').read_text()
old=subprocess.check_output(['git','show','HEAD:include/gateway/warrior_cooldown_modifiers.hpp'],cwd=ROOT,text=True)
literal=lambda text:re.search(r'std::array<BitRoute,17> Routes\{\{(.*?)\}\};',text,re.S).group(0)
assert literal(old)==literal(header),'Original17literal changed'
inputs=json.loads((ROOT/'runtime/continuation-20261023/next-build-inputs.json').read_text());package=json.loads((ROOT/inputs['metadata_package']).read_text())
cache={};original=guard.read_pinned
def shared_read(path,expected,limit):
key=(str(path),expected,limit)
if key not in cache:cache[key]=original(path,expected,limit)
return cache[key]
with patch.object(guard,'read_pinned',shared_read):
result=guard.review_named_families(header,package)
assert result['admissible'] and result['routes_checked']==105
profile=json.loads(cache[next(k for k in cache if k[0].endswith('/profile.json'))])
route=next(x for x in profile['routes']if x['character_class']==2)
mutated=dict(package,rows=list(package['rows']))
mutated['rows'].append(dict(table_name='SpellClassOptions',id=2000000000,record=dict(ID=2000000000,SpellID=2000000000,ModalNextSpell=0,SpellClassSet=route['family'],SpellClassMask=[(1<<(route['native_bit']%32))if i==route['native_bit']//32 else 0 for i in range(4)])))
negative=guard.review_named_families(header,mutated)
assert not negative['admissible'],'Native-only collateral was accepted'
done=subprocess.run([str(Path(executable).resolve())],capture_output=True,text=True);(out/'family-wire-check.log').write_text(done.stdout+done.stderr);assert done.returncode==0,'New-family writer boundary failed'
result.update(status='PASS',old17_literal_identical=True,native_collateral_mutation_refused=True,source_reference_consumer_only=True,original_native_acceptance=False,percent_forwarded=False,other_operations_forwarded=False,current_package=inputs['metadata_package'])
(out/'family-extension-validation.json').write_text(json.dumps(result,indent=2)+'\n');print('105new routes/8classes current identity guard +actual14byte writer +collateral refusal PASS; old17literal retained.')
if __name__=='__main__':main(sys.argv[1])