Files
praxisandClaude Fable 5.2 45ecd73fe0 Evidence records
1888 files, from working commit b1a079a.

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

42 lines
4.3 KiB
Python

from pathlib import Path
import sys,json,hashlib
from collections import Counter,defaultdict
sys.path.insert(0,'ops')
from turtle_data import DBC,spell_layout,inventory_item_snapshot
from spell_family_compat import namespace
from spell_definition_common import checked_constant_source,spell_category_namespace
from spell_timed_buff_compat import defensive_namespace,validate_source
from aura_visual_profile import new_link_candidate
import spell_passive_compat as codec
W=Path('runtime/praxis-item-effects-20261020');S=Path.home()/'Servers/tortoise-wow/src/game';T=Path('../servers/trinity-forever/src/server/game');load=lambda p:json.loads(Path(p).read_text())
base=Path('runtime/all-spell-templates-20261018');manifest=load(base/'manifest.json');spells={}
for chunk in manifest['chunks']:
raw=(base/chunk['path']).read_bytes();assert len(raw)==chunk['bytes']and hashlib.sha256(raw).hexdigest()==chunk['sha256']
for r in json.loads(raw):assert r['entry']not in spells;spells[r['entry']]=r
family=namespace(S/'Database/DBCEnums.h',T/'Miscellaneous/SharedDefines.h');category=spell_category_namespace(S/'Spells/SpellDefines.h',T/'Miscellaneous/SharedDefines.h');defense=defensive_namespace(S/'Spells/SpellDefines.h',S/'Spells/SpellAuraDefines.h',S/'SharedDefines.h',T/'Miscellaneous/SharedDefines.h',T/'Spells/Auras/SpellAuraDefines.h')
dbc=DBC(Path('runtime/octo-installed-data/patch-O.mpq/Spell.dbc'),173)
f=load('tests/fixtures/source-full-lifecycle-visual.json');schema=codec.fields(Path('../tools/WoWDBDefs/definitions/SpellXSpellVisual.dbd'),'SpellXSpellVisual')
# Candidate-only local allocation, never merge into a package or reserve a production ID.
links={};rows=[];users=defaultdict(set);parents=defaultdict(set)
for r in inventory_item_snapshot('runtime/all-item-templates-20261017')['records']:
p=r['raw_fields']
for i in range(1,6):
if p['spellid_'+str(i)]:users[p['spellid_'+str(i)]].add(p['entry'])
for r in spells.values():
for i in range(1,4):
if r['effectTriggerSpell'+str(i)]:parents[r['effectTriggerSpell'+str(i)]].add(r['entry'])
for ident,raw in sorted(spells.items()):
if not any(raw['effectApplyAuraName'+str(i)]==30 and raw['effectMiscValue'+str(i)]==95 or raw['effectApplyAuraName'+str(i)]==87 and raw['effectMiscValue'+str(i)]==1 for i in range(1,4)):continue
r={'spell_id':ident,'name':raw['name'],'direct_item_users':sorted(users[ident]),'trigger_parent_ids':sorted(parents[ident]),'parent_item_users':sorted({i for p in parents[ident]for i in users[p]})}
try:
src=checked_constant_source(dbc,raw,spell_layout(),family_namespace=family,category_context=category);src['defensive_context']=defense
visual=None
if src['visuals'][0]==7362:
visual=new_link_candidate(raw,f['source_visual'],f['native_visual'],f['native_events'],f['native_links'][0],schema,1500000,{'schema_version':1,'build':codec.BUILD,'SpellXSpellVisual':{}},{x['ID']for x in f['native_links']},full_lifecycle=True)
indices=validate_source(src,visual_link=visual,defensive=True)
r.update(status='source-shape-and-lifecycle-validated',source_definition=src,effect_indices=indices,visual_candidate=visual,not_installed=True)
except (ValueError,KeyError)as err:r.update(status='blocked',reason=str(err),source_visual_ids=[raw['spellVisual1'],raw['spellVisual2']])
rows.append(r)
report={'kind':'full-source-physical-reduction-defense-family-review','source_spell_count':len(spells),'source_spell_snapshot_sha256':hashlib.sha256((base/'manifest.json').read_bytes()).hexdigest(),'candidate_scope_count':len(rows),'validated_count':sum(r['status']=='source-shape-and-lifecycle-validated'for r in rows),'blocked_reasons':dict(Counter(r['reason']for r in rows if r['status']=='blocked')),'rows':rows,'installed':False,'native_api_absence_verified':False,'gameplay_verified':False,'limitations':['Includes all matching source records, with explicit unsupported semantic/visual dependencies.','Tentative visual ID allocation is candidate-only; production registry reservation required.','No source visual stages are discarded; native assets and runtime acceptance remain separate.']}
(W/'defensive-family-review.json').write_text(json.dumps(report,indent=2)+'\n');print({k:report[k]for k in('source_spell_count','candidate_scope_count','validated_count','blocked_reasons')});print('validated IDs',[r['spell_id']for r in rows if r['status']=='source-shape-and-lifecycle-validated'])