883 files, from working commit b1a079a. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
48 lines
5.4 KiB
Python
48 lines
5.4 KiB
Python
#!/usr/bin/env python3
|
|
"""Focused next-stage relationship/value check; private catalogue inputs only."""
|
|
import argparse,copy,hashlib,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 encode,package_payloads,package_pages
|
|
|
|
|
|
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());context=load('context.json');base=json.loads(Path(context['base']).read_text());final=load('package-compact.json');report=load('composer-report.json');rows=base['rows'];added=final['rows'][len(rows):]
|
|
assert final['rows'][:len(rows)]==rows,'Unrelated published rows changed'
|
|
assert len(added)==len(report['added'])==308 and added==report['added']
|
|
assert len({(r['table_name'],r['id'])for r in final['rows']})==len(final['rows'])
|
|
source={r['entry']:r for r in context['items']};effects={r['id']:r for r in added if r['table_name']=='ItemEffect'};links=[r for r in added if r['table_name']=='ItemXItemEffect'];parents={r['ID']:r for r in context['effective_parent_authority']['parents']};counts={}
|
|
for link in links:
|
|
item=link['source_item'];slot=link['source_slot'];s=source[item]['source'];effect=effects[link['record']['ItemEffectID']];v=effect['record'];suffix=str(slot+1)
|
|
assert link['record']['ItemID']==item and effect['source_item']==item and effect['source_slot']==slot
|
|
assert v['SpellID']==s['spellid_'+suffix] and v['LegacySlotIndex']==slot
|
|
assert v['TriggerType']==s['spelltrigger_'+suffix]==1
|
|
assert v['Charges']==s['spellcharges_'+suffix]==0 and s['spellppmrate_'+suffix]==0
|
|
assert v['CoolDownMSec']==s['spellcooldown_'+suffix] and v['CategoryCoolDownMSec']==s['spellcategorycooldown_'+suffix] and v['SpellCategoryID']==s['spellcategory_'+suffix]
|
|
assert s.get('extra_flags',0)==0 and not s.get('script_name') and not s.get('duration')
|
|
for r in [link,effect]:
|
|
proof=r['source_effect_slot_authority'];assert proof['source_entry']==item and proof['source_record_sha256']==source[item]['source_record_sha256'] and proof['effective_parent_wire_sha256']==parents[item]['wire_sha256'] and proof['full_source_metadata_authority']is False and proof['authority']=='source-effect-slots-only'
|
|
assert 'source_record_sha256'not in r,'Do not manufacture full-template authority'
|
|
counts[item]=counts.get(item,0)+1
|
|
assert len(counts)==153 and len(links)==154 and 18608 in counts
|
|
assert {r['table_name']for r in added}=={'ItemEffect','ItemXItemEffect'}
|
|
assert len(context['preheld'])==48 and len(report['blocked'])==5
|
|
reasons={r['reason']for r in report['blocked']};assert reasons=={'Existing slot differs; additive completion cannot replace it','Unreviewed source use/proc/charge/cooldown'}
|
|
assert final['push_id']==package_payloads(final['rows'])[0]
|
|
# The actual changed parent must remain blocked without explicit field
|
|
# authority. A two-row view exercises current-parent bytes/type refusal
|
|
# without rejoining the catalogue or rechecking old admitted cohorts.
|
|
item=next(i for i in counts if i!=18608);catalogue=source[item];parent=parents[item];mini=copy.deepcopy(base);mini['rows']=[r for r in rows if r['table_name']in ['Item','ItemSparse'] and r['id']==item];mini['push_id']=package_payloads(mini['rows'])[0];mini['pushes']=package_pages(mini['rows']);auth=copy.deepcopy(context['effective_parent_authority']);auth['parents']=[copy.deepcopy(parent)]
|
|
def compose(authority):return compose_passive_link_completion(mini,[catalogue],set(context['reviewed_spell_ids']),[],[],context['schemas'],context['maxima'],missing_slots_only=True,effective_parent_authority=authority)
|
|
assert compose(None)['blocked'],'Whole-template authority gate silently weakened'
|
|
stale=copy.deepcopy(auth);stale['parents'][0]['sparse_record']['ItemLevel']+=1;stale['parents'][0]['wire_sha256']['ItemSparse']=hashlib.sha256(encode(stale['parents'][0]['sparse_record'],context['schemas']['ItemSparse'])).hexdigest()
|
|
assert compose(stale)['blocked'][0]['reason']=='Effective parent published bytes differ'
|
|
wrong=copy.deepcopy(auth);wrong['parents'][0]['basic_record']['ClassID']+=1
|
|
assert compose(wrong)['blocked'][0]['reason']=='Effective parent source entry/type slot authority differs'
|
|
stale=copy.deepcopy(auth);stale['parents'][0]['source_record_sha256']='0'*64
|
|
assert compose(stale)['blocked'][0]['reason']=='Effective parent source entry/type slot authority differs'
|
|
validation={'result':'PASS','base_rows':len(rows),'rows':len(final['rows']),'changed_items':len(counts),'added_passive_slots':len(links),'added_ItemEffect':len(effects),'added_ItemXItemEffect':len(links),'previous206_primary_holds':206,'remaining_primary_holds':53,'remaining_missing_complete_Sparse':48,'remaining_missing_Item_subset':39,'remaining_conflict_or_execution':5,'all_prior_rows_exact':True,'only_two_relationship_tables_changed':True,'native_original_parent18608_included':True,'source_exact_fields_and_scoped_authority':True,'default_gate_current_bytes_source_type_pin_refusals':True,'whole_template_completion_claimed':False,'render_assets_metadata_baselines_unchanged':True,'old889_79_61_32_flag4_tests_not_repeated':True,'native_client_or_Octo_equip_refresh_verified':False}
|
|
(a.stage/'validation.json').write_text(json.dumps(validation,indent=2)+'\n');print('PASS153items/154passive slots; all83231prior rows preserved;53primaryholds retained')
|
|
if __name__=='__main__':main()
|