883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
56 lines
5.8 KiB
Python
56 lines
5.8 KiB
Python
#!/usr/bin/env python3
|
|
"""One actual full-parent cohort ItemEffect delta, preserving unsafe slots."""
|
|
import argparse,json,pathlib,sys,collections
|
|
sys.path.insert(0,str(pathlib.Path(__file__).resolve().parents[1]/'ops'))
|
|
from item_sparse_compat import encode,package_pages
|
|
from item_effect_compat import effective_item_links
|
|
|
|
def main():
|
|
p=argparse.ArgumentParser();p.add_argument('--stage',type=pathlib.Path,required=True);a=p.parse_args();load=lambda q:json.loads(pathlib.Path(q).read_text());ctx=load(a.stage/'context.json');base=load(ctx['base']);final=load(a.stage/'package-compact.json');report=load(a.stage/'composer-report.json');new=final['rows'][len(base['rows']):]
|
|
assert len(ctx['original48_ids'])==48 and len(ctx['partial_parent_ids'])==6 and ctx['source_parent_count']==54 and ctx['source_slot_count']==111
|
|
assert final['rows'][:len(base['rows'])]==base['rows'] and new==report['added'] and new
|
|
assert final['pushes']==package_pages(final['rows'])
|
|
assert len({(r['table_name'],r['id'])for r in final['rows']})==len(final['rows'])
|
|
assert {r['table_name']for r in new}=={'ItemEffect','ItemXItemEffect'} and all(r.get('record_status','valid')=='valid'for r in new)
|
|
sources={x['entry']:x['source']for x in ctx['items']};reviewed=set(ctx['reviewed_spell_ids']);original48=set(ctx['original48_ids']);preheld={x['entry']:x for x in ctx['preheld']};blocked={x['entry']:x['reason']for x in report['blocked']};deferred={(x['entry'],x['slot']):x for x in report['deferred_source_slots']}
|
|
effects={r['ID']:r for r in ctx['selected_original_ItemEffect']}
|
|
for r in base['rows']:
|
|
if r['table_name']=='ItemEffect':
|
|
if r.get('record_status','valid')=='removed':effects.pop(r['id'],None)
|
|
else:effects[r['id']]=r['record']
|
|
old_links=effective_item_links(ctx['selected_original_ItemXItemEffect'],base['rows']);before=set()
|
|
for link in old_links:
|
|
if link['ItemID']in sources and link['ItemEffectID']in effects:before.add((link['ItemID'],effects[link['ItemEffectID']]['LegacySlotIndex']))
|
|
added_effects={r['id']:r for r in new if r['table_name']=='ItemEffect'};links=[r for r in new if r['table_name']=='ItemXItemEffect'];added=set()
|
|
assert len(links)==len(added_effects)==len(new)//2
|
|
for link in links:
|
|
entry=link['source_item'];slot=link['source_slot'];key=(entry,slot);source=sources[entry];suffix=str(slot+1);effect=added_effects[link['record']['ItemEffectID']];row=effect['record']
|
|
assert key not in before and key not in deferred and entry not in preheld and entry not in blocked and key not in added
|
|
added.add(key);assert link['record']['ItemID']==entry and effect['source_item']==entry and effect['source_slot']==slot
|
|
assert row['LegacySlotIndex']==slot and row['SpellID']==source['spellid_'+suffix] and row['SpellID']in reviewed
|
|
assert row['TriggerType']==source['spelltrigger_'+suffix]==1 and row['Charges']==source['spellcharges_'+suffix]==0 and source['spellppmrate_'+suffix]==0
|
|
assert row['CoolDownMSec']==source['spellcooldown_'+suffix] and row['CoolDownMSec']in(-1,0)
|
|
assert row['CategoryCoolDownMSec']==source['spellcategorycooldown_'+suffix] and row['CategoryCoolDownMSec']in(-1,0)
|
|
assert row['SpellCategoryID']==source['spellcategory_'+suffix]==0 and row['ChrSpecializationID']==row['PlayerConditionID']==0
|
|
assert link['source_effect_slot_authority']['full_source_metadata_authority']is False
|
|
assert encode(row,ctx['schemas']['ItemEffect']).hex()==effect['wire_hex']
|
|
assert encode(link['record'],ctx['schemas']['ItemXItemEffect']).hex()==link['wire_hex']
|
|
assert not source.get('script_name') and not source.get('duration') and source.get('extra_flags',0)in(0,4)
|
|
assert {e for e,s in added}==set(report['selected_item_ids'])
|
|
assert len(sources)+len(preheld)==54 and len(ctx['source_slot_facts'])==111
|
|
coverage=[]
|
|
for fact in ctx['source_slot_facts']:
|
|
entry,slot=fact['entry'],fact['slot'];key=(entry,slot)
|
|
if entry in preheld:status='parent-held';reason=preheld[entry]['reasons']
|
|
elif entry in blocked:status='parent-admission-held';reason=blocked[entry]
|
|
elif key in added:status='new-reviewed-equip-slot';reason=None
|
|
elif key in deferred:status='source-slot-held';reason=deferred[key]['reason']
|
|
elif key in before:status='existing-slot-preserved';reason=None
|
|
else:raise AssertionError(('Unaccounted source slot',fact))
|
|
coverage.append(dict(fact,status=status,reason=reason))
|
|
(a.stage/'source-slot-coverage.json').write_text(json.dumps({'source_parents':54,'original48_parents':48,'source_slots':111,'original48_slots':94,'rows':coverage},indent=2)+'\n')
|
|
assert report['completion_policy']=='additive-reviewed-missing-equipment-slots' and report['existing_links_preserved'] and not report['full_item_definition_completion_claimed']
|
|
counts=collections.Counter(x['status']for x in coverage);receipt={'status':'PASS','base_rows':len(base['rows']),'rows':len(final['rows']),'new_reviewed_equip_slots':len(added),'affected_parents':len({e for e,s in added}),'original48_affected_parents':len({e for e,s in added if e in original48}),'source_scope_parents':54,'source_scope_slots':111,'original48_slots':94,'parent_preheld':len(preheld),'parent_admission_blocked':len(blocked),'source_slot_status_counts':dict(counts),'source_deferred_slots':len(deferred),'existing_metadata_relationship_prefix_preserved':True,'original_slot_collisions_absent':True,'unsafe_proc_use_definition_timing_holds_preserved':True,'source_slot_only_authority':True,'native_or_combat_acceptance':False,'old_identity_proc_category_tests_reused':True}
|
|
(a.stage/'validation.json').write_text(json.dumps(receipt,indent=2)+'\n');print('PASS:',len(added),'new equipment slots;',len(coverage),'source slots accounted;',len(final['rows']),'rows; original prefix/unsafe holds preserved')
|
|
if __name__=='__main__':main()
|