Files
WoW-Hybrid-gateway/ops/item_reference_retention.py
praxisandClaude Fable 5.2 8a24c445b0 Content pipeline and operator tools
367 files, from working commit b1a079a.

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

30 lines
1.4 KiB
Python

"""Retain agreeing quest/page fields from the complete same-item native baseline.
This proves existing reference identity, not that referenced quests or pages are
implemented. A source/native difference stays a dependency for another policy.
"""
import copy
from item_material_retention import evidence as material_evidence,digest
POLICY='retain-exact-native-item-quest-page-references-v1'
FIELDS=(('start_quest','StartQuestID'),('page_text','PageID'),
('page_language','LanguageID'),('page_material','PageMaterialID'))
def evidence(source,basic,native,schema):
identity=material_evidence(source,basic,native,schema)
values={}
for old,new in FIELDS:
a=source.get(old);b=native.get(new)
if type(a)is not int or type(b)is not int or not 0<=a<=0x7fffffff or a!=b:
raise ValueError('Existing native quest/page reference differs: '+old)
values[old]=dict(native_field=new,source_value=a,native_value=b)
return dict(policy=POLICY,source_item=source['entry'],
source_record_sha256=digest(source),native_identity=copy.deepcopy(identity),
fields=values,new_references_introduced=False,referenced_content_verified=False)
def verify(source,basic,native,schema,proof):
actual=evidence(source,basic,native,schema)
if not isinstance(proof,dict)or proof!=actual or digest(proof)!=digest(actual):
raise ValueError('Quest/page reference retention provenance changed')
return actual