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

50 lines
3.7 KiB
Python

"""Regenerate the already-published two reflection-child profile extensions.
Test-only support: validates complete source and all16 exact active package rows;
never modifies a profile, package, native definition or gameplay state.
"""
import hashlib,json
from pathlib import Path
from octo_client_data import canonical_sha256
from spell_passive_compat import fields,encode
import spell_reflection_compat as reflection
from aura_visual_profile import review_lifecycle_link
ROOT=Path(__file__).resolve().parents[1]
def reviewed_reflection_extension():
evidence=ROOT/'docs/evidence/content-data/item-reflection-stage-20261021'
component=json.loads((evidence/'children.json').read_text())
proof=json.loads((evidence/'runtime-profile-review.json').read_text())
package=json.loads((ROOT/'docs/evidence/data/item-sparse-compat/package.json').read_text())
ids={23178,52976}
assert(component['kind'],component['definition_policy'])==('source-school-reflection-definition-candidates',reflection.POLICY)
assert {s['spell_id']for s in component['spells']}==ids and proof['source_children']==sorted(ids)
assert proof['hidden_parent_52975_added']is False and proof['blocked_child_23216_added']is False
assert proof['named_aura_proof']==dict(kind='aura',source_name='SPELL_AURA_REFLECT_SPELLS_SCHOOL',target_name='SPELL_AURA_REFLECT_SPELLS_SCHOOL',source_value=74,target_value=74)
assert [r for r in package['rows']if r.get('source_spell_id')in ids]==component['records']
schemas={t:fields(ROOT.parent/'tools/WoWDBDefs/definitions'/(t+'.dbd'),t)for t in {r['table_name']for r in component['records']}}
raw_sources=[];visual_sources=[];masks=[];visuals=[];record_proof=[]
for meta in component['spells']:
src=meta['source_definition'];ident=meta['spell_id']
assert src['entry']==ident and canonical_sha256(src)==meta['source_record_sha256']
indices,context=reflection.validate_source(src,component['proc_namespace'])
assert indices==meta['effect_indices']==[0]and context==meta['proc_context']
assert src['effects'][0][0:2]==[6,74]and all(not e[0]for e in src['effects'][1:])
rows=[r for r in component['records']if r['source_spell_id']==ident]
assert len(rows)==8 and {r['table_name']for r in rows}==set(schemas)
for row in rows:
reflection.review_record(src,meta,row)
wire=encode(row['record'],schemas[row['table_name']])
assert row.get('record_status','valid')=='valid'and row['wire_hex']==wire.hex()and row['sha256']==hashlib.sha256(wire).hexdigest()
record_proof.append(dict(table=row['table_name'],id=row['id'],spell=ident,wire_sha256=row['sha256']))
link=reflection.review_visual(src,meta['visual_link'],schemas['SpellXSpellVisual'])
assert review_lifecycle_link(link,schemas['SpellXSpellVisual'])==link
raw=dict(entry=ident)
for n,e in enumerate(src['effects'],1):raw.update({f'effect{n}':e[0],f'effectApplyAuraName{n}':e[1]})
raw_sources.append(raw);visual_sources.append(dict(entry=ident,spellVisual1=src['visuals'][0],spellVisual2=src['visuals'][1]))
masks.append(dict(spell=ident,effect_index=0,aura_type=74,active_flags=1));visuals.append(link['profile_definition'])
previous=next(r for r in proof['validated_children']if r['spell']==ident)
assert previous['effect_indices']==indices and previous['source_record_sha256']==canonical_sha256(src)and previous['active_flags']==1 and previous['visual']==link['profile_definition']
assert record_proof==proof['validated_records']
return dict(package=package,source=raw_sources,visual_source=visual_sources,schemas=schemas,definitions=sorted(masks,key=lambda r:r['spell']),visual_definitions=sorted(visuals,key=lambda r:r['spell']))