883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
40 lines
4.3 KiB
Python
40 lines
4.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Validate one complete held-parent partial-slot batch, not proc execution."""
|
|
import argparse,copy,json,sys
|
|
from pathlib import Path
|
|
sys.path.insert(0,str(Path(__file__).resolve().parents[1]/'ops'))
|
|
from item_effect_compat import compose_passive_link_completion
|
|
from item_sparse_compat import package_payloads
|
|
|
|
def main():
|
|
p=argparse.ArgumentParser();p.add_argument('--stage',type=Path,required=True);a=p.parse_args();load=lambda n:json.loads((a.stage/n).read_text());c=load('context.json');base=json.loads(Path(c['base']).read_text());final=load('package-compact.json');report=load('composer-report.json');new=final['rows'][len(base['rows']):]
|
|
assert final['rows'][:len(base['rows'])]==base['rows'] and len(base['rows'])==83539
|
|
assert len(new)==10 and new==report['added'] and len(final['rows'])==83549
|
|
assert not report['blocked'] and len(set(report['selected_item_ids']))==5
|
|
sources={i['entry']:i['source']for i in c['items']};effects={r['id']:r for r in new if r['table_name']=='ItemEffect'};links=[r for r in new if r['table_name']=='ItemXItemEffect'];deferred={(r['entry'],r['slot']):r for r in report['deferred_source_slots']}
|
|
assert len(deferred)==7 and len(links)==len(effects)==5
|
|
assert {r['reason']for r in deferred.values()}=={'Unreviewed source use/proc/charge/cooldown','Source spell definition review missing','Existing slot differs; additive completion cannot replace it'}
|
|
for link in links:
|
|
item=link['source_item'];slot=link['source_slot'];s=sources[item];suffix=str(slot+1);effect=effects[link['record']['ItemEffectID']];v=effect['record']
|
|
assert link['record']['ItemID']==item and effect['source_item']==item and effect['source_slot']==slot and(item,slot)not in deferred
|
|
assert v['LegacySlotIndex']==slot and v['SpellID']==s['spellid_'+suffix]and v['TriggerType']==s['spelltrigger_'+suffix]==1
|
|
assert v['Charges']==s['spellcharges_'+suffix]==0 and s['spellppmrate_'+suffix]==0
|
|
assert v['CoolDownMSec']==s['spellcooldown_'+suffix]==0 and v['CategoryCoolDownMSec']==s['spellcategorycooldown_'+suffix]==0 and v['SpellCategoryID']==s['spellcategory_'+suffix]==0
|
|
assert link['source_effect_slot_authority']['full_source_metadata_authority']is False
|
|
assert {r['source_item']for r in links}==set(report['selected_item_ids'])
|
|
assert {r['table_name']for r in new}=={'ItemEffect','ItemXItemEffect'} and all(r.get('record_status','valid')=='valid'for r in new)
|
|
assert final['push_id']==package_payloads(final['rows'])[0]
|
|
# A repeated composition must preserve the just-added slots while retaining
|
|
# unsupported/occupied source-slot holds, never allocate replacements/procs.
|
|
effects_native=json.loads(Path('runtime/catalog-items-20261018/ItemEffect.json').read_text());links_native=json.loads(Path('runtime/catalog-items-20261018/ItemXItemEffect.json').read_text());again=compose_passive_link_completion(final,c['items'],set(c['reviewed_spell_ids']),effects_native,links_native,c['schemas'],c['maxima'],missing_slots_only=True,effective_parent_authority=c['effective_parent_authority'])
|
|
assert not again['added'] and again['package']['rows']==final['rows'] and len(again['deferred_source_slots'])==7
|
|
# Noninline Item.ID is still part of typed parent identity even though it
|
|
# does not change the Item wire bytes. A swapped-row claim must be refused.
|
|
wrong=copy.deepcopy(c['effective_parent_authority']);wrong['parents'][0]['basic_record']['ID']+=1
|
|
refused=compose_passive_link_completion(base,c['items'],set(c['reviewed_spell_ids']),effects_native,links_native,c['schemas'],c['maxima'],missing_slots_only=True,effective_parent_authority=wrong)
|
|
assert any(r['entry']==wrong['parents'][0]['ID'] and r['reason']=='Effective parent source entry/type slot authority differs'for r in refused['blocked'])
|
|
|
|
out={'result':'PASS','base_rows':83539,'rows':83549,'changed_parents':5,'new_reviewed_passive_slots':5,'unsupported_or_conflicting_source_slots_retained':7,'original_metadata_and_all_relationship_rows_preserved':True,'no_proc_PPM_charge_cooldown_or_definition_equivalence_claimed':True,'only_new_safe_independent_equip_slots_added':True,'idempotent_partial_recomposition':True,'noninline_parent_identity_refused':True,'native_client_or_combat_verified':False,'83539_frozen_builds_unchanged':True}
|
|
(a.stage/'validation.json').write_text(json.dumps(out,indent=2)+'\n');print('PASS5independent slots/5parents;7slot holds preserved; frozen83539prefix exact')
|
|
if __name__=='__main__':main()
|