"""Compare owned wrapper model/default and service boundaries with committed pre-migration source.""" import hashlib,json,re,subprocess from pathlib import Path root=Path(__file__).resolve().parent # Resolve from own tracked script ancestry without machine-specific checkout paths. while not list(root.glob('*.slnx')): if root.parent==root:raise RuntimeError('Repository root not found') root=root.parent base='a47ffb91' folder=Path('src/Server/ZB.MOM.WW.OtOpcUa.AdminUI/Components/Shared/Uns') result={'baseline':base,'checks':[]} for name in ['AddReferenceModal','ImportEquipmentModal','ScriptedAlarmModal','VirtualTagModal']: path=folder/(name+'.razor');old=subprocess.check_output(['git','show',base+':'+path.as_posix()],cwd=root,text=True);new=(root/path).read_text() item={'file':str(path),'beforeSha256':hashlib.sha256(old.encode()).hexdigest(),'afterSha256':hashlib.sha256(new.encode()).hexdigest()} if name in ['ScriptedAlarmModal','VirtualTagModal']: model=lambda s:s[s.index(' private sealed class FormModel'):].strip() item['modelDefaultsAnnotationsExact']=model(old)==model(new);assert item['modelDefaultsAnnotationsExact'] constructor='ScriptedAlarmInput' if name=='ScriptedAlarmModal' else 'VirtualTagInput' payload=lambda s:re.sub(r'\s+','',re.search(r'new '+constructor+r'\((.*?)\);',s,re.S).group(1)) item['payloadFieldsOrderExact']=payload(old)==payload(new);assert item['payloadFieldsOrderExact'] if name=='ImportEquipmentModal': item['parserDelegationRetained']='EquipmentCsvParser.Parse(csv)' in new and ".Split(',')" not in new;assert item['parserDelegationRetained'] item['summaryCloseTimingRetained']='_hasImportOutcome ? completedAction : cancelAction' in new;assert item['summaryCloseTimingRetained'] if name=='VirtualTagModal': types=lambda s:re.search(r'private static readonly string\[\] DataTypes =\s*(\[.*?\]);',s,re.S).group(1) item['dataTypesExact']=types(old)==types(new);assert item['dataTypesExact'] item['createdOptionBeforeSelectedValue']=new.index('_scripts.Add(')