#!/usr/bin/env python3 """Project-scoped 5.11 validation against recorded native FxPlug structure. The global skill checker currently admits 5.13+, so its original 5.11 guard result is retained separately; this does not relabel that checker as passed. """ from pathlib import Path import hashlib import json import runpy import xml.etree.ElementTree as E ROOT=Path(__file__).resolve().parent.parent module=runpy.run_path(str(ROOT/'tools/build_template.py'),run_name='template_contract') file=ROOT/'template'/'\u5927\u9c7c\u8c03\u8272.moef' data=file.read_bytes();contract=module['verify'](data,module['metadata']()) root=E.fromstring(data);scene=root.find('scene');factories={f.get('id'):f.get('uuid') for f in root.findall('factory')} project=[node for node in scene.findall('scenenode') if factories.get(node.get('factoryID'))==module['PROJECT_UUID']][0] assert root.get('version')=='5.11' and root.findtext('displayversion')=='5.4.5' mask=0x10000001;selected=[];checked=0 for node in scene.iter(): if node.tag in module['CONTENT_TAGS'] and node is not project: if node.find('baseFlags') is not None: checked+=1 if int(node.findtext('baseFlags'))&mask:selected.append(node.get('id')) assert not selected and scene.findtext('currentObject')==project.get('id') assert int(project.findtext('baseFlags'))==268435473 selection=dict(passed=True,sha256=hashlib.sha256(data).hexdigest(),version='5.11',selectionMask=hex(mask),projectID=project.get('id'),contentObjectsChecked=checked,selectedContent=[],selectedContentCount=0,currentObject=scene.findtext('currentObject'),currentObjectIsProject=True,nativeUIVerified=False,validator='project-scoped native-5.11 field comparison',scope='Saved fields only; no rendering or old-FCP execution') qa=ROOT/'template/verification';(qa/'SavedSelection.json').write_text(json.dumps(selection,indent=2)+'\n') skill=json.loads((qa/'SkillAudit.json').read_text()) assert skill['errors']==['Saved selection: Unverified Motion XML version/schema; obtain native evidence first'] assert skill['basic']['entity_ids_unique'] and skill['basic']['published_count']==2 and not skill['basic']['unresolved_media'] evidence=dict(path='~/Movies/Motion Templates.localized/Effects.localized/Color Finale/ColorFinalePro/ColorFinalePro.moef',sha256='bfab9157b988acaf5c078a0837085843f2021e93a2e411eec9d94120f11ddd69',version='5.11',displayversion='5.4.5',projectBaseFlags=268435473,currentObject='10000',scenenodeVersion='5',widgetBaseFlags=16,layerAndSourceBaseFlags=524304,fxPlugBaseFlags=8589934608,allContentSelectionBits=0) report=dict(passed=True,sha256=selection['sha256'],version='5.11',displayversion='5.4.5',nativeReference=evidence,staticContract=contract,savedSelection=selection,skillCheckerStatus='unsupported-version-guard; original SkillAudit.json retained unchanged',otherSkillStructuralErrors=[],copyrightDisplayRows=0,oldFCPActuallyTested=False,scope='Native-template structure and saved-state comparison only; FCP host acceptance is separate') (qa/'Compatibility.json').write_text(json.dumps(report,ensure_ascii=False,indent=2)+'\n') print(json.dumps(dict(passed=True,version=report['version'],displayversion=report['displayversion'],copyrightDisplayRows=0,contentSelected=0,oldFCPActuallyTested=False)))